No coverage information was collected, exit without writing coverage information.


If all your tests are under test directory then add the following in your package.json. It will run the unit tests using mocha and generates information under coverage folder.

// package.json

"scripts": {
    "coverage": "istanbul cover ./node_modules/.bin/_mocha -- ./test/**/*"
}


Run one of the following command depending on which version of npm, yarn you use one of them will execute the script.

 - npm run-script coverage

 - npm run coverage

 - yarn run coverage

You may also like...

  • http://nitinsurana.com Nitin Surana

    Thanks, worked perfect. I was using `mocha` instead of `_mocha`.