Skip to content

Code coverage report of vitest unit test includes node_modules #31668

@wein2011

Description

@wein2011

Command

test

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

21.0.0-next.8

Description

After upgrading to 21.0.0-rc.0, I noticed that the code coverage report now includes the files in the node_modules folder. These folders should not be included. This was also not the case in 21.0.0-next.8.

Adding "**/node_modules/**/*.*" to the coverageExclude array did not resolve the issue.

Minimal Reproduction

Set

"coverage": true,
"coverageReporters": [
              "html",
              "text-summary"
]

Run unit test and review coverage reports.

Exception or Error


Your Environment

Angular CLI       : 21.0.0-rc.0
Angular           : 21.0.0-rc.0
Node.js           : 22.18.0
Package Manager   : npm 10.9.3
Operating System  : win32 x64

┌────────────────────────────────────┬───────────────────┬───────────────────┐
│ Package                            │ Installed Version │ Requested Version │
├────────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations                │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/build                     │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/cdk                       │ 21.0.0-next.10    │ ^21.0.0-next.10   │
│ @angular/cli                       │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/common                    │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/compiler                  │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/compiler-cli              │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/core                      │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/forms                     │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/language-service          │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/material                  │ 21.0.0-next.10    │ ^21.0.0-next.10   │
│ @angular/material-date-fns-adapter │ 21.0.0-next.10    │ ^21.0.0-next.10   │
│ @angular/platform-browser          │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/platform-browser-dynamic  │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ @angular/router                    │ 21.0.0-rc.0       │ ^21.0.0-next.10   │
│ rxjs                               │ 7.8.2             │ ^7.8.2            │
│ typescript                         │ 5.9.3             │ ~5.9.2            │
└────────────────────────────────────┴───────────────────┴───────────────────┘

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions