vscode
vscode copied to clipboard
Vitest crashes and isn't recoverable if global-setup fails
Describe the bug
See these logs:
[INFO 11:59:12] [Vitest] Extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 11:59:12] [API] Running Vitest: v1.4.0 (/Users/dkMaLyLo/Documents/tmp/vscode/samples/basic/vitest.config.ts)
[Worker] root /Users/dkMaLyLo/Documents/tmp/vscode/samples/basic
[INFO 11:59:12] [API] Vitest process 12024 created
[Worker] Starting inspector on 127.0.0.1:53040 failed: address already in use
[Error 11:59:14] [API] [Error Error] write EPIPE
Error: write EPIPE
at ChildProcess._send (node:internal/child_process:865:20)
at ChildProcess.send (node:internal/child_process:738:19)
at post (/Users/dkMaLyLo/Documents/tmp/vscode/src/api/rpc.ts:101:16)
at ChildProcess.<anonymous> (/Users/dkMaLyLo/Documents/tmp/vscode/node_modules/.pnpm/[email protected]/node_modules/birpc/dist/index.mjs:77:9)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
[Worker]
⎯ Error during global setup ⎯⎯
Error: This is a global setup error.
❯ Object.setup global-setup.ts:2:9
1| export default async function () {
2| throw new Error('This is a global setup error.')
| ^
3| };
❯ rerunTests ../../dist/worker.js:929:5
❯ runTests ../../dist/worker.js:938:9
❯ Proxy.collectTests ../../dist/worker.js:973:7
❯ process.<anonymous> ../../dist/worker.js:852:20
Reproduction
- Clone this: https://github.com/ffMathy/vscode/tree/feature/repro-global-setup-crash
- Run the basic tests sample.
- It now can't discover or run any tests, and it gets stuck in a state where the socket disconnects and can't reconnect.
System Info
System:
OS: macOS 14.4
CPU: (10) arm64 Apple M1 Pro
Memory: 118.06 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.15.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.5.0 - /usr/local/bin/npm
pnpm: 8.6.12 - /usr/local/bin/pnpm
IDEs:
VSCode: 1.87.2 - /opt/homebrew/bin/code
Vim: 9.0 - /usr/bin/vim
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
Browsers:
Chrome: 123.0.6312.59
Edge: 122.0.2365.92
Safari: 17.4
npmPackages:
vite: ^2.8.6 => 2.9.9
vitest: ^1.4.0 => 1.4.0
Used Package Manager
pnpm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue 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 or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
What do you mean by "not recoverable"? Can't you fix the error and press "Refresh Tests" button?
Nope. Once it disconnects, I have to restart the entire VS Code window.