# Environment for @testitem run in VS-code

**URL:** https://discourse.julialang.org/t/environment-for-testitem-run-in-vs-code/127740
**Category:** General Usage
**Created:** [April 5, 2025, 12:20pm UTC](https://discourse.julialang.org/t/environment-for-testitem-run-in-vs-code/127740 "2025-04-05T12:20:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![krcools](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krcools/32/10212_2.png) [@krcools](https://discourse.julialang.org/u/krcools)
#### Post date: [April 5, 2025, 12:20pm UTC](https://discourse.julialang.org/t/environment-for-testitem-run-in-vs-code/127740/1 "2025-04-05T12:20:39Z")

</div>

How do you control the environment VS-code sets up to run a `@testitem`?

In particular, how do you include the development version of a dependency?

Apologies if this was already answered, as I can imagine it has…

---

<div class="post-metadata">

### Author: ![moble](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moble/32/23535_2.png) [@moble](https://discourse.julialang.org/u/moble)
#### Post date: [April 7, 2025, 6:57pm UTC](https://discourse.julialang.org/t/environment-for-testitem-run-in-vs-code/127740/2 "2025-04-07T18:57:02Z")

</div>

These are good questions; everything about testing in Julia isn’t quite documented well enough — though once tests work, it’s a dream. Since no one else has responded, I’ll give it a shot. The following is based on my experience, not actual knowledge of the inner workings of these things.

The environment appears to be controlled in the same way that [standard tests are](https://pkgdocs.julialang.org/v1/creating-packages/#Test-specific-dependencies) through the `targets` section of the main package’s `Project.toml` file, which means you also have to add it to the `extras` section (and optionally, the `compat` section).

IIRC, the older `test/Project.toml` approach doesn’t work. It certainly [appears to be the case](https://github.com/julia-vscode/TestItemRunner.jl/blob/28299afeaab63b69afff8a2a06cffaa30a8cd232/src/TestItemRunner.jl#L136-L146) that `TestItemRunner` works by finding a `Project.toml`, then looking for any test in that file’s directory or subdirectories.

I don’t think I’ve tried using the development version of a testing dependency, but I would guess that you would add it to [the `sources` section](https://pkgdocs.julialang.org/v1/toml-files/#The-%5Bsources%5D-section) just as you would for a regular dependency — except I think you have to add it manually, rather than via the REPL.
