# Test a local package

**URL:** <https://discourse.julialang.org/t/test-a-local-package/109974>\
**Category:** New to Julia\
**Created:** [February 9, 2024, 10:06am UTC](https://discourse.julialang.org/t/test-a-local-package/109974 "2024-02-09T10:06:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Post date:** [February 9, 2024, 10:06am UTC](https://discourse.julialang.org/t/test-a-local-package/109974/1 "2024-02-09T10:06:50Z")

</div>

Hi,  
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

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [February 9, 2024, 10:14am UTC](https://discourse.julialang.org/t/test-a-local-package/109974/2 "2024-02-09T10:14:23Z")

</div>

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

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

```

or if you already are in the right directory,

```julia
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.

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [February 9, 2024, 10:15am UTC](https://discourse.julialang.org/t/test-a-local-package/109974/3 "2024-02-09T10:15:41Z")

</div>

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

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

```

and then you can do:

```julia
juliatest --project=folder

```

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

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [February 9, 2024, 12:22pm UTC](https://discourse.julialang.org/t/test-a-local-package/109974/4 "2024-02-09T12:22:16Z")

</div>

I haven’t tested this, but I think [`jlpkg`](https://github.com/fredrikekre/jlpkg) would support something like

```shell
shell$ jlpkg test

```

or

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

```

  
CC: @fredrikekre
