Skip to content

Code splitting change introduced in @angular/build@22.1.5 breaks vitest cobertura report #33938

Description

@dezsiszabi

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

@angular/build@22.1.4

Description

Please see the README in the reproduction repo: https://github.com/dezsiszabi/cobertura-bug-repro-2

I also opened this issue in the vitest repository because first I thought it's caused by vitest: vitest-dev/vitest#11069

In short:

The new @angular/build@22.1.5 or later produces a slightly different (invalid IMHO) cobertura coverage report XML which breaks the Jenkins CI plugin that tries to parse it.

The report shouldn't contain duplicate method names for the same class, but with @angular/build@22.1.5 and later, multiple entries like (anonymous_0) are generated.

Minimal Reproduction

Please see: https://github.com/dezsiszabi/cobertura-bug-repro-2

Exception or Error

cobertura report file contains method multiple entries with the same name.

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI       : 22.1.6
Angular           : 22.1.4
Node.js           : 24.19.0
Package Manager   : npm 11.17.0
Operating System  : linux x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 22.1.6            │ ^22.1.6           │
│ @angular/cli              │ 22.1.6            │ ^22.1.6           │
│ @angular/common           │ 22.1.4            │ ^22.1.4           │
│ @angular/compiler         │ 22.1.4            │ ^22.1.4           │
│ @angular/compiler-cli     │ 22.1.4            │ ^22.1.4           │
│ @angular/core             │ 22.1.4            │ ^22.1.4           │
│ @angular/forms            │ 22.1.4            │ ^22.1.4           │
│ @angular/platform-browser │ 22.1.4            │ ^22.1.4           │
│ @angular/router           │ 22.1.4            │ ^22.1.4           │
│ rxjs                      │ 7.8.2             │ ~7.8.0            │
│ typescript                │ 6.0.3             │ ~6.0.2            │
│ vitest                    │ 4.1.11            │ 4.1.11            │
│ zone.js                   │ 0.16.2            │ ~0.16.2           │
└───────────────────────────┴───────────────────┴───────────────────┘

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions