How to add a package as a test dependency from the REPL?

To add a dependency ony for testing, I followed the instructions here: Pkg · The Julia Language.

But this involves editing Project.toml directly. Can this be done through the REPL (like pkg> add ... does for a proper dependency)?

Related (for Julia pre-0.7): Dependency only for testing

1 Like

AFAIK you still need to edit the Project.toml.

A convenient way to do this is to pkg> add TheDependency, then open the editor and just move the line and to [extras] and add it to the relevant line in [targets].

8 Likes

This is what I am doing now. Thanks. I see you already opened an issue to request this:

Hello,

How should we add a test-only package dependency from the REPL, without copy-pasting from the Project.toml?

3 Likes