Skip to content

ng test --code-coverage produces corrupted coverage reports #12343

Closed

Description

@corcorb

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/build-angular@0.6.8
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.

Activity

  1. jhage-accesso commented on Sep 21, 2018

    @jhage-accesso

    Related to #11672

  2. corcorb commented on Sep 21, 2018

    @corcorb
    Author

    Yeah, it's the same issue and should be fixed by #12291

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

  3. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    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.

  4. locked and limited conversation to collaborators on Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions