Test a local package

I was wondering if there is something like cargo test in the Julia world?
I would like to test a local package directly from the command line without having to open the REPL or having to type something like:
julia -e "using Pkg; Pkg.activate(folder);Pkg.test()"
I think something like julia --test=folder would be nice.
Thank you

I’m fairly certain that the most succinct you can do today is

julia --project=folder -e "using Pkg; Pkg.test()"

or if you already are in the right directory,

julia --project -e "using Pkg; Pkg.test()"

For interactive use going into the package manager is a minor overhead but for use in CI scripts I would definitely be happier with a command line shortcut.


Building on @GunnarFarneback’s answer.
You could use a combination of -e and --project to define an alias:

alias juliatest='julia -e "import Pkg; Pkg.test()"'

and then you can do:

juliatest --project=folder

or just juliatest --project if you are in the correct folder.


I haven’t tested this, but I think jlpkg would support something like

shell$ jlpkg test


shell$ jlpkg --project=/path/to/project test

CC: @fredrikekre
1 Like