Tests should run as expected and open the browser window.
➜ NeXgen-RulesEngine git:(master) npm run test
> [email protected] test /Users/brentoneill/Desktop/NeXgen-RulesEngine
> karma start karma.config.js --no-auto-watch
ts-loader: Using [email protected] and /Users/brentoneill/Desktop/NeXgen-RulesEngine/tsconfig.json
06 01 2017 11:10:47.012:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
06 01 2017 11:10:47.022:INFO [launcher]: Starting browser Chrome
06 01 2017 11:10:47.814:INFO [Chrome 55.0.2883 (Mac OS X 10.11.6)]: Connected on socket /#bQUigWQLHMsCwypEAAAA with id 33535306
Chrome 55.0.2883 (Mac OS X 10.11.6): Executed 0 of 0 ERROR (0.003 secs / 0 secs)
npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/brentoneill/.nvm/versions/node/v5.12.0/bin/node" "/Users/brentoneill/.nvm/versions/node/v5.12.0/bin/npm" "run" "test"
npm ERR! node v5.12.0
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: `karma start karma.config.js --no-auto-watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'karma start karma.config.js --no-auto-watch'.
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 form-rules package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! karma start karma.config.js --no-auto-watch
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs form-rules
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls form-rules
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/brentoneill/Desktop/NeXgen-RulesEngine/npm-debug.log```
...
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
client: {
captureConsole: false
},
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
plugins: [
'karma-jasmine',
'karma-chrome-launcher',
'karma-html-reporter',
require('karma-webpack')
],
reporters: ['progress', 'html'],
// the default configuration
htmlReporter: {
outputDir: 'karma_html', // where to put the reports
templatePath: null, // set if you moved jasmine_template.html
focusOnFailures: true, // reports show failures on start
namedFiles: false, // name files instead of creating sub-directories
pageTitle: null, // page title for reports; browser info by default
urlFriendlyName: false, // simply replaces spaces with _ for files/dirs
reportName: 'report-summary-filename', // report summary filename; browser info by default
// experimental
preserveDescribeNesting: false, // folded suites stay folded
foldAll: false, // reports start folded (only with preserveDescribeNesting)
},
npm run test0 info it worked if it ends with ok
1 verbose cli [ '/Users/brentoneill/.nvm/versions/node/v5.12.0/bin/node',
1 verbose cli '/Users/brentoneill/.nvm/versions/node/v5.12.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'test' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle [email protected]~pretest: [email protected]
6 silly lifecycle [email protected]~pretest: no script for pretest, continuing
7 info lifecycle [email protected]~test: [email protected]
8 verbose lifecycle [email protected]~test: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~test: PATH: /Users/brentoneill/.nvm/versions/node/v5.12.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/brentoneill/Desktop/NeXgen-RulesEngine/node_modules/.bin:/Users/brentoneill/.nvm/versions/node/v5.12.0/bin:/Users/brentoneill/.nvm/versions/node/v5.12.0/bin:/Users/brentoneill/.rvm/gems/ruby-2.1.0/bin:/Users/brentoneill/.rvm/gems/ruby-2.1.0@global/bin:/Users/brentoneill/.rvm/rubies/ruby-2.1.0/bin:/usr/local/heroku/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/brentoneill/apache-maven-3.3.9/bin:/Users/brentoneill/.rvm/bin
10 verbose lifecycle [email protected]~test: CWD: /Users/brentoneill/Desktop/NeXgen-RulesEngine
11 silly lifecycle [email protected]~test: Args: [ '-c', 'karma start karma.config.js --no-auto-watch' ]
12 silly lifecycle [email protected]~test: Returned: code: 1 signal: null
13 info lifecycle [email protected]~test: Failed to exec test script
14 verbose stack Error: [email protected] test: `karma start karma.config.js --no-auto-watch`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/Users/brentoneill/.nvm/versions/node/v5.12.0/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at EventEmitter.emit (events.js:185:7)
14 verbose stack at ChildProcess.<anonymous> (/Users/brentoneill/.nvm/versions/node/v5.12.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at ChildProcess.emit (events.js:185:7)
14 verbose stack at maybeClose (internal/child_process.js:850:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid [email protected]
16 verbose cwd /Users/brentoneill/Desktop/NeXgen-RulesEngine
17 error Darwin 15.6.0
18 error argv "/Users/brentoneill/.nvm/versions/node/v5.12.0/bin/node" "/Users/brentoneill/.nvm/versions/node/v5.12.0/bin/npm" "run" "test"
19 error node v5.12.0
20 error npm v3.8.6
21 error code ELIFECYCLE
22 error [email protected] test: `karma start karma.config.js --no-auto-watch`
22 error Exit status 1
23 error Failed at the [email protected] test script 'karma start karma.config.js --no-auto-watch'.
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 form-rules package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error karma start karma.config.js --no-auto-watch
23 error You can get information on how to open an issue for this project with:
23 error npm bugs form-rules
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls form-rules
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Can you slim this down into a minimal reproduction in a repository?
If it helps, I have seen this error happen when there is a syntax error in one of my scripts. I would check to see if TypeScript isn't erroring out and the stack trace isn't being outputted. It might help to try wiring in tslint and running that to see if there are not any errors coming in there.
Closing as it appears the issues is with the karma-chrome-launcher plugin - tests run fine on the FireFox launcher
Do you have a reference to an issue or any more information about the problem with karma-chrome-launcher by any chance? I'm getting this problem, too.
Hi Guys.
I don't know if it will solve your problem, but I came up with similar problem while running 'karma --single-run --browsers Chrome' from npm script. I would get an unclear npm error:
Chrome 61.0.3163 (Windows 10 0.0.0): Executed 0 of 0 ERROR (0.007 secs / 0 secs)
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\M.S.BIT\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "test"
npm ERR! node v6.9.4
npm ERR! npm v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: node ./node_modules/karma/bin/karma start --single-run --browsers Chrome
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'node ./node_modules/karma/bin/karma start --single-run --browsers Chrome'.
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 karma_angular2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./node_modules/karma/bin/karma start --single-run --browsers Chrome
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs karma_angular2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls karma_angular2
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\dev\angular2_karma\npm-debug.log
At the end the problem was that I didn't had any tests and the script would fail. I finally solved it by adding : failOnEmptyTestSuite: false to my karma.conf.js file, so it won't fail the script when there are no tests. Hope it will help in any way.
Thank you @ibaraness. I spend two days because of this issue. I am writing my tests in TypeScript and somehow, karma is not picking up tests written in TypeScript. Now, at least I know the error. I can go further.
Seems like we could have the error message reflect the flag, eg failOnEmptyTestSuite
Chrome 61.0.3163 (Windows 10 0.0.0): Executed 0 of 0 && failOnEmptyTestSuite == true: ERROR (0.007 secs / 0 secs)
@mistyharsh Make sure you include the mime:
mime: {
'text/x-typescript': ['ts']
},
Steps for me to improve the error occurrence: I upgrade karma to v3x and added a custom launcher in karma.config with the flags below from an example online:
flags: [
'--headless',
'--disable-gpu',
// Without a remote debugging port, Google Chrome exits immediately.
'--remote-debugging-port=9222'
]
Thanks @ibaraness!
I spent one entire day looking for a fix for this error, and finally found that I only had to add to my karma.conf.js:
failOnEmptyTestSuite: false
Most helpful comment
Hi Guys.
I don't know if it will solve your problem, but I came up with similar problem while running 'karma --single-run --browsers Chrome' from npm script. I would get an unclear npm error:
Chrome 61.0.3163 (Windows 10 0.0.0): Executed 0 of 0 ERROR (0.007 secs / 0 secs)
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\M.S.BIT\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "test"
npm ERR! node v6.9.4
npm ERR! npm v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test:
node ./node_modules/karma/bin/karma start --single-run --browsers Chromenpm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'node ./node_modules/karma/bin/karma start --single-run --browsers Chrome'.
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 karma_angular2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./node_modules/karma/bin/karma start --single-run --browsers Chrome
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs karma_angular2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls karma_angular2
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\dev\angular2_karma\npm-debug.log
At the end the problem was that I didn't had any tests and the script would fail. I finally solved it by adding : failOnEmptyTestSuite: false to my karma.conf.js file, so it won't fail the script when there are no tests. Hope it will help in any way.