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

windows issues #649

Open ghost opened 8 years ago

ghost commented 8 years ago

@gotwarlost Normal usage on Windows always throws this exceptions:

basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^
SyntaxError: missing ) after argument list
    at Object.exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:513:28)
    at Object.Module._extensions..js (module.js:550:10)
    at Object.Module._extensions.(anonymous function) [as .js] (C:\xxx\node_modules\istanbul\lib\hook.js:109:37)
    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)

NPM Script

 istanbul cover --report json node_modules/.bin/_mocha -- -u exports -R spec test/index.js",
Kingwl commented 8 years ago

the same question

ghost commented 8 years ago

I'm using this command on Mac and Windows and it's working. Hope this helps.

./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha

ghost commented 8 years ago

Give this a read, https://github.com/gotwarlost/istanbul/issues/677

It was my similar question that the answer fixed my problem.

kalote commented 7 years ago

I have similar issues using

babel-node ./node_modules/.bin/babel-istanbul cover ./node_modules/mocha/bin/_mocha --require ./node_modules/dotenv/config -- --timeout 10000 --recursive app/tests

I tried with ./node_modules/.bin/babel-node but no luck.

Any help will be appreciated.

ghost commented 7 years ago

I use this, works great.

./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --require --compilers js:babel-core/register./node_modules/dotenv/config -- --timeout 10000 --recursive app/tests
ghost commented 7 years ago

@kalote add a space after --compilers js:babel-core/register

Aussie15 commented 5 years ago

I'm still getting the same issue please assist istanbul cover --report ./node_modules/.bin/_mocha -R spec