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

Mocha + TypeScript + Istanbul = No coverage information was collected, exit without writing coverage information #611

Open thitemple opened 8 years ago

thitemple commented 8 years ago

I'm trying to get code coverage on my TypeScript code. The tests are written using mocha I'm compiling the code to a directory using

tsc --outDir test

For those not used to TypeScript this is the same as doing this with babel:

babel src --out-dir lib

The the code is compiled and source map files are generated.

After that, I try to run istanbul with the command:

node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha test/**/*.spec.js

All the tests are passing, but the result is always:

No coverage information was collected, exit without writing coverage information

Is there something special I should do after compiling the TS code? Thanks.

PS: I tried versions 0.4.2 and 1.0.0-alpha.2

xogeny commented 8 years ago

Same question... :cry:

xogeny commented 8 years ago

I eventually got this working. You can see my salvage repository to see what I had to do. Specifically, look in package.json for the cover script definition.

awwong1 commented 7 years ago

Hello! Has any progress been made on this since the issue opened on May 2nd 2016?

iconnor commented 7 years ago

I also have the same issue here in a learning/play app we are working on https://github.com/jacepatel/typescript-express-api maybe having an easy example will help narrow down the issue?