Environment for @testitem run in VS-code

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…

1 Like

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 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 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 just as you would for a regular dependency — except I think you have to add it manually, rather than via the REPL.

1 Like