What's the official way to keep track of package test dependencies that are not needed by a Package?

Say I have am developing PkgA and I needed PkgB and PkgC for PkgA to work. I know can just ]add these. What about PkgD and PkgE that I only need in testing my PkgA? What’s the official and recommended way to keep track on them? Should they be added to Project.toml somehow?

Don’t know if it’s “official”, but something like this in the Project.toml is what I use:

[extras]
Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[targets]
coverage = ["Coverage"]
test = ["Test", "Random"]
3 Likes

This is the recommended way, documented here:

https://julialang.github.io/Pkg.jl/dev/creating-packages/#Test-specific-dependencies-in-Julia-1.0-and-1.1-1

but note

https://julialang.github.io/Pkg.jl/dev/creating-packages/#Test-specific-dependencies-in-Julia-1.2-and-above-1

4 Likes