VSTS Test Coverage with Mocha, Istanbul, NYC, Coburtura and Junit

package.json

"scripts": {
  "test":
    "nyc -r cobertura -r html mocha **/*test*.js -R mocha-junit-reporter"
},
"devDependencies": {
  "mocha": "^2.5.3", 
  "mocha-junit-reporter": "^1.13.0", 
  "nyc": "^10.3.2", 
}

Test Results

For test results, we use Mocha with JUnit. That outputs a test-results.xml file that VSTS needs.

Test Coverage

For test coverage, we use Istanbul/NYC with Coburtura and with HTML. That outputs both the /coverage/cobertura-coverage.xml summary file and the coverage/index.htm file that VSTS needs.

Some References

https://www.npmjs.com/package/mocha-junit-reporter

https://github.com/istanbuljs-archived-repos/istanbul-reports/tree/master/lib