-
Notifications
You must be signed in to change notification settings - Fork 787
No coverage information was collected, exit without writing coverage information #262
Comments
same question. this error message does not help me figure out what to do. |
I've been digging around into istanbul for the last hour or so because I've been having the same issue. It works for all of my repos except for one new project. I'm not positive, but I believe it might be because istanbul uses the The issue that I am having is different. At the top of my tests, I require 3 modules: var expect = require('expect.js');
var metalsmith = require('metalsmith');
var globMeta = require('../');
Although my issue only relates to yours by Error Message only, it would still be good to make this issue known to the maintainer. |
watch out for forking. I resolved this problem by discovering that something was forking a child process to run node code and that's why it didn't get covered. |
If anyway wants to know how to use Istanbul with forked tests, you can look at the "mysql" module, which runs every test in it's own fork, but correctly collects coverage anyway. |
If anyone is using mocha, use the "underscored" {
"scripts": {
"test": "mocha",
"test-cov": "istanbul cover _mocha"
}
} |
I had the same message, but quite a different problem. I’m transpiling ES6 code to ES5 with babel. I want to run the tests in an ES5 environment, so I compile them into a directory called It turns out that while Hope this helps someone :) |
I'm getting the same message running Jasmine tests from the command line (not the Jasmine-Node package, but just plain old Jasmine, running under iojs). I have
EDIT: I feel stupid for not realizing this before I wrote, but this code works perfectly:
|
@danascheider Running You should add |
Thank you, I found that out. |
@zaim - thanks, the underscore worked for me! |
Using babel-register getting: No coverage information was collected, exit without writing coverage information |
I am currently doing Why do I have to use |
@carlitux were you able to get |
@nelsonic no, I wasn't. |
@carlitux sad times... 😢 |
@nelsonic thanks babel-istanbul is working for me... I hope both projects can merged soon |
I'm getting the same |
@cameronjroe I am using in this way. ./node_modules/.bin/babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha --report text --check-coverage -- --timeout 5000 -u tdd --recursive app/tests frontend/javascript/tests |
Yeah, I actually found that out too. Thanks @carlitux |
For some reason it's not running on travis-ci. Have you had this issue? |
@cameronjroe please add a link to the build on |
Thanks. I update |
@creeperyang this use babel-node? what is the command to use istanbul instead of istanbul-babel... |
@carlitux I just use command is like: "test-cov": "node_modules/.bin/babel-node node_modules/.bin/istanbul cover --dir test/coverage test/run.js" And my repo: https://github.com/creeperyang/ysprite |
👍 for |
@zaim That works for me! Thx~ 👍 |
works very well. |
After lots of trying it worked for me after upgrading istanbul to v1, in particular 1.1.0-alpha.1 package.json
test/mocha.conf
If you are already using babel-core you can use babel-core/register as compiler instead of babel-register. |
This one hasn't worked for me:
This one did:
Using "istanbul": "1.0.0-alpha.2". It seems there's something wrong with /.bin/_mocha script. Unfortunately, it's cryptic for me, so I could be wrong. But I'll leave it here:
|
Note that if you're using babel, this will happen if you use
|
The workaround from @yordis worked for me on Istanbul 0.4.5. Thanks! I have Istanbul installed globally with |
The coverage report is generated when I rename the directory with my test files from |
For anyone who is using ES6
|
Moving my scripts inside "src" folder solved it for me. |
Format working for me with Node 8.1.4: # In terminal:
./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha -- \
./bin/test.js -r babel-register -r babel-polyfill --slow 2000 -b -t 20000 // When used in my CLI dev tool:
require('child_process').fork('./node_modules/.bin/babel-istanbul', [
'cover', './node_modules/.bin/_mocha', '--dir', `./coverage/${server}`,
'--', './bin/test.js', '-r', 'babel-register', '-r', 'babel-polyfill',
'--slow', '2000', '-b', `-t 20000`,
], {
execPath: './node_modules/.bin/babel-node',
}); |
nice istanbul@1.1.0-alpha.1! |
@zaim thanks Sir |
25 passing (3s)
No coverage information was collected, exit without writing coverage information
|
I use the full path of This is the repo in question I copied the |
Fixed my case with the following
|
doesn't work on windows. running
I know istanbul doesn't parse |
@20avva install the
Hope that helps. |
Thanks. I’ll give it shot.
Respectfully,
Pranav Avva
… On Sep 6, 2018, at 02:09, mfc3370 ***@***.***> wrote:
@20avva install the nyc module, then use it with mocha, to get the coverage.
These are how the files look on my npm scripts:
"test": "mocha $(find test -name '*.spec.js')",
"coverage-with-coverage": "nyc mocha $(find test -name '*.spec.js')",
Hope that helps.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
"cover": "istanbul cover _mocha test/mocha.js" |
1.git clone https://github.com/lizhexia/ramlev.git
2.cd ramlev and npm install
3. istanbul cover npm test
error :No coverage information was collected, exit without writing coverage information
what can i do for this question ,why can't work ?
The text was updated successfully, but these errors were encountered: