vitest-dev / vscode

VS Code extension for Vitest
https://vitest.dev/vscode
MIT License
740 stars 83 forks source link

Errors during tests don't get reported correctly #444

Closed AlexPaven closed 1 month ago

AlexPaven commented 1 month ago

Describe the bug

For a test that throws an error, test results show "TypeError: n.getBrowserSourceMapModuleById is not a function" instead of the actual error.

Full output on Test Results tab: ⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯

Vitest caught 1 unhandled error during the test run. This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯ TypeError: n.getBrowserSourceMapModuleById is not a function ❯ Object.getSourceMap ../../Users/apaven/.vscode/extensions/vitest.explorer-1.0.5/dist/worker.js:39:3421 ❯ ../../Users/apaven/.vscode/extensions/vitest.explorer-1.0.5/dist/worker.js:13:11868 ❯ Ju ../../Users/apaven/.vscode/extensions/vitest.explorer-1.0.5/dist/worker.js:13:11814 ❯ ts ../../Users/apaven/.vscode/extensions/vitest.explorer-1.0.5/dist/worker.js:15:131 ❯ ../../Users/apaven/.vscode/extensions/vitest.explorer-1.0.5/dist/worker.js:39:3397 ❯ ../../Users/apaven/.vscode/extensions/vitest.explorer-1.0.5/dist/worker.js:39:3352 ❯ xr.onTaskUpdate ../../Users/apaven/.vscode/extensions/vitest.explorer-1.0.5/dist/worker.js:39:3286

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Reproduction

https://github.com/AlexPaven/vitest-repro (test which throws an error with minimal config)

checkout + pnpm i; pnpm test reports errors correctly, Vitest Explorer does not

OS: win11

Output

[INFO 1:21:50 PM] [API] Running Vitest v2.0.5 (vitest-repro/vitest.config.ts) with Node.js: C:\Program Files\nodejs\node.EXE
[INFO 1:21:51 PM] [API] Vitest v2.0.5 (vitest-repro/vitest.config.ts) process 24644 created
[INFO 1:21:51 PM] [API] Collecting tests: sample.test.ts
[INFO 1:22:12 PM] Running 1 file(s) with name pattern: ^\s?sample test$

Version

1.0.5

Validations