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 785 forks source link

"No coverage information was collected, exit without writing coverage information", issue with mocha and istanbul. #877

Open Malfix25 opened 6 years ago

Malfix25 commented 6 years ago

This error message gets logged to my terminal when I try to run the command "istanbul cover _mocha" both Mocha and Istanbul are installed globally to my computer, does anyone know how to fix this issue? I have a Windows 10 operating system, but this exact issue also occurs on a windows 7 computer. this is the exact error message. "No coverage information was collected, exit without writing coverage information C:\Users\Malfix\AppData\Roaming\npm_mocha.CMD:1 (function (exports, require, module, filename, dirname) { @IF EXIST "%~dp0\node.exe" ( ^

SyntaxError: Invalid or unexpected token at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:616:28) at Module.replacementCompile (C:\Users\Malfix\AppData\Roaming\npm\node_modules\istanbul\node_modules\append-transform\index.js:58:13) at Module._extensions..js (module.js:663:10) at Object. (C:\Users\Malfix\AppData\Roaming\npm\node_modules\istanbul\node_modules\append-transform\index.js:62:4) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js:693:10)"