gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

cover command fails to do anything when run against a set of Lab tests #681

Open jcollum opened 8 years ago

jcollum commented 8 years ago

I've gotten Istanbul to generate coverage of Lab tests before. But it's very very inconsistent and I'm not getting any error messages. Here's the test run:

$ ./node_modules/.bin/lab -l -e development ./dist/test/unit.js

  ...........

11 tests complete
Test duration: 183 ms

OK, all set. But when I try to get Istanbul to generate coverage with this I find that it will work about 10% of the time, then I'll change some code and it will stop working. There are no error messages to work with; it just doesn't work.

$ ./node_modules/.bin/istanbul cover ./node_modules/.bin/lab -- -l -e development ./dist/test/unit.js 
  ...........

11 tests complete
Test duration: 275 ms

collumj ~/work/crdb/api (master) 12:12:58  
$ ll coverage

$

No coverage directory is created. But it has worked in the past, with the same command. This is aggravating. If there's something I'm doing wrong I sure don't see it.

Suggestions? If I run with -r lcov argument for Lab I get "No coverage information was collected, exit without writing coverage information" at the end of the file so it's hard to say if this is a Lab issue or an Istanbul issue.

I have noticed that the lcov reports that are being generated by Lab will sometimes have no FNDA or BRDA lines. That seems odd.

Trying to see if this is a Lab issue (https://github.com/hapijs/lab/issues/627) or an Istanbul issue. Anyone have experience with these two?

prabubio commented 8 years ago

I get this too. Do we know if this is caused by recent PRs: https://github.com/gotwarlost/istanbul/pull/680/files