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

[1.1.0-alpha.1] sourceMap issues with Travis #661

Open ghost opened 8 years ago

ghost commented 8 years ago
No coverage information was collected, exit without writing coverage information
(function (exports, require, module, __filename, __dirname) { {"version":3,"file":"xxx.js","sourceRoot":"","sources":["../../src/__test__/xxx.ts"],"names":[],"mappings":"AAAA,QAAQ,CAAC,OAAO,EAAE;IAEd,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAE3B,EAAE,CAAC,cAAc,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC1B,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}

SyntaxError: Unexpected token :
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:513:28)
    at Module.replacementCompile (/home/travis/build/xxx/xxx/node_modules/append-transform/index.js:63:13)
    at Module._extensions..js (module.js:550:10)
    at Object.<anonymous> (/home/travis/build/xxxx/xxx/node_modules/append-transform/index.js:67:4)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Function.Module.runMain (module.js:575:10)
    at runFn (/home/travis/build/xxx/xxx/node_modules/istanbul/lib/command/cover.js:126:16)

No idea how to track this issue. It works fine on the command line, and in all other CI e.g. Circle CI. In Travis this fails.

This maybe happen because I'm keeping the tests inside the source folder.

E.g.

src/__tests__

and not in a separate test folder? It works just fine if I keep the tests in a separate test folder. I also set the --root to point to the build folder where also the tests are located after transpiling from TypeScript.

-x **/__test__/** is also used.