jeffrifwald / babel-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
144 stars 23 forks source link

SystemJS support #66

Closed nweldev closed 8 years ago

nweldev commented 8 years ago

I'm trying to have coverage report on the Sedona-Solutions/sdn-angularjs-seed project (see Sedona-Solutions/sdn-angularjs-seed#5).

For now, the babel-istanbul seems to be the better solution, but due to the lake of SystemJS support, when I run :

babel-node ./node_modules/babel-istanbul/lib/cli.js cover --include-all-sources ./node_m odules/jasmine/bin/jasmine.js test/unit/*.js

I have the following error :

No coverage information was collected, exit without writing coverage information
module.js:327
    throw err;
    ^

Error: Cannot find module 'angular'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (app.component.js:1:1)
    at Module._compile (module.js:409:26)
    at loader (C:\Users\nmace\dev\architecture\sdn-angularjs-seed\node_modules\babel-cli\node_modules\babel-register\lib\node.js:158:5)
    at Object.require.extensions.(anonymous function) [as .js] (C:\Users\nmace\dev\architecture\sdn-angularjs-seed\node_modules\babel-cli\node_modules\babel-register\lib\node.js:168:7)
    at Object.Module._extensions.(anonymous function) [as .js] (C:\Users\nmace\dev\architecture\sdn-angularjs-seed\node_modules\babel-istanbul\lib\hook.js:109:37)
    at Module.load (module.js:343:32)

The origin is at the first line of the app.component.js test.

Do you think we could correct this on babel-istanbul ?

jeffrifwald commented 8 years ago

That might actually be out of the scope of this tool. It looks like there has been some movement on the SystemJS side of this though:

https://github.com/gotwarlost/istanbul/issues/498 https://github.com/systemjs/systemjs/issues/992 https://github.com/guybedford/jspm-test-demo

nweldev commented 8 years ago

Thanks for the answer. I already saw this issues, but not the demo project. I will take a look at it. There seems to be a lot of efforts (and needs) on this question, but I can't find any good solution for now ... hence this request.

Anyway, thanks a lot for your work, that's by far the best solution I could found for now (minus the lake of SystemJS support of course ;) )