angular-cli: Bug: Angular CLI test running module build/chrome concurrently

Bug Report or Feature Request (mark with an x)

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

Versions.

“dependencies”: { “@angular/animations”: “4.3.1”, “@angular/common”: “4.3.1”, “@angular/compiler”: “4.3.1”, “@angular/core”: “4.3.1”, “@angular/forms”: “4.3.1”, “@angular/http”: “4.3.1”, “@angular/platform-browser”: “4.3.1”, “@angular/platform-browser-dynamic”: “4.3.1”, “@angular/router”: “4.3.1”, “core-js”: “2.4.1”, “rxjs”: “5.1.0”, “zone.js”: “0.8.5” }, “devDependencies”: { “@angular/cli”: “1.3.1”, “@angular/compiler-cli”: “4.3.1”, “@types/jasmine”: “2.5.38”, “@types/node”: “6.0.60”, “codelyzer”: “2.0.0”, “jasmine-core”: “2.5.2”, “jasmine-spec-reporter”: “3.2.0”, “json-server”: “0.9.6”, “karma”: “1.4.1”, “karma-chrome-launcher”: “2.0.0”, “karma-cli”: “1.0.1”, “karma-coverage-istanbul-reporter”: “0.2.0”, “karma-jasmine”: “1.1.0”, “karma-jasmine-html-reporter”: “0.2.2”, “karma-junit-reporter”: “1.2.0”, “karma-remap-istanbul”: “0.6.0”, “protractor”: “5.1.0”, “ts-node”: “2.0.0”, “tslint”: “4.5.0”, “typescript”: “2.2.0” }

node: 6.10.1 os: linux x64 (Bash on Ubuntu)

Repro steps.

I’m trying to run tests with following: “ng test -cc --single-run=true”

In v.1.0.0, when doing ng test, the tests will do the following in serial order:

  1. Build modules
  2. Start chrome
  3. Start the test suite

In v.1.3.1, the tests starts Chrome at the same time it starts to build the modules, it tries to build modules and start Chrome concurrently. The result of this is that Chrome is waiting too long, resulting in a “Chrome have not captured in 60000 ms, killing.”-error.

The log given by the failure.

ng test -cc --single-run=true

0% compiling 10% building modules 0/1 modules 1 active …

… module building…

active                                     71% sealing 72% optimizing 73% basic module optimization       74% module optimization 75% advanced module optimization     76% basic chunk optimization 76% basic chunk optimization pass 2 76% basic chunk optimization pass 3              77% chunk optimization 78% advanced chunk optimization 79% module and chunk tree optimization         80% chunk modules optimization 81% advanced chunk modules optimization                     82% module reviving 83% module order optimization    84% module id optimization         85% chunk reviving 86% chunk order optimization    87% chunk id optimization               88% hashing 89% module assets processing  90% chunk assets processing 91% additional chunk assets processing                          92% recording 91% additional asset processing    92% chunk asset optimization       94% asset optimization11 09 2017 13:23:46.394:WARN [launcher]: Chrome have not captured in 60000 ms, killing.            95% emitting             11 09 2017 13:23:50.802:INFO [launcher]: Trying to start Chrome again (1/2). 11 09 2017 13:23:58.517:INFO [Chromium 59.0.3071 (Ubuntu 0.0.0)]: Connected on socket lEAXE18XTbsYhWwIAAAA with id 21814804 11 09 2017 13:24:09.216:WARN [Chromium 59.0.3071 (Ubuntu 0.0.0)]: Disconnected (1 times), because no message in 10000 ms. Chromium 59.0.3071 (Ubuntu 0.0.0) ERROR Disconnected, because no message in 10000 ms. Chromium 59.0.3071 (Ubuntu 0.0.0) ERROR Disconnected, because no message in 10000 ms.

Chromium 59.0.3071 (Ubuntu 0.0.0) ERROR Disconnected, because no message in 10000 ms. Chromium 59.0.3071 (Ubuntu 0.0.0) ERROR Disconnected, because no message in 10000 ms.

11 09 2017 13:24:11.505:WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.

npm ERR! Linux 4.4.0-62-generic npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run-script” “test-coverage” npm ERR! node v6.10.1 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR!  : ng test -cc --single-run=true npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the  test-coverage script ‘ng test -cc --single-run=true’. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the ngflash-webgui package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! ng test -cc --single-run=true npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs ngflash-webgui npm ERR! Or if that isn’t available, you can get their info via: npm ERR! npm owner ls ngflash-webgui npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR!  /npm-debug.log :ngTestCoverage FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:ngTestCoverage’.

Process ‘command ‘npm’’ finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6 mins 36.346 secs

Desired functionality.

Finishing running module build before executing Chrome in order to avoid time out.

Mention any other details that might be useful.

Older working package dependencies with previous version 1.0.0:

“dependencies”: { “@angular/animations”: “4.0.0”, “@angular/common”: “4.0.0”, “@angular/compiler”: “4.0.0”, “@angular/core”: “4.0.0”, “@angular/forms”: “4.0.0”, “@angular/http”: “4.0.0”, “@angular/platform-browser”: “4.0.0”, “@angular/platform-browser-dynamic”: “4.0.0”, “@angular/router”: “4.0.0”, “core-js”: “2.4.1”, “rxjs”: “5.1.0”, “zone.js”: “0.8.5” }, “devDependencies”: { “@angular/cli”: “1.0.0”, “@angular/compiler-cli”: “4.0.0”, “@types/jasmine”: “2.5.38”, “@types/node”: “6.0.60”, “codelyzer”: “2.0.0”, “jasmine-core”: “2.5.2”, “jasmine-spec-reporter”: “3.2.0”, “json-server”: “0.9.6”, “karma”: “1.4.1”, “karma-chrome-launcher”: “2.0.0”, “karma-cli”: “1.0.1”, “karma-coverage-istanbul-reporter”: “0.2.0”, “karma-jasmine”: “1.1.0”, “karma-jasmine-html-reporter”: “0.2.2”, “karma-junit-reporter”: “1.2.0”, “karma-remap-istanbul”: “0.6.0”, “protractor”: “5.1.0”, “ts-node”: “2.0.0”, “tslint”: “4.5.0”, “typescript”: “2.2.0” }

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 17 (1 by maintainers)

Most upvoted comments

@hansl You can view this behaviour from a new project created using the CLI. Running ng test will start both the webpack process and the browser at the same time.

INFO [launcher]: Starting browser Chrome
 25% building modules 133/144 modules 11 active ...s/modules/core.get-iterator-method.js

If you’re application if large enough then you will run into the following

WARN [launcher]: Chrome have not captured in 60000 ms, killing.
WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.

As a workaround you can add more retries to the karma.conf.js to be able to eventually run the browser after webpack finishes. (by default karma will retry 3 times, and has a captureTimeout of 60 seconds)

module.exports = function (config) {
    config.set({
        /* the rest of it */
        retryLimit: 5
    });
};

Ideally the broswer shouldn’t be launched until after wepack finishes

I was experiencing the same issue and then I found the solution here: https://github.com/ionic-team/ionic-unit-testing-example/issues/79

Basically it is downgrading to “jasmine”: “2.99”

Here are my jasmine/karma related dependencies:

"jasmine-core": "2.99",
"jasmine-spec-reporter": "4.2.1",
"karma": "2.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.2.1",
"karma-jasmine": "1.1.0",