jeffrifwald/babel-istanbul

drop-in replacement for istanbul?

nelsonic opened this issue · 3 comments

@jmcriffey which test frameworks have you tried with babel-istanbul ?

we use tape but when attempting to run our tests using babel-istanbul we get the following error: SyntaxError: Unexpected reserved word

We are running the bable-istanbul command using a relative path as we prefer not install node modules globally, thus our test command is:

./node_modules/.bin/babel-istanbul cover ./node_modules/tape/bin/tape ./test/index.js

Please see: https://travis-ci.org/dwyl/ampl/builds/103671132#L278

I've mostly used mocha, but your testing framework should not affect the coverage unless you are spawning new processes to run tests.

The module babel-istanbul simply compiles files for instrumentation, so you decide how you are going to compile your tests for running. Have you successfully run those same tests without coverage? How are you compiling those test files?

I have always run my tests with babel-node instead of node like so:

./node_modules/.bin/babel-node ./node_modules/.bin/babel-istanbul cover test_command_here

@jmcriffey trying that now. (thanks for speedy reply!)

@jmcriffey appears to be working... https://travis-ci.org/dwyl/ampl/builds/103683244#L297
thanks again for getting back to us!
anyone else using substack's tape for their tests, the command we used is:

./node_modules/.bin/babel-node ./node_modules/.bin/babel-istanbul cover ./node_modules/tape/bin/tape ./test/

And if you are using _mocha_:

./node_modules/.bin/babel-node ./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec