I spent a long time trying to resolve this already, but can't find a decent solution. I started based on https://github.com/babel/babel/blob/master/packages/babel/src/api/register/node.js with process.env.running_under_istanbul and got it executing but got stuck with no coverage information coming out.
Istanbul 1.0 alpha.
So I'm trying the alpha as you suggested, but I still get no info coming out. Here's the command:
./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --compilers ts:ts-node/register client/test.ts
Test passes fine, but it prints:
No coverage information was collected, exit without writing coverage information at the bottom.
Am I missing something? I'm on istanbul 1.0 alpha 2.
Thanks,
Silvio
Think I solved it! For the curious, you need an .istanbul.yml file. Mine is currently:
instrumentation:
extensions:
- .tsx
- .ts
And it seemed to work.
I still can't make it work with [email protected] and jasmine: sourcemaps are broken for the jasmine reporters and something crash after the test executions :(
Without istanbul the tests run fin with jasmine.
I found this comment very helpful. Basically use nyc command to run instanbul instead of the istanbul command and it works.
@jonaskello that's what I end up using, nyc works fine with ts-node without any pain.
Most helpful comment
Think I solved it! For the curious, you need an
.istanbul.ymlfile. Mine is currently:And it seemed to work.