# Navigation between tests & src/

**URL:** <https://discourse.julialang.org/t/navigation-between-tests-src/129390>\
**Category:** General Usage\
**Tags:** testing, vscode\
**Created:** [May 27, 2025, 4:48pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390 "2025-05-27T16:48:15Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [May 27, 2025, 4:48pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/1 "2025-05-27T16:48:15Z")

</div>

This is a pretty minor thing, but I figured I’d ask about it anyway.

In VS Code, when working on code in a package, I can command-click on a function call and be taken to its definition (although if there are multiple methods with the same name, it can’t figure out which one is being called, but in practice it works decently well).

However, if I’m working on that package’s unit tests, navigation to a package function is unavailable, so I generally need to go use the text search to locate methods. Is there some way to get this navigation working in this common use case?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 27, 2025, 5:06pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/2 "2025-05-27T17:06:21Z")

</div>

Yes, there are two options:

1. you have a Project.toml in the tests folder. Then you can navigate there, activate it and apply the develop command to your main package
2. you add one or more lines like this to `runtests.jl` or to the sub-test script included by `runtests.jl`:

```julia
if false include("../src/<YourPackage>.jl") end

```

---

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [May 27, 2025, 6:00pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/3 "2025-05-27T18:00:58Z")

</div>

Interesting! I do already have a `Project.toml` in my tests folder, but I think I’ll use option 2, because that seems like it will “just work” for new developers, but option 1 would need them all to `dev` the project individually (unless I check in the `Manifest.toml`, which I think I don’t want to do), right?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [May 27, 2025, 6:25pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/4 "2025-05-27T18:25:23Z")

</div>

A better option is probably to put

```toml
[sources]
PackageName = {path = ".."}

```

in `test/Project.toml`, where `PackageName` is the name of your package. This works in Julia \>= 1.11, which is probably what new developers would be using.

---

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [May 27, 2025, 7:21pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/5 "2025-05-27T19:21:26Z")

</div>

Ah! That would indeed be better, and a good reason to bump us up to 1.11. I’ve been sitting on 1.10 for a while by pure inertia.

---

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [May 27, 2025, 8:09pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/6 "2025-05-27T20:09:04Z")

</div>

Unfortunately, none of the solutions that involve putting the package in `test/Project.toml` seem to work for me, I’m getting variations on the `can not merge projects` error (see ["cannot merge projects" error · Issue #1585 · JuliaLang/Pkg.jl · GitHub](https://github.com/JuliaLang/Pkg.jl/issues/1585)) when I try.

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [May 27, 2025, 11:09pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/7 "2025-05-27T23:09:21Z")

</div>

Even if you delete the Manifest?

---

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [May 28, 2025, 6:15pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/8 "2025-05-28T18:15:25Z")

</div>

Oh indeed, that seems to be working - “delete the Manifest.toml” isn’t normally in my repertoire, I think I was trying to use `resolve` and/or `instantiate` within the REPL, I don’t remember exactly how, but clearly it wasn’t working.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [May 28, 2025, 6:17pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/9 "2025-05-28T18:17:49Z")

</div>

Yes, it is somewhat annoying that sometimes you have to delete the manifest file manually, and that Julia (or Pkg?) cannot figure out that this might be needed itself. At least Julia or Pkg should give a hint in such a situation that this might be needed.

---

<div class="post-metadata">

**Author:** ![Olivier\_Merchiers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olivier_merchiers/32/4073_2.png) [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Post date:** [May 28, 2025, 11:06pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/10 "2025-05-28T23:06:13Z")

</div>

Very interesting indeed.  
Can you just put the github repo adress? Or does it need to be the path on your machine?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [May 29, 2025, 2:10am UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/11 "2025-05-29T02:10:43Z")

</div>

> [@Ken\_Williams](#):
>
> “delete the Manifest.toml” isn’t normally in my repertoire

Just to be clear: I don’t think (committed) Manifests have any place in package development. Manifests are for when you need exactly reproducible environments, like for a research project. I would recommend setting up `make clean` (if you’re on Unix) to remove all `Manifest.toml` files in your project.

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [May 29, 2025, 2:13am UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/12 "2025-05-29T02:13:25Z")

</div>

> [@Olivier\_Merchiers](#):
>
> Can you just put the github repo adress? Or does it need to be the path on your machine?

Yes, [the `[sources]` feature has a large variety of options](https://pkgdocs.julialang.org/v1/toml-files/#The-%5Bsources%5D-section), including a GitHub repo address. Of course, you should not be using that for the package to be tested in the `Project.toml` describing the test environment. You want to test the version of the code currently on your hard drive, not whatever currently is on GitHub.

---

<div class="post-metadata">

**Author:** ![Olivier\_Merchiers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olivier_merchiers/32/4073_2.png) [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Post date:** [May 29, 2025, 8:23am UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/13 "2025-05-29T08:23:14Z")

</div>

Thanks a lot for the answer.  
But then, if I understand correctly, you cannot really use this approach in a published package for running the tests on this package?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [May 29, 2025, 11:42am UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/14 "2025-05-29T11:42:37Z")

</div>

I don’t understand what you mean… what approach? What doesn’t work?

My recommendation for testing, independent of whether this fixes issues with VS Code (which I don’t use), is

- Use a `test/Project.toml`, as of recently with `[sources]` pointing to the parent folder, instead of the old `[extras]` approach. That makes the `docs` and the `test` environments behave equivalently, avoids the undocumented “magic” of the `tests [targets]` and makes the [`TestEnv` package](https://github.com/JuliaTesting/TestEnv.jl) mostly unnecessary.
- Do not commit any `Manifest.toml` files

If you need to start a REPL to run tests using a pre-1.11 version of Julia, `] dev ..` should do the trick (Personally, I set up `make devrepl` to do that). Of course, `] test` and `TestEnv` still also work, both with `[sources]` and with `test/Project.toml`.

For the full details on what I currently consider as best practices, you can have a look at my [cookiecutter template for Julia projects](https://github.com/goerz/cookiecutter-juliapackage).

---

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [June 4, 2025, 3:50pm UTC](https://discourse.julialang.org/t/navigation-between-tests-src/129390/15 "2025-06-04T15:50:57Z")

</div>

> [@goerz](#):
>
> Just to be clear: I don’t think (committed) Manifests have any place in package development.

Yeah, I agree with that - I highly prefer to develop things as well-behaved packages, and set all relevant constraints (hopefully loosely) in the `Project.toml`.

> [@goerz](#):
>
> Manifests are for when you need exactly reproducible environments, like for a research project.

The other big use case for us is application deployment environments, where we need to upgrade dependencies and versions carefully from one deployment to the next.
