-
-
Notifications
You must be signed in to change notification settings - Fork 111
Closed
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
I have run some tests via the extension and everything is fine. Then I changed the vitest.config.ts file.
Re-running the tests did not take the changes into account.
Debugging the tests take these changes into account.
That is, tests behave differently depending on whether they are run or debugged.
In my case I have a vitest.workspace.ts file, but when trying to reproduce the bug, I was able to reproduce the same behaviour w/o a vitest.workspace. However, when I tried to create an example (see github repo) the error only occurred when setting up a vitest.workspace.
Reproduction
Install:
git clone https://github.com/jpilgrim/vitest_bug_demo.git
cd vitest_bug_demo
npm i
code .This little project (created via npx create vite@latest demo -- --template react-ts) has a vitest.workspace.ts file (with only one workspace).
- Testing view, run all tests, ok
- Run src/demo.test.ts ok
- Debug src/demo.test.ts ok
- Open vitest.config.ts, uncomment line 8 (setupFiles: ['setup2'])
- Run src/demo.test.ts ok <-- this is the bug!
- Debug src/demo.test.ts
Error: Failed to load url ...vitest_bug_demo/setup2
Output
Run output:
[18:20:33] Initiating deferred test run
[INFO 18:20:33] Running 1 file(s): src/demo.test.ts
[18:20:33] The runner is starting because tests src/demo.test.ts were started due to a file change
[18:20:33] No task result for "demo.test.ts", ignoring
[18:20:33] Enqueuing "Test 1" because it was just collected
[18:20:33] No errors found for "demo.test.ts"
[18:20:33] Marking "Test 1" as passed
[18:20:33] Ending test run src/demo.test.ts
[18:20:34] [VSCODE] Ignoring file: node_modules/.vite/vitest/results.jsonDebug output:
[INFO 18:21:02] [DEBUG] Starting debugging session /.../.nvm/versions/node/v20.17.0/bin/node
[INFO 18:21:02] [DEBUG] Debugging started
[18:21:03] Initiating deferred test run
[INFO 18:21:03] Running 1 file(s) with name pattern: ^\s?Test 1$
[18:21:03] The runner is starting because tests src/demo.test.ts were started due to a file change
[18:21:03] Enqueuing "Test 1"
[18:21:03] [VSCODE] File deleted: vitest.config.ts.timestamp-1731259263303-68a2728011195.mjs
[Error 18:21:04] Error in /.../vitest_bug_demo/src/demo.test.ts Error: Failed to load url /.../vitest_bug_demo/setup2 (resolved id: /.../vitest_bug_demo/setup2). Does the file exist?
at loadAndTransform (file:///.../vitest_bug_demo/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:51920:17)
[18:21:04] Marking "demo.test.ts" as failed with 1 errors
[18:21:04] Marking "demo.test.ts" as failed with 1 errors
[18:21:04] Ending test run src/demo.test.ts
[18:21:04] [API] Vitest WebSocket connection closed, cannot call RPC anymore.
[18:21:04] Disposing test runner
[18:21:04] Ending test run <none>
[18:21:04] [VSCODE] Ignoring file: node_modules/.vite/vitest/results.json
### Version
1.6.6
### Validations
- [X] Check that you are using the latest version of the extension
- [X] Check that there isn't [already an issue](https://github.com/vitest-dev/vscode/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitest-dev/vscode/discussions) or join our [Discord Chat Server](https://chat.vitest.dev).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)