ibrik icon indicating copy to clipboard operation
ibrik copied to clipboard

How can ibrik be used with mocha?

Open thom-nic opened this issue 11 years ago • 24 comments

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.

thom-nic avatar Dec 26 '13 22:12 thom-nic

:+1: same question here

evantill avatar Feb 05 '14 08:02 evantill

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

AdrienLemaire avatar Feb 16 '14 01:02 AdrienLemaire

Would like to know about this as well...

dashed avatar Apr 04 '14 14:04 dashed

+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

jescalan avatar Apr 23 '14 19:04 jescalan

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

johngeorgewright avatar Apr 28 '14 13:04 johngeorgewright

+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.

shaunc avatar May 27 '14 14:05 shaunc

Any update on this?

volkhin avatar Jun 22 '14 08:06 volkhin

+1

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

drabiter avatar Aug 17 '14 11:08 drabiter

+1

lavelle avatar Dec 03 '14 01:12 lavelle

+1

duereg avatar Dec 09 '14 19:12 duereg

This would be extremely useful.

rimunroe avatar Dec 11 '14 15:12 rimunroe

+1

justin-lau avatar Dec 13 '14 14:12 justin-lau

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.

duereg avatar Dec 13 '14 23:12 duereg

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.

rimunroe avatar Dec 16 '14 14:12 rimunroe

I'll investigate it at weekend.

Constellation avatar Dec 16 '14 17:12 Constellation

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

duereg avatar Dec 16 '14 23:12 duereg

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

justin-lau avatar Dec 17 '14 17:12 justin-lau

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

thom-nic avatar Dec 17 '14 20:12 thom-nic

@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.

duereg avatar Dec 17 '14 21:12 duereg

@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.

gilligan avatar Mar 18 '15 20:03 gilligan

@gilligan You figured this out, correct?

duereg avatar Mar 18 '15 23:03 duereg

@duereg yep thanks ;-)

gilligan avatar Mar 19 '15 09:03 gilligan

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.

jwalton avatar May 06 '15 02:05 jwalton

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/**

59naga avatar Jun 06 '15 13:06 59naga