Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Coverage summary shows 0% when running tests with Vitest (environment: jsdom) and V8 coverage provider on version 21.0.0-rc.4. Works correctly with browser environments (e.g., playwright). This problem occurs only on Windows. I haven't encountered this issue in CI pipelines using the official nodejs docker image, nor on other Linux-based operating systems.
Expected behavior: coverage should work with jsdom without requiring a browser.
Minimal Reproduction
Steps to reproduce (see attached minimal reproduction):
- Create project:
npx @angular/cli@21.0.0-rc.4 new coverage-v8-jsdom
- Add coverage provider:
npm i -D @vitest/coverage-v8
- Update angular.json test options:
"options": {
"coverage": true
}
-
Run tests: npm run test
The coverage summary will show 0 for all statements, branches, etc.
-
Add browser support: npm i -D @vitest/browser-playwright
-
Update test options in angular.json:
"options": {
"browsers": ["ChromiumHeadless"],
...
}
- Run tests again:
npm run test
The coverage summary will correctly show the coverage.
Note: The attached minimal reproduction should work after npm install and npm run test. If you remove the browsers option from angular.json, coverage will again be incorrect.
coverage-v8-jsdom.zip
Exception or Error
Your Environment
Angular CLI : 21.0.0-rc.4
Angular : 21.0.0-rc.2
Node.js : 22.16.0
Package Manager : npm 10.9.2
Operating System : win32 x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.0.0-rc.4 │ ^21.0.0-rc.4 │
│ @angular/cli │ 21.0.0-rc.4 │ ^21.0.0-rc.4 │
│ @angular/common │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/compiler │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/compiler-cli │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/core │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/forms │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/platform-browser │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ @angular/router │ 21.0.0-rc.2 │ ^21.0.0-next.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.2 │
│ vitest │ 4.0.9 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Coverage summary shows 0% when running tests with Vitest (environment: jsdom) and V8 coverage provider on version 21.0.0-rc.4. Works correctly with browser environments (e.g., playwright). This problem occurs only on Windows. I haven't encountered this issue in CI pipelines using the official nodejs docker image, nor on other Linux-based operating systems.
Expected behavior: coverage should work with jsdom without requiring a browser.
Minimal Reproduction
Steps to reproduce (see attached minimal reproduction):
npx @angular/cli@21.0.0-rc.4 new coverage-v8-jsdomnpm i -D @vitest/coverage-v8Run tests:
npm run testThe coverage summary will show 0 for all statements, branches, etc.
Add browser support:
npm i -D @vitest/browser-playwrightUpdate test options in angular.json:
npm run testThe coverage summary will correctly show the coverage.
Note: The attached minimal reproduction should work after
npm installandnpm run test. If you remove the browsers option from angular.json, coverage will again be incorrect.coverage-v8-jsdom.zip
Exception or Error
Your Environment
Anything else relevant?
No response