Skip to content

Code coverage Cobertura reporter loses method's names #15769

@volago

Description

@volago

🐞 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [x ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

Cobertura reporter misses methohd's names in the code coverage report. Method's names are replaced by strings like this (anonymous_0)

🔬 Minimal Reproduction

Create new app


ng new cobertura-test
cd cobertura-test

Add Cobertura reporter in karma.conf.js


...
reports: ['html', 'lcovonly', 'text-summary', 'cobertura'],
...

Run tests


ng test --code-coverage`

Then in /coverage/cobertura-test/cobertura-coverage.xml report file we can see that method's names looks like that:

<method name="(anonymous_0)" hits="3" signature="()V">

All method's names are replaced by anonymous_<some number>.

Desired funcionality

Cobertura report includes method's names.

🌍 Your Environment


λ ng --version

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


Angular CLI: 8.3.8
Node: 10.15.1
OS: win32 x64
Angular: 8.2.9
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.8
@angular-devkit/build-angular     0.803.8
@angular-devkit/build-optimizer   0.803.8
@angular-devkit/build-webpack     0.803.8
@angular-devkit/core              8.3.8
@angular-devkit/schematics        8.3.8
@angular/cli                      8.3.8
@ngtools/webpack                  8.3.8
@schematics/angular               8.3.8
@schematics/update                0.803.8
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions