julia-vscode / TestItemRunner.jl

Run Julia test items
MIT License
75 stars 12 forks source link

Right way to pass LocalPreferences.toml to VSCode test environment? #86

Open MilesCranmer opened 1 month ago

MilesCranmer commented 1 month ago

It seems like the VSCode test runner is unaware of the LocalPreferences.toml in my base directory. Is there any way I should be declaring it? I tried putting it in test/ too but no luck.

For the record, test/LocalPreferences.toml works if I'm running with Pkg.test(). But the VSCode test runner doesn't seem to use it?

cncastillo commented 3 weeks ago

I have the same problem. What I did (as a workaround) was to put the preferences inside test/Project.toml

[deps]
...
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"

[preferences.MyPkg]
variable = something

This is not ideal, as it cannot be .gitignore'd, but is the only solution I found to work for the VSCode tests and also ] test in the REPL. You need to restart VSCode to make the new preference take effect.

MilesCranmer commented 3 weeks ago

Thanks! TIL you can set Preferences in the Project.toml.

davidanthoff commented 2 weeks ago

There was a bug in the VS Code extension runner where it didn't pick up your local env. I just fixed that in the prerelease of VS Code. I'm not sure whether that will also fix this issue here, but worth trying. Could you give it a shot?

cncastillo commented 2 weeks ago

I just tried the VS Code extension 1.114.1 (pre-release), and I am still observing the same problem (] test picks up the test/LocalPreferences.toml, but the VSCode tests don't)

davidanthoff commented 2 weeks ago

Ok, this is actually an upstream problem: https://github.com/JuliaTesting/TestEnv.jl/issues/59