2

We have an problem to run our Jasmine tests. If we run:

ng test --browsers=ChromeHeadless --code-coverage

the tests are working.

But if we run:

ng test --watch=false --browsers=ChromeHeadless --code-coverage

it does not work and we get this error:

$ npm run test:noWatch

> client@0.0.0 test:noWatch E:\Jenkins\home\workspace\MSF-Test\monatlicheschueler\client
> ng test --watch=false --browsers=ChromeHeadless --code-coverage

14 02 2019 15:28:47.979:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
14 02 2019 15:28:47.995:INFO [launcher]: Launching browser ChromeHeadless with unlimited concurrency
14 02 2019 15:28:48.027:INFO [launcher]: Starting browser ChromeHeadless
14 02 2019 15:29:09.146:INFO [HeadlessChrome 0.0.0 (Windows 8.1 0.0.0)]: Connected on socket 5cSIZU4-5deTyQyKAAAA with id 46249460
14 02 2019 15:29:39.153:WARN [HeadlessChrome 0.0.0 (Windows 8.1 0.0.0)]: Disconnected (1 times), because no message in 30000 ms.
HeadlessChrome 0.0.0 (Windows 8.1 0.0.0) ERROR
  Disconnected, because no message in 30000 ms.

HeadlessChrome 0.0.0 (Windows 8.1 0.0.0) ERROR
  Disconnected, because no message in 30000 ms.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.0.0 test:noWatch: `ng test --watch=false --browsers=ChromeHeadless --code-coverage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@0.0.0 test:noWatch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:  

We are using this versions:

Angular CLI: 7.3.1
Node: 10.14.1
OS: win32 x64
Angular: 7.1.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.12.4
@angular-devkit/build-angular     0.12.4
@angular-devkit/build-optimizer   0.12.4
@angular-devkit/build-webpack     0.12.4
@angular-devkit/core              7.2.4
@angular-devkit/schematics        7.3.1
@angular/cdk                      7.1.1
@angular/cli                      7.3.1
@angular/material                 7.3.2
@ngtools/webpack                  7.2.4
@schematics/angular               7.3.1
@schematics/update                0.13.1
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.28.4

This is what I can find in the log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test:noWatch' ]
2 info using npm@6.4.1
3 info using node@v10.14.1
4 verbose run-script [ 'pretest:noWatch', 'test:noWatch', 'posttest:noWatch' ]
5 info lifecycle client@0.0.0~pretest:noWatch: client@0.0.0
6 info lifecycle client@0.0.0~test:noWatch: client@0.0.0
7 verbose lifecycle client@0.0.0~test:noWatch: unsafe-perm in lifecycle true
8 verbose lifecycle client@0.0.0~test:noWatch: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\Jenkins\home\workspace\MSF-Test\monatlicheschueler\client\node_modules\.bin;C:\Users\admin2\bin;E:\Program Files\Git\mingw64\bin;E:\Program Files\Git\usr\local\bin;E:\Program Files\Git\usr\bin;E:\Program Files\Git\usr\bin;E:\Program Files\Git\mingw64\bin;E:\Program Files\Git\usr\bin;C:\Users\admin2\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;E:\Program Files\Git\cmd;C:\Program Files\nodejs;E:\Program Files\7-Zip;C:\Windows\System32;E:\Program Files\maven\apache-maven-3.5.4\bin;E:\Program Files\commons-daemon;E:\Program Files\Git\usr\bin;E:\Program Files\Git\usr\bin;E:\Program Files\Git\mingw64\bin;E:\Program Files\Java\jdk1.8.0_171\bin;C:\Users\admin2\AppData\Roaming\npm;E:\Program Files\Git\usr\bin\vendor_perl;E:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle client@0.0.0~test:noWatch: CWD: E:\Jenkins\home\workspace\MSF-Test\monatlicheschueler\client
10 silly lifecycle client@0.0.0~test:noWatch: Args: [ '/d /s /c',
10 silly lifecycle   'ng test --watch=false --browsers=ChromeHeadless --code-coverage' ]
11 silly lifecycle client@0.0.0~test:noWatch: Returned: code: 1  signal: null
12 info lifecycle client@0.0.0~test:noWatch: Failed to exec test:noWatch script
13 verbose stack Error: client@0.0.0 test:noWatch: `ng test --watch=false --browsers=ChromeHeadless --code-coverage`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid client@0.0.0
15 verbose cwd E:\Jenkins\home\workspace\MSF-Test\monatlicheschueler\client
16 verbose Windows_NT 6.3.9600
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test:noWatch"
18 verbose node v10.14.1
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error client@0.0.0 test:noWatch: `ng test --watch=false --browsers=ChromeHeadless --code-coverage`
22 error Exit status 1
23 error Failed at the client@0.0.0 test:noWatch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Does somebody know what could be the problem?

Ivan Demin
  • 101
  • 2
  • 9

2 Answers2

3

Test with --watch false without equal, there was an issue with that some time in version 6 , don't know if fixed

CREM
  • 1,929
  • 1
  • 25
  • 35
1

The problem was the timeout, I needed to add this to my karma.conf.js

captureTimeout: 210000,
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 210000,
browserNoActivityTimeout : 210000

Thank you for all the help. :)

Ivan Demin
  • 101
  • 2
  • 9