Open frankpiva opened 8 years ago
thanks @RockyRoad29 , works for me
welcome @twotwo .
But according to this project's deprecation notice you might want to switch to https://istanbul.js.org/ .
The package.json
for a new project might look like:
{
"name": "some-node-proj",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "nyc mocha"
},
"keywords": [],
"author": "your name",
"license": "AGPL-3.0+",
"devDependencies": {
"mocha": "^4.1.0",
"nyc": "^11.4.1"
},
"nyc": {
"reporter": [
"lcov",
"text-summary"
]
}
}
Then you run tests and coverage at once with the proper environment, from any subdirectory, with the shell command:
$ npm test
I've been looking at Istanbul for the better part of two days now, and I have not been able to use it on my Mocha unit tests. Despite the many different argument(s)/option(s) combinations I have tried I always get the error "ReferenceError: describe is not defined". I have both Istanbul and Mocha installed globally. I have also tried to manually import describe and it, so that Istanbul wouldn't barf of them, but that did not work either. I'm running out of options and will use another tool if I can't get it to work by the end of today.