karma-runner / karma

Spectacular Test Runner for JavaScript
http://karma-runner.github.io
MIT License
11.94k stars 1.71k forks source link

TeamCity failed karma start #2826

Open ybarbaria opened 7 years ago

ybarbaria commented 7 years ago

TeamCity failed during runing karma unit tests.

The log catched in the overview of teamcity

[15:31:38]Step 2/4: Unit test (Node.js NPM) (5m)
[15:31:38][Step 2/4] Executing npm via wrapping shell script
[15:31:38][Step 2/4] Starting: cmd /c npm run test-tc
[15:31:38][Step 2/4] in directory: C:\TeamCity\buildAgent\work\5f0ec385fa69463e
[15:31:38][Step 2/4] npm run test-tc (4m:49s)
[15:31:40][npm run test-tc] 
[15:31:40][npm run test-tc] > ezweb@1.0.0 test-tc C:\TeamCity\buildAgent\work\5f0ec385fa69463e
[15:31:40][npm run test-tc] > karma start config/karma.tc-conf.js --colors false
[15:31:40][npm run test-tc] 
[15:31:52][Step 2/4] JavaScript Unit Tests (4m:21s)
[15:33:31][npm run test-tc] 06 09 2017 15:33:29.390:INFO [karma]: Karma v1.5.0 server started at http://0.0.0.0:9876/
[15:33:36][npm run test-tc] 06 09 2017 15:33:29.718:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
[15:33:36][npm run test-tc] 06 09 2017 15:33:30.094:INFO [launcher]: Starting browser PhantomJS
[15:33:56][npm run test-tc] 06 09 2017 15:33:56.735:INFO [PhantomJS 2.1.1 (Windows 7 0.0.0)]: Connected on socket mJqjPAbWCgMaZngGAAAA with id 66573197
[15:35:50][npm run test-tc] 06 09 2017 15:35:50.574:WARN [web-server]: 404: /config.json
[15:36:14][npm run test-tc] 06 09 2017 15:36:14.187:WARN [PhantomJS 2.1.1 (Windows 7 0.0.0)]: Disconnected (1 times)
[15:36:14][npm run test-tc] PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR
[15:36:14][npm run test-tc]   Disconnectedundefined
[15:36:14][npm run test-tc] 
[15:36:14][npm run test-tc] PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR
[15:36:14][npm run test-tc]   Disconnectedundefined
[15:36:14][npm run test-tc] PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR
[15:36:14][npm run test-tc]   Disconnectedundefined
[15:36:14][npm run test-tc] 
[15:36:17][npm run test-tc] 06 09 2017 15:36:17.034:WARN [launcher]: PhantomJS was not killed in 2000 ms, sending SIGKILL.
[15:36:21][npm run test-tc] 
[15:36:21][npm run test-tc] npm ERR! Windows_NT 6.1.7601
[15:36:21][npm run test-tc] npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test-tc"
[15:36:21][npm run test-tc] npm ERR! node v6.9.1
[15:36:21][npm run test-tc] npm ERR! npm  v3.10.8
[15:36:21][npm run test-tc] npm ERR! code ELIFECYCLE
[15:36:21][npm run test-tc] npm ERR! ezweb@1.0.0 test-tc: `karma start config/karma.tc-conf.js --colors false`
[15:36:21][npm run test-tc] npm ERR! Exit status 1
[15:36:21][npm run test-tc] npm ERR! 
[15:36:21][npm run test-tc] npm ERR! Failed at the ezweb@1.0.0 test-tc script 'karma start config/karma.tc-conf.js --colors false'.
[15:36:21][npm run test-tc] npm ERR! Make sure you have the latest version of node.js and npm installed.
[15:36:21][npm run test-tc] npm ERR! If you do, this is most likely a problem with the ezweb package,
[15:36:21][npm run test-tc] npm ERR! not with npm itself.
[15:36:21][npm run test-tc] npm ERR! Tell the author that this fails on your system:
[15:36:27][npm run test-tc] npm ERR!     karma start config/karma.tc-conf.js --colors false
[15:36:27][npm run test-tc] npm ERR! You can get information on how to open an issue for this project with:
[15:36:27][npm run test-tc] npm ERR!     npm bugs ezweb
[15:36:27][npm run test-tc] npm ERR! Or if that isn't available, you can get their info via:
[15:36:27][npm run test-tc] npm ERR!     npm owner ls ezweb
[15:36:27][npm run test-tc] npm ERR! There is likely additional logging output above.
[15:36:27][npm run test-tc] 
[15:36:27][npm run test-tc] npm ERR! Please include the following file with any support request:
[15:36:27][npm run test-tc] npm ERR!     C:\TeamCity\buildAgent\work\5f0ec385fa69463e\npm-debug.log
[15:36:28][Step 2/4] Process exited with code 1
[15:36:37][Step 2/4] Process exited with code 1
[15:36:38][Step 2/4] Step Unit test (Node.js NPM) failed 

And the npm-debug-log from the buildAgent folder :

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-tc' ]
2 info using npm@3.10.8
3 info using node@v6.9.1
4 verbose run-script [ 'pretest-tc', 'test-tc', 'posttest-tc' ]
5 info lifecycle ezweb@1.0.0~pretest-tc: ezweb@1.0.0
6 silly lifecycle ezweb@1.0.0~pretest-tc: no script for pretest-tc, continuing
7 info lifecycle ezweb@1.0.0~test-tc: ezweb@1.0.0
8 verbose lifecycle ezweb@1.0.0~test-tc: unsafe-perm in lifecycle true
9 verbose lifecycle ezweb@1.0.0~test-tc: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\TeamCity\buildAgent\work\5f0ec385fa69463e\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\
10 verbose lifecycle ezweb@1.0.0~test-tc: CWD: C:\TeamCity\buildAgent\work\5f0ec385fa69463e
11 silly lifecycle ezweb@1.0.0~test-tc: Args: [ '/d /s /c',
11 silly lifecycle   'karma start config/karma.tc-conf.js --colors false' ]
12 silly lifecycle ezweb@1.0.0~test-tc: Returned: code: 1  signal: null
13 info lifecycle ezweb@1.0.0~test-tc: Failed to exec test-tc script
14 verbose stack Error: ezweb@1.0.0 test-tc: `karma start config/karma.tc-conf.js --colors false`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid ezweb@1.0.0
16 verbose cwd C:\TeamCity\buildAgent\work\5f0ec385fa69463e
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test-tc"
19 error node v6.9.1
20 error npm  v3.10.8
21 error code ELIFECYCLE
22 error ezweb@1.0.0 test-tc: `karma start config/karma.tc-conf.js --colors false`
22 error Exit status 1
23 error Failed at the ezweb@1.0.0 test-tc script 'karma start config/karma.tc-conf.js --colors false'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the ezweb package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     karma start config/karma.tc-conf.js --colors false
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs ezweb
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls ezweb
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Versions Windows_NT 6.1.7601 node v6.9.1 v3.10.8 "karma": "1.5.0" "karma-phantomjs-launcher": "1.0.4" "karma-teamcity-reporter": "1.0.1" "karma-webpack": "2.0.2"

If someone have an idea about this bug ?

EzraBrooks commented 6 years ago

Could the 404 on config.json be causing unexpected behavior?

Zefling commented 6 years ago

For me, without test :

$ npm run test

> my-app@1.2.2-0-SNAPSHOT.0 test C:\my-app
> karma start

START:

Finished in 0.001 secs / 0 secs @ 13:25:32 GMT+0100 (Paris, Madrid)

SUMMARY:
√ 0 tests completed

=============================== Coverage summary ===============================
Statements   : 100% ( 0/0 )
Branches     : 100% ( 0/0 )
Functions    : 100% ( 0/0 )
Lines        : 100% ( 0/0 )
================================================================================
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@2018.2.2-0-SNAPSHOT.0 test: `karma start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@2018.2.2-0-SNAPSHOT.0 test 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:
npm ERR!     C:\my-app\node_cache\_logs\2018-02-21T12_25_33_090Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\CVeyssiere\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test' ]
2 info using npm@5.3.0
3 info using node@v8.5.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle my-app@1.2.2-0-SNAPSHOT.0~pretest: my-app@1.2.2-0-SNAPSHOT.0
6 info lifecycle my-app@1.2.2-0-SNAPSHOT.0~test: my-app@1.2.2-0-SNAPSHOT.0
7 verbose lifecycle my-app@1.2.2-0-SNAPSHOT.0~test: unsafe-perm in lifecycle true
8 verbose lifecycle my-app@1.2.2-0-SNAPSHOT.0~test: PATH: C:\Users\CVeyssiere\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\my-app\node_modules\.bin;C:\Users\CVeyssiere\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\CVeyssiere\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files (x86)\Groovy\Groovy-1.7.5\bin;C:\Program Files\SlikSvn\bin;C:\ProgramData\graphviz-2.38\bin;C:\Program Files (x86)\Meld;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files (x86)\ShoreTel\Connect;C:\Program Files (x86)\ShoreTel\Connect\win64;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\apache-maven-3.3.9\bin;C:\Program Files\SlikSvn\bin;C:\Program Files (x86)\Meld;C:\Program Files (x86)\Midnight Commander;C:\Users\CVeyssiere\AppData\Local\Microsoft\WindowsApps;C:\Users\CVeyssiere\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle my-app@1.2.2-0-SNAPSHOT.0~test: CWD: C:\my-app
10 silly lifecycle my-app@1.2.2-0-SNAPSHOT.0~test: Args: [ '/d /s /c', 'karma start' ]
11 silly lifecycle my-app@1.2.2-0-SNAPSHOT.0~test: Returned: code: 1  signal: null
12 info lifecycle my-app@1.2.2-0-SNAPSHOT.0~test: Failed to exec test script
13 verbose stack Error: my-app@1.2.2-0-SNAPSHOT.0 test: `karma start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\CVeyssiere\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:289:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\CVeyssiere\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid my-app@1.2.2-0-SNAPSHOT.0
15 verbose cwd C:\my-app
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\CVeyssiere\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
18 verbose node v8.5.0
19 verbose npm  v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error my-app@1.2.2-0-SNAPSHOT.0 test: `karma start`
22 error Exit status 1
23 error Failed at the my-app@1.2.2-0-SNAPSHOT.0 test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

With 1 test:

$ npm run test

> my-app@1.2.2-0-SNAPSHOT.0 test C:\my-app
> karma start

START:

[at-loader] Using typescript@2.7.1 from typescript and "tsconfig.json" from C:\my-app/tsconfig.json.

[at-loader] Checking started in a separate process...

[at-loader] Ok, 2.348 sec.

[at-loader] Checking started in a separate process...

[at-loader] Ok, 0.008 sec.
  App
    √ TBC

Finished in 0.498 secs / 0.115 secs @ 14:06:01 GMT+0100 (Paris, Madrid)

SUMMARY:
√ 1 test completed

=============================== Coverage summary ===============================
Statements   : 32.55% ( 2424/7448 )
Branches     : 6.62% ( 97/1466 )
Functions    : 19.66% ( 292/1485 )
Lines        : 30.1% ( 2071/6881 )
================================================================================

Probably without test, it works badly

iamrakesh commented 6 years ago

We too struggle with similar issue, a slightly different usecase though. I think its not the 404 causing it. In our case, we use gradle (with parallel threads to improve build performance) and start karma runner from gradle; we too have same error. Our environment -

we see below cryptic error 12 info lifecycle <my app>@<version>~test:logger: Failed to exec test:logger script 13 verbose stack Error: <my app>@<version> test:logger: ng test logger --code-coverage 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (<node installatio path>\nodejs\node-v10.4.1-win-x64\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16) 13 verbose stack at EventEmitter.emit (events.js:182:13) 13 verbose stack at ChildProcess.<anonymous> (<node installatio path>\nodejs\node-v10.4.1-win-x64\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:961:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)

iamrakesh commented 6 years ago

Suggestion mentioned at https://github.com/karma-runner/karma-chrome-launcher/issues/154 worked for us.