Skip to content

emitWarnings coverage threshold breaks architect build #14621

Closed
@StephenFluin

Description

@StephenFluin

🐞 Bug report

Command (mark with an x)

- [x] test

Is this a regression?

Yes

Description

Adding emitWarning to istanbul reporter breaks the build

🔬 Minimal Reproduction

ng new my-app (works)
add a threshold to `karma.conf.js: (works)

thresholds: {
        statements: 80
      }

set emitWarning to false

thresholds: {
        emitWarning: false,
        statements: 80
      }

ng test --code-coverage // fails

🔥 Exception or Error


31 05 2019 14:57:30.903:ERROR [karma-server]: TypeError: Cannot read property 'pct' of undefined
    at /usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/karma-coverage-istanbul-reporter/src/reporter.js:10:35
    at Array.forEach ()
    at checkThresholds (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/karma-coverage-istanbul-reporter/src/reporter.js:9:27)
    at createReport (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/karma-coverage-istanbul-reporter/src/reporter.js:157:31)
    at /usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/karma-coverage-istanbul-reporter/src/reporter.js:220:9
    at Array.forEach ()
    at BrowserCollection.forEach (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/karma/lib/browser_collection.js:84:26)
    at CoverageIstanbulReporter.onRunComplete (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/karma-coverage-istanbul-reporter/src/reporter.js:219:16)
    at Server. (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/karma/lib/events.js:40:26)
    at Server.emit (events.js:201:15)
    at Timeout._onTimeout (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/karma/lib/executor.js:53:22)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)
Cannot read property 'success' of undefined
TypeError: Cannot read property 'success' of undefined
    at TestCommand.runSingleTarget (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/@angular/cli/models/architect-command.js:199:27)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
    at TestCommand.runArchitectTarget (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/@angular/cli/models/architect-command.js:211:31)
    at TestCommand.validateAndRun (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/@angular/cli/models/command.js:137:28)
    at Object.runCommand (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/@angular/cli/models/command-runner.js:178:24)
    at default_1 (/usr/local/google/home/stephenfluin/workspace/test/coverage/node_modules/@angular/cli/lib/cli/index.js:32:31)

🌍 Your Environment


Angular CLI: 8.0.1
Node: 12.2.0
OS: linux x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.1
@angular-devkit/build-angular     0.800.1
@angular-devkit/build-optimizer   0.800.1
@angular-devkit/build-webpack     0.800.1
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1
@angular/cli                      8.0.1
@ngtools/webpack                  8.0.1
@schematics/angular               8.0.1
@schematics/update                0.800.1
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?
Trying to test coverage failures failing ng test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions