Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Since Angular v21, Vitest is the new default test runner. However, when generating code coverage reports using @vitest/coverage-v8, the output is empty, showing 0% coverage across all metrics.
Steps to Reproduce:
- Generate empty Angular project:
- Install
@vitest/coverage-v8 as a dev dependency:
npm install --save-dev @vitest/coverage-v8
- Run the test coverage command:
- Observe the terminal output:
% Coverage report from v8
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 0 | 0 | 0 | 0 |
----------|---------|----------|---------|---------|-------------------
- Check the generated report in the
coverage/ folder—it displays the same empty results.
The coverage report shows 0% for all files and metrics, regardless of actual test coverage.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No errors or warnings are displayed during the test run.
Please provide the environment you discovered this bug in (run ng version)
Angular CLI : 21.0.0
Angular : 21.0.0
Node.js : 24.11.1
Package Manager : npm 11.6.2
Operating System : win32 x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.0.0 │ ^21.0.0 │
│ @angular/cli │ 21.0.0 │ ^21.0.0 │
│ @angular/common │ 21.0.0 │ ^21.0.0 │
│ @angular/compiler │ 21.0.0 │ ^21.0.0 │
│ @angular/compiler-cli │ 21.0.0 │ ^21.0.0 │
│ @angular/core │ 21.0.0 │ ^21.0.0 │
│ @angular/forms │ 21.0.0 │ ^21.0.0 │
│ @angular/platform-browser │ 21.0.0 │ ^21.0.0 │
│ @angular/router │ 21.0.0 │ ^21.0.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.2 │
│ vitest │ 4.0.12 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else?
The coverage report should accurately reflect the test coverage of the project, similar to the previous setup with Karma/Jasmine/Istanbul in Angular v20.
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Since Angular v21, Vitest is the new default test runner. However, when generating code coverage reports using
@vitest/coverage-v8, the output is empty, showing 0% coverage across all metrics.Steps to Reproduce:
@vitest/coverage-v8as a dev dependency:ng test --coveragecoverage/folder—it displays the same empty results.The coverage report shows 0% for all files and metrics, regardless of actual test coverage.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
The coverage report should accurately reflect the test coverage of the project, similar to the previous setup with Karma/Jasmine/Istanbul in Angular v20.