I am trying to get code coverage of my node.js project . I am using mocha and istanbul for that purpose. But i am getting 0 passing Istanbul :No coverage information was collected, exit without writing coverage information Mocha and istanbul are installed locally. Script inside package.json looks like
"scripts": {
"test": "node_modules/.bin/mocha",
"test:coverage": "./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha"
}
Folder structure looks like -----Project ----node_modules ---test --unit -01test1.tes.js -02test2.test.js
My .istanbul.yml file
verbose: false
instrumentation:
root: ./node_modules/.bin/istanbul
default-excludes: true
excludes: []
embed-source: false
variable: __coverage__
compact: true
preserve-comments: false
complete-copy: false
save-baseline: false
baseline-file: ./coverage/coverage-baseline.json
reporting:
print: summary
reports:
- lcov
dir: ./coverage
watermarks:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
hooks:
hook-run-in-context: false
post-require-hook: null
I am running coomand
npm run test:coverage
in terminal(mac OSX). I am fairly new to this so any input is very much welcome. Please help me with it , i have already spent whole day over this.