vitest-dev / vitest-dev/vitest
projects does not work with browser mode
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Describe the bug
running vitest in a monorepo, fails to work (stalls - noting happens) when packages use browser mode.
This is the exact same behavior as described here: https://github.com/vitest-dev/vitest/issues/9164
Happening on 5.0.0-beta.1 as well as on latest v4.
When running non headless vitest page display 'no test found'
Test run in non-browser environment (happy-dom).
Reproduction
tried simplified repro without success.
However, I suspect version conflict between root and package. Below is the output trace after a Ctrl+c.
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 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Failed to run the test /home/christophe/Programming/preignition/accessibleData/app/app-survey/renderer/renderer.test.ts.
❯ node_modules/.pnpm/vitest@5.0.0-beta.1_@opentelemetry+api@1.9.1_@types+node@25.6.0_@vitest+browser-playwri_53592e796b1c9a9e525229a5f01a8ec0/node_modules/vitest/dist/chunks/cli-api.MLtHkHGf.js:2627:17
❯ processTicksAndRejections node:internal/process/task_queues:105:5
Caused by: Error: [vitest] Browser connection was closed while running tests. Was the page closed unexpectedly?
❯ WebSocket.<anonymous> node_modules/.pnpm/@vitest+browser@5.0.0-beta.1_vite@8.0.10_@types+node@25.6.0_esbuild@0.27.7_terser@5.46._83b033ee639ed61e333e1cbaf5290842/node_modules/@vitest/browser/dist/index.js:3055:16
❯ WebSocket.emit node:events:519:35
❯ WebSocket.emitClose node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js:273:10
❯ Receiver.receiverOnFinish node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js:1214:20
❯ Receiver.emit node:events:507:28
❯ finish node:internal/streams/writable:953:10
❯ node:internal/streams/writable:934:13
❯ processTicksAndRejections node:internal/process/task_queues:90:21
Caused by: Error: [birpc] rpc is closed, cannot call "createTesters"
❯ node_modules/.pnpm/@vitest+browser@5.0.0-beta.1_vite@8.0.10_@types+node@25.6.0_esbuild@0.27.7_terser@5.46._83b033ee639ed61e333e1cbaf5290842/node_modules/@vitest/browser/dist/index.js:2917:34
❯ Proxy.$close node_modules/.pnpm/@vitest+browser@5.0.0-beta.1_vite@8.0.10_@types+node@25.6.0_esbuild@0.27.7_terser@5.46._83b033ee639ed61e333e1cbaf5290842/node_modules/@vitest/browser/dist/index.js:2916:18
❯ WebSocket.<anonymous> node_modules/.pnpm/@vitest+browser@5.0.0-beta.1_vite@8.0.10_@types+node@25.6.0_esbuild@0.27.7_terser@5.46._83b033ee639ed61e333e1cbaf5290842/node_modules/@vitest/browser/dist/index.js:3055:9
❯ WebSocket.emit node:events:519:35
❯ WebSocket.emitClose node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js:273:10
❯ Receiver.receiverOnFinish node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js:1214:20
❯ Receiver.emit node:events:507:28
❯ finish node:internal/streams/writable:953:10
❯ node:internal/streams/writable:934:13
System Info
System:
OS: Linux 7.0 Linux Mint 22.3 (Zena)
CPU: (16) x64 AMD Ryzen 7 7840U w/ Radeon 780M Graphics
Memory: 20.41 GB / 30.65 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 23.6.1 - /home/christophe/.nvm/versions/node/v23.6.1/bin/node
npm: 11.2.0 - /home/christophe/.nvm/versions/node/v23.6.1/bin/npm
pnpm: 11.0.3 - /home/christophe/.nvm/versions/node/v23.6.1/bin/pnpm
Browsers:
Chrome: 147.0.7727.137
Firefox: 150.0.1
Firefox Developer Edition: 150.0.1
npmPackages:
@vitest/browser: catalog: => 5.0.0-beta.1
@vitest/browser-playwright: catalog: => 5.0.0-beta.1
@vitest/browser-preview: catalog: => 5.0.0-beta.1
playwright: catalog: => 1.59.1
vite: catalog: => 8.0.10
vitest: catalog: => 5.0.0-beta.1
Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names renderer/renderer.test.ts as the failing entry point and references issue #9164; begin by reproducing browser mode in the monorepo and inspect the createTesters/WebSocket failure. Done means browser-mode tests no longer stall or report no tests, including the reported non-headless case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, playwright, typescript, vite
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100