The following command works ok on the command line:
./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- spec
However, when I try to run it as a script, the process exists with Exit status 1.
"scripts": {
"cover": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- spec"
},
I get the reports and coverage stats and everything. But it's just annoying that if run as a script, the process ends in error.
Some info from the debug report:
17 error Linux 4.4.4-301.fc23.x86_64
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "covert"
19 error node v5.6.0
20 error npm v3.6.0
21 error code ELIFECYCLE
here is the declaration i use myself:
"scripts": {
"cover": "istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec"
},
Note the 2 changes:
I'm afraid that's not working for me:
strange...
I've updated some dependencies in a simple project.
https://github.com/asa-git/forked-worker-pool
if you clone it and run the following commands you will see the coverage built and available in the ./build/test/coverage/lcov-report folder.
npm install
npm test
There some specific configuration in that project to handle the coverage of forked node instances, but regardless of that, coverage is working fine on my environment (windows).
I hope that helps
Yes, I can see your package works even though I'm not on windows. So it must be something with my config. Thank you
Had the same problem. Any manipulations with package.json config doesn't solve the problem. I receive coverage summary and after that
Darwin 15.0.0
argv "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "run-script" "coverage"
node v5.9.1
npm v3.7.3
code ELIFECYCLE
[email protected] coverage: `istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec`
Exit status 11
Failed at the [email protected] coverage script 'istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec'.
Make sure you have the latest version of node.js and npm installed.
Are you have any thoughts?
+1
@olegdizus was your message for me ?
If you have a simple project available on github I could clone it and check it out if you want ?
@asa-git message was for anyone =)
I don't have this repository on github, but I will try to prepare similar here.
@asa-git Istanbul works great. This error does not affect on anything.
I have the same problem, but not throwing errors, instead, only testing several files instead of every file.
If I executed in command line there is no problem.It's very strange. I guess there must be some differences between command line and npm script. I googled it but can't find my answer. Maybe auth, or different environment, or whatever, but must something different. Is there anyone having some ideas?
And have you solved your problem ? @cortopy
@zhaotai Yes, I have. Unfortunately, I can't remember exactly how but it was definitely the config file
This command should works:
npm run cover
Most helpful comment
This command should works:
npm run cover