Constellation / ibrik

CoffeeScript meets Istanbul - code coverage tool for CoffeeScript
BSD 2-Clause "Simplified" License
79 stars 32 forks source link

How can ibrik be used with mocha? #11

Open thom-nic opened 10 years ago

thom-nic commented 10 years ago

We have a suite of Mocha tests and I'm looking for a coverage tool to determine how thorough our tests are. Any idea how Mocha can integrate with ibrik? Thanks.

evantill commented 10 years ago

:+1: same question here

AdrienLemaire commented 10 years ago

Same problem here, trying to add coffeescript coverage to RTD using Mocha

dashed commented 10 years ago

Would like to know about this as well...

jescalan commented 10 years ago

+1, would be really excellent. I tried running ibrik cover _mocha and it did run the tests, but exited at the end without collecting any coverage information.

Would love to get a quick response here @Constellation

johngeorgewright commented 10 years ago

:+1: I'm also looking for an answer to this.

shaunc commented 10 years ago

+1 ... tried (modifying instructions for use of mocha w/ istanbul):

ibrik cover /usr/local/bin/_mocha -- --bail -u bdd --compilers coffee:coffee-script,litcoffee:coffee-script/register

... and I get:

No coverage information was collected, exit without writing coverage information.
volkhin commented 10 years ago

Any update on this?

drabiter commented 9 years ago

+1

The test run but no coverage collected. ibrik cover ./node_modules/mocha/bin/_mocha -- --compilers coffee:coffee-script/register --reporter spec --recursive test/

lavelle commented 9 years ago

+1

duereg commented 9 years ago

+1

rimunroe commented 9 years ago

This would be extremely useful.

justin-lau commented 9 years ago

+1

duereg commented 9 years ago

A little off topic, but I wrote this gulp plugin using the coffee instrumentor from this project to allow for coffee code coverage under mocha:

gulp-coffee-istanbul.

Doesn't solve this issue but at least gives a workaround.

rimunroe commented 9 years ago

Unfortunately, gulp-coffee-istanbul only works with code which is written for the CoffeeScriptRedux compiler, and not actual CoffeeScript. Sadly, CoffeeScriptRedux is largely abandoned and is lagging far behind CoffeeScript in feature support.

Constellation commented 9 years ago

I'll investigate it at weekend.

duereg commented 9 years ago

@rimunroe I just fixed this. gulp-coffee-istanbul now uses the coffee-script compiler, not redux.

justin-lau commented 9 years ago

I'm using @duereg's fork of istanbul instead of gulp-coffee-istanbul:

./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --compilers coffee:coffee-script/register test/*.coffee
thom-nic commented 9 years ago

@justin-lau @duereg is there an open PR to have those changes to istanbul merged upstream?

duereg commented 9 years ago

@thom-nic @justin-lau There is an open pull request on istanbul that I used as the basis for my fork. But it's been hanging around since March with no ETA on a merge.

gilligan commented 9 years ago

@justin-lau @duereg sorry for reviving this - i am trying to figure out how to get this istanbul fork to work since this still hasn't been merge upstream. When I try the command you listed @justin-lau I still get "No coverage information output was collected, exit without coverage information"

Can either of you perhaps help me out with this ? :) thanks.

duereg commented 9 years ago

@gilligan You figured this out, correct?

gilligan commented 9 years ago

@duereg yep thanks ;-)

jwalton commented 9 years ago

Just wanted to drop a note mentioning that coffee-coverage has support for Istanbul instrumentation now, and it was designed from the ground up with mocha in mind.

59naga commented 9 years ago

Got the answer of ibrik:

$ ibrik cover _mocha -- test/*.coffee

Demo: https://travis-ci.org/59naga/jasminetea/builds/65687751

Note: test/**" isn't calculated. Can use --default-excludes option if want include files at test/**