angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng test --code-coverage produces corrupted coverage reports

Open corcorb opened this issue 8 years ago • 3 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

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

Versions

$ node --version
v10.3.0
$ npm --version
6.4.1
$ ng --version
...
Angular CLI: 6.2.3
Node: 10.3.0
OS: darwin x64
Angular: 6.1.8
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.3
@angular-devkit/build-angular     0.8.3
@angular-devkit/build-optimizer   0.8.3
@angular-devkit/build-webpack     0.8.3
@angular-devkit/core              0.8.3
@angular-devkit/schematics        0.8.3
@angular/cli                      6.2.3
@ngtools/webpack                  6.2.3
@schematics/angular               0.8.3
@schematics/update                0.8.3
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.19.1

macOS High Sierra (10.13.6)

Repro steps

Create a brand new project, run tests with code coverage:

ng new stock-ng-project
cd stock-ng-project
ng test --watch=false --code-coverage

Open the generated istanbul report:

open coverage/src/app/app.component.ts.html

The log given by the failure

No explicit error.

The report is malformed, including:

  • highlights that don't correspond to tokens
  • Random characters (I, E)
  • Gutter markers that don't correspond to lines with code

Desired functionality

It should be like the version from @angular-devkit/build-angular 0.6.8:

npm install --only=dev @angular-devkit/[email protected]
ng test --watch=false --code-coverage
open coverage/src/app/app.component.ts.html

The report is correctly formatted.

Mention any other details that might be useful

I've tracked this to being introduced by the upgrade of @angular-devkit/build-angular from 0.6.8 to 0.7.0, but that added/updated a lot of webpack and source-map-loader dependencies, and I'm not sure what the root cause is.

corcorb avatar Sep 21 '18 18:09 corcorb

Related to https://github.com/angular/angular-cli/issues/11672

jhage-accesso avatar Sep 21 '18 19:09 jhage-accesso

Yeah, it's the same issue and should be fixed by https://github.com/angular/angular-cli/pull/12291

Next time I'll make sure to search closed issues as well as open before filing…

corcorb avatar Sep 21 '18 20:09 corcorb

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.