Skip to content

Angular 6 Unit Test Coverage - reporting not accurate #26020

Description

@ChrisBadalucco

I'm submitting a...


[x] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

Unit test coverage reporting is no longer accurate (shows missed branches outside of logic e.g. in imports)

Expected behavior

Unit test coverage accurately reports coverage.

Minimal reproduction of the problem with instructions

  1. Create a new angular 6 project: ng new angular6-coverage-issue
  2. Execute tests with code coverage ng test --code-coverage
  3. View HTML report
    screen shot 2018-09-19 at 11 47 14 am

screen shot 2018-09-19 at 11 13 31 am

What is the motivation / use case for changing the behavior?

The motivation is to fix coverage reports so they can be used as an accurate measure.

Environment



For Tooling issues:
- Node version: 8.11.3
- Platform:  Mac

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


Angular CLI: 6.2.2
Node: 8.11.3
OS: darwin x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.8.2
@angular-devkit/schematics        0.8.2
@angular/cli                      6.2.2
@ngtools/webpack                  6.1.5
@schematics/angular               0.8.2
@schematics/update                0.8.2
rxjs                              6.3.2
typescript                        2.7.2
webpack                           4.9.2

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