-
-
Notifications
You must be signed in to change notification settings - Fork 106
Description
Describe the bug
Using even the https://github.com/vitest-dev/vitest/tree/main/examples/basic everything works, except trying to debug in the extension. Be it the "testing" sidebar or "Debug test at Cursor" in a source file.
This would seem to be a local environmental issue, but the error is less than helpful and seems to be specific to this extension. Debugging in VSCode as a launch profile using npm run test:run command works perfectly, tests complete, breakpoints in ts files, etc. Node in the terminal path is 24.11.0.
Interestingly I only saw the "This is a bug in Vitest. Please, open an issue with reproduction." on the example test, and only one of the example files at that. But I saw "No task result for "suite.test.ts", ignoring" output and "No test suite found in file" UI in every project I tried to run debug tests on.
Debug Tests:
But a non-debug "Run Tests"
### Reproduction
https://github.com/vitest-dev/vitest/tree/main/examples/basic
### Output
```shell
Debug tests
[INFO 2:22:50 PM] [v0.0.0] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 2:22:51 PM] [API] Resolving configs: basic/vite.config.ts
[INFO 2:22:53 PM] [API] Running Vitest v4.0.8 (basic/vite.config.ts) with "C:\nvm4w\nodejs\node.EXE C:/Users/William/.vscode/extensions/vitest.explorer-1.32.1/dist/worker.js"
[INFO 2:22:54 PM] [API] Watching vite.config.ts
[INFO 2:22:54 PM] [VSCODE] Watching basic with pattern **/*
[INFO 2:22:54 PM] [API] Collecting tests: test/basic.test.ts, test/suite.test.ts
[INFO 2:22:58 PM] [DEBUG] Starting debugging session C:\nvm4w\nodejs\node.EXE
[INFO 2:22:59 PM] [DEBUG] Debugging started
[2:22:59 PM] [VSCODE] Ignoring file: node_modules\.vite-temp\vite.config.ts.timestamp-1762870979727-00a02e27f03048.mjs
[INFO 2:22:59 PM] Running all tests in basic
[2:22:59 PM] Starting a test run because test/basic.test.ts test/suite.test.ts triggered a watch rerun event
[2:22:59 PM] Enqueuing "Math.sqrt()"
[2:22:59 PM] Enqueuing "Squared"
[2:22:59 PM] Enqueuing "JSON"
[2:22:59 PM] Enqueuing "foo"
[2:22:59 PM] Enqueuing "bar"
[2:22:59 PM] Enqueuing "snapshot"
[2:22:59 PM] [VSCODE] File deleted: node_modules\.vite-temp\vite.config.ts.timestamp-1762870979727-00a02e27f03048.mjs
[INFO 2:23:00 PM] [Worker] Debugger attached.
[Error 2:23:00 PM] Error in D:/vitest-4.0.8/examples/basic/test/basic.test.ts Error: Vitest failed to find the current suite. This is a bug in Vitest. Please, open an issue with reproduction.
at assert (file:///D:/vitest-4.0.8/examples/basic/node_modules/@vitest/runner/dist/index.js:525:9)
at getCurrentSuite (file:///D:/vitest-4.0.8/examples/basic/node_modules/@vitest/runner/dist/index.js:555:2)
at Object.<anonymous> (file:///D:/vitest-4.0.8/examples/basic/node_modules/@vitest/runner/dist/index.js:457:2)
at chain (file:///D:/vitest-4.0.8/examples/basic/node_modules/@vitest/runner/dist/chunk-tasks.js:9:14)
at D:/vitest-4.0.8/examples/basic/test/basic.test.ts:6:1
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at VitestModuleEvaluator.runInlinedModule (file:///d:/vitest-4.0.8/examples/basic/node_modules/vitest/dist/module-evaluator.js:174:4)
at VitestModuleRunner.directRequest (file:///d:/vitest-4.0.8/examples/basic/node_modules/vite/dist/node/module-runner.js:1146:59)
at VitestModuleRunner.cachedRequest (file:///d:/vitest-4.0.8/examples/basic/node_modules/vite/dist/node/module-runner.js:1053:73)
at VitestModuleRunner.import (file:///d:/vitest-4.0.8/examples/basic/node_modules/vite/dist/node/module-runner.js:1014:10)
[2:23:00 PM] Marking "basic.test.ts" as failed with 1 errors
[2:23:00 PM] Marking "basic.test.ts" as failed with 1 errors
[INFO 2:23:00 PM] [Worker] Waiting for the debugger to disconnect...
[2:23:00 PM] No task result for "suite.test.ts", ignoring
[2:23:00 PM] Marking "suite.test.ts" as failed with 1 errors
[2:23:00 PM] Ending test run
[2:23:00 PM] Test run promise is finished, the queue is 0
[2:23:00 PM] [API] Vitest WebSocket connection closed, cannot call RPC anymore.
[2:23:00 PM] Ending test run <none>
[2:23:00 PM] Disposing test runner
[2:23:00 PM] Ending test run <none>
[2:23:00 PM] [VSCODE] Ignoring file: node_modules\.vite\vitest\da39a3ee5e6b4b0d3255bfef95601890afd80709\results.json
Run Tests (working)
[INFO 2:24:54 PM] Running all tests in basic
[2:24:54 PM] Starting a test run because test/basic.test.ts test/suite.test.ts triggered a watch rerun event
[2:24:55 PM] No task result for "suite.test.ts", ignoring
[2:24:55 PM] No task result for "suite name", ignoring
[2:24:55 PM] Enqueuing "foo" because it was just collected
[2:24:55 PM] Enqueuing "bar" because it was just collected
[2:24:55 PM] Enqueuing "snapshot" because it was just collected
[2:24:55 PM] No errors found for "suite.test.ts"
[2:24:55 PM] No task result for "basic.test.ts", ignoring
[2:24:55 PM] Enqueuing "Math.sqrt()" because it was just collected
[2:24:55 PM] Enqueuing "Squared" because it was just collected
[2:24:55 PM] Enqueuing "JSON" because it was just collected
[2:24:55 PM] No errors found for "basic.test.ts"
[2:24:55 PM] No errors found for "suite name"
[2:24:55 PM] Marking "foo" as passed
[2:24:55 PM] Marking "bar" as passed
[2:24:55 PM] Marking "snapshot" as passed
[2:24:55 PM] No errors found for "suite.test.ts"
[2:24:55 PM] Marking "Math.sqrt()" as passed
[2:24:55 PM] Marking "Squared" as passed
[2:24:55 PM] Marking "JSON" as passed
[2:24:55 PM] No errors found for "basic.test.ts"
[2:24:55 PM] Ending test run
[2:24:55 PM] Test run promise is finished, the queue is 0
[2:24:55 PM] [VSCODE] Ignoring file: node_modules\.vite\vitest\da39a3ee5e6b4b0d3255bfef95601890afd80709\results.json
Command line `npm run test:run`
PS D:\vitest-4.0.8\examples\basic> npm run test:run
> test:run
> vitest run
RUN v4.0.8 D:/vitest-4.0.8/examples/basic
✓ test/suite.test.ts (3 tests) 3ms
✓ test/basic.test.ts (3 tests) 3ms
Test Files 2 passed (2)
Tests 6 passed (6)
Start at 14:34:05
Duration 191ms (transform 55ms, setup 0ms, collect 81ms, tests 7ms, environment 0ms, prepare 10ms)
Extension Version
1.32.1
Vitest Version
4.0.8
Validations
- Check that you are using the latest version of the extension
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.