Describe the bug
I would like to report some weird observation and maybe some1 can look on that: vitest browser mode hangs when coverage-v8 or istanbul is installed, even when coverage is disabled.
I generated my workspace with the vp cli and it created some pnpm overrides, but Im unsure how that effects additional packages of the vitest eco system. vite-plus@0.1.20 has "@vitest/coverage-v8": 4.1.5 as an optional peer, so i guess its fine installing it. I also tried to understand this reexporting here https://github.com/voidzero-dev/vite-plus/blob/main/packages/test/BUNDLING.md. Idk if the issue is related to that or if its a vitest issue - I did not find anything in their repo. Maybe this issue vitest-dev/vitest#10252 but its not using browser mode.
packages:
- e2e/*
- packages/*
- tools/*
catalog:
"@types/lodash-es": 4.17.12
"@types/node": 25.6.0
'@vitest/coverage-istanbul': 4.1.5
"@vitest/coverage-v8": 4.1.5
lodash-es: 4.18.1
playwright: 1.59.1
typedoc: 0.28.19
typedoc-plugin-markdown: 4.11.0
typescript: 5.9.3
vite: npm:@voidzero-dev/vite-plus-core@0.1.20
vite-plus: 0.1.20
vitest: npm:@voidzero-dev/vite-plus-test@0.1.20
why-is-node-running: 3.2.2
catalogMode: strict
cleanupUnusedCatalogs: true
engineStrict: true
overrides:
typedoc: "catalog:"
typescript: "catalog:"
vite: "catalog:"
vitest: "catalog:"
peerDependencyRules:
allowAny:
- vite
- vitest
allowedVersions:
vite: "*"
vitest: "*"
saveExact: true
Summary
In browser mode, Vitest fails before test collection with:
[vitest] Browser connection was closed while running tests. Was the page closed unexpectedly?
[birpc] rpc is closed, cannot call "createTesters"
The run ends with no tests executed.
Repro commands
# Browser mode, no coverage
vp test run src/index.spec.ts --coverage.enabled false --reporter=verbose
# Browser mode, headed
vp test run src/index.spec.ts --coverage.enabled false --browser.headless false --reporter=verbose
# Browser mode, no isolation
vp test run src/index.spec.ts --coverage.enabled false --isolate=false --reporter=verbose
Actual Behavior
All browser-mode commands above fail with:
Error: Failed to run the test .../e2e/web-lib/src/index.spec.ts
Caused by: Error: [vitest] Browser connection was closed while running tests. Was the page closed unexpectedly?
Caused by: Error: [birpc] rpc is closed, cannot call "createTesters"
Vitest summary shows:
Tests no tests
Errors 1 error
Expected Behavior
Browser mode should connect, collect tests, and execute them.
Additional Findings
-
Disabling coverage does not fix it
--coverage.enabled false still reproduces the same browser/RPC error.
-
*Coverage package installation
- Installing or not installing
@vitest/coverage-istanbul and @vitest/coverage-v8 does have an effect - the error even happens with coverage disabled, the packages must not be installed actually so that tests run.
-
Not a stale-port artifact
- Killing stale listeners before rerun still reproduces the same error.
-
--isolate=false does not fix it
- Same browser connection/RPC-close error still occurs.
-
Non-browser mode does not hit this failure path
- Node/non-browser test runs in the workspace complete normally.
- This appears specific to browser mode.
Diagnostics run
DEBUG=pw:browser,pw:api and DEBUG=vite:*,pw:api,pw:browser were used.
- Logs show browser launch/context/page creation and Vitest test page navigation succeed.
- Failure occurs before test collection starts (0 tests collected).
Environment (sanitized)
- OS: macOS
- Node.js: 24.x
- Vitest runtime via bundled package from vite-plus toolchain
- Browser provider: Playwright (Chromium)
Reproduction
x
Steps to reproduce
No response
System Info
Used Package Manager
pnpm
Logs
Validations
Describe the bug
I would like to report some weird observation and maybe some1 can look on that: vitest browser mode hangs when coverage-v8 or istanbul is installed, even when coverage is disabled.
I generated my workspace with the vp cli and it created some pnpm overrides, but Im unsure how that effects additional packages of the vitest eco system. vite-plus@0.1.20 has "@vitest/coverage-v8": 4.1.5 as an optional peer, so i guess its fine installing it. I also tried to understand this reexporting here https://github.com/voidzero-dev/vite-plus/blob/main/packages/test/BUNDLING.md. Idk if the issue is related to that or if its a vitest issue - I did not find anything in their repo. Maybe this issue vitest-dev/vitest#10252 but its not using browser mode.
Summary
In browser mode, Vitest fails before test collection with:
[vitest] Browser connection was closed while running tests. Was the page closed unexpectedly?[birpc] rpc is closed, cannot call "createTesters"The run ends with no tests executed.
Repro commands
Actual Behavior
All browser-mode commands above fail with:
Vitest summary shows:
Tests no testsErrors 1 errorExpected Behavior
Browser mode should connect, collect tests, and execute them.
Additional Findings
Disabling coverage does not fix it
--coverage.enabled falsestill reproduces the same browser/RPC error.*Coverage package installation
@vitest/coverage-istanbuland@vitest/coverage-v8does have an effect - the error even happens with coverage disabled, the packages must not be installed actually so that tests run.Not a stale-port artifact
--isolate=falsedoes not fix itNon-browser mode does not hit this failure path
Diagnostics run
DEBUG=pw:browser,pw:apiandDEBUG=vite:*,pw:api,pw:browserwere used.Environment (sanitized)
Reproduction
x
Steps to reproduce
No response
System Info
Used Package Manager
pnpm
Logs
Validations