Skip to content

Instantly share code, notes, and snippets.

@tvardy
Last active March 18, 2017 21:52
Show Gist options
  • Save tvardy/87d3958f74767cd796ed3c96785a0553 to your computer and use it in GitHub Desktop.
Save tvardy/87d3958f74767cd796ed3c96785a0553 to your computer and use it in GitHub Desktop.
POC: istanbul (nyc) + mocha + watch

POC: using Istanbul's nyc CLI with mocha and watch ability (using nodemon)

Also works great with live-server for observing html reports

"scripts": {
  "watch:test:coverage": "concurrently \"live-server ./coverage\" \"nodemon -x npm run test:coverage\""
},
"devDependencies": {
  ...
  "concurrently": "3.4.0",
  "live-server": "1.2.0"
}
-r babel-register
-r ./.mocha.global.js
--recursive
./src/**/*.spec.js
{
"require": [
"babel-register"
],
"exclude": [
"**/*.spec.js"
],
"reporter": [
"html",
"text-summary"
]
}
{
"execMap": {
"js": "babel-node"
}
}
{
"scripts": {
"test": "mocha --opts ./.mocha.opts",
"test:coverage": "nyc npm run test:silent",
"test:silent": "npm test -- -R mocha-silent-reporter",
"watch:test": "npm test -- -w",
"watch:test:coverage": "nodemon -x npm run test:coverage"
},
"devDependencies": {
"babel-cli": "6.23.0",
"babel-preset-latest": "6.22.0",
"babel-preset-stage-3": "6.22.0",
"babel-register": "6.23.0",
"mocha": "3.2.0",
"mocha-silent-reporter": "1.0.0",
"nodemon": "1.11.0",
"nyc": "10.1.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment