When using multiple Vitest configurations, running the tests runs outdated code #535
Closed
4 tasks done
Labels
p5-urgent
Fix build-breaking bugs affecting most users, should be released ASAP (priority)
Describe the bug
I have added two different configuration files in the same project :
vitest.config.ts
andvitest_sometimes.config.ts
. The first file excludes some test files that I do not want to run by default - i. e. some performance benchmark tests that take a very long time - the latter includes only those tests.When I want to run the "sometimes" set of tests, I specify the config file in the CLI, or use the extension to select the "sometimes" profile or run them manually.
However, the extension does not refresh the contents of the default set of tests, nor the code that they import, when running the tests. Instead, it seems to use cached code and so it runs outdated tests and shows results that do not match the current files. In order to use the newly saved code, I have to manually click the "Refresh" button, or restart VS Code.
This happens only in the test files intended for the default config, and the "sometimes" tests work perfectly !
(Note: the default file does not specify include paths and uses the default settings. I have tried to explicitly import the default test files and got the same results.)
This bug can be quite misleading, and has already caused me to commit broken code after seeing the tests pass - though I suppose that's on me for not automating the tests on commit.
The issue seems similar to #469, though it was fixed a month ago. However, this one was using one config file per project, whereas my issue uses multiple files in the same repo.
Reproduction
https://github.com/Fheuef/issue-vitest-config
Here are the config files for quick reference:
vitest.config.ts
vitest_sometimes.config.ts
Output
Version
1.6.9
Validations
The text was updated successfully, but these errors were encountered: