-
Notifications
You must be signed in to change notification settings - Fork 787
No coverage information was collected, exit without writing coverage information #496
Comments
Likewise, though there appears to be a package on NPM that handles this it would be useful to understand the situation within Istanbul first |
👍 I've just started using mocha and decided to give istanbul a try for our coverage. I'm having this exact issue, but after trying every possible solution I've read, I'm still getting "No coverage information was collected, exit without writing coverage information". Glad I'm not the only one. Have this in my package.json:
Our
Not using an This the same setup you guys are running (roughly)? |
Is there a simple project on github on which I can run some experiments? If not could you create one? Thanks. |
I'll whip one up quickly. :) |
Awesome. I'll give it a go on our project when I have a chance. :) |
Just tested it on our project. Works perfectly, thanks. :) |
@gotwarlost This fix works in my case as well, but I need to run Sonar against the resulting lcov file. Using the fix you made in JakeSidSmith/istanbul-no-coverage#1 the file paths in the lcov file are no longer absolute and therefore cannot be analyzed by Sonar. I'm seeing some mixed things depending on Node version. Keep in mind I'm also using ES2015 and babel-register in my project. From package.json in Node 0.12.2
Fails because no compiler is supplied to Mocha:
From package.json in Node 5.2.0
Generates lcov file with absolute file paths which can be analyzed by Sonar:
|
FWIW I am seeing issues even in the sample-babel-node project - seems to be flattening the paths of the source in the coverage output. Not sure if that is related to this issue or what. I opened istanbuljs/sample-babel-node#1 |
I just encountered this issue "No coverage information was collected..." The specific thing that was breaking it for me was To clarify -- with babel-register present as require/compiler option, no coverage information will be collected, even if wrapping the script in babel-node. The only way to get it working and have coverage is to not include babel-register and to wrap the istanbul cover call with babel-node. For what it's worth, not being dependent on babel-node and getting the babel-register working would be great for build tools... I'm having a heck of a time getting this to work under |
@tswaters follow this tutorial https://onsen.io/blog/mocha-chaijs-unit-test-coverage-es6/ |
I ended up not using Still, right now the 1.x branch of istanbul does not work with compiler option - right now it is not able to collect any coverage information. (At least with babel-register, I haven't tried any others.) |
I pushed a fix for the relative paths problem that seems similar to #512 - could you please check if the situation has improved now? |
@gotwarlost I'd run into an issue with coverage being collected for files with similar names e.g. |
@gotwarlost, your fix in JakeSidSmith/istanbul-no-coverage#1 uses |
@g-patel - correct. I'm working on making it stable; needs additional tests and interface stability of the source maps module. It is pretty usable as is - the See also: https://github.com/istanbuljs/sample-mocha-compilers for a different way of doing things when mocha and babel are involved |
@gotwarlost got it. Thanks for reply. One more thing. That famous ES6 coverage article mentions about using |
For anyone this might help this works for us And in our .istanbul.yml file: instrumentation:
root: src
extensions:
- .jsx
- .js |
with a structure like that:
and instrumentation:
root: src
extensions:
- .es6 using the following packages with nodejs 5.5.0: "devDependencies": {
"babel-cli": "^6.5.1",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"istanbul": "^1.0.0-alpha",
"mocha": "^2.4.5"
}, i finally ended up with this working command ./node_modules/.bin/babel-node ./node_modules/istanbul/lib/cli.js cover ./node_modules/.bin/_mocha -- 'test/**/*.es6' --require test/lib/bootstrap @ALL thanks for the useful information out of this issue. |
See gotwarlost/istanbul#496 for more info
using "istanbul": "^1.0.0-alpha" worked for me. |
still fails for me with the error:
using:
with istanbul ^1.0.0-alpha, also tried babel-istanbul |
Istanbul Here's my config (for travis):
|
@gotwarlost Is the version 1.x moving out of alpha soon? The latest release for v1.x I see it the |
It is now working with |
Nice one @niftylettuce. I don't think you need all the |
Following worked for me with es6, react, mocha, enzyme and babel. It tests and generate reports.
ignore-import.js
.bablerc
.istanbul.yml
|
@tswaters Your comment worked for me. Thanks! |
@tswaters gold, thanks man that worked like a charm. |
I can't get any coverage output regardless if I do
--report lcov
--report html
or leave it blank.This seems to be a bug with latest versions... it used to work fine.
I'm using ES6/mocha and having mocha call
babel-core/register
.I've tried every combination of
babel-node
,./node_modules/.bin/xyz
etc - still no coverage - I've tried lots of options, even--hook-run-in-context
which I have no idea what it does, because there's not much documentation for it, or any features. Even the readme of this repo doesn't even talk about available options to pass to--report
.The text was updated successfully, but these errors were encountered: