July 2016
Here are the relevant parts of the package.json file with the "npm cover" working command, which is useful with the es6 module code (that is, including es6 import and export ), babel 6, istanbul-1.0-alpha.2
I am posting this because I had to spend several hours to happen on solving from someone else a github stream of problems (which now I cannot find). It seems that there are many βsolutionsβ that no longer solve the coverage problem or cannot easily be adapted to other devDependencies stacks. YMMV.
package.json scripts
"scripts": { "clean": "rm -rf ./build ./doc ; mkdir ./build", "build": "node_modules/.bin/babel build src/index.js -o build/index.js", "doc": "node_modules/.bin/esdoc -c esdoc.json", "lint": "node_modules/.bin/eslint src/index.js", "lint-test": "node_modules/.bin/eslint test/index.js", "test": "node_modules/.bin/mocha --compilers js:babel-core/register --reporter spec --slow 50 --timeout 60000", "cover": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -u exports --compilers js:babel-register --timeout 60000", "go": "npm run clean && npm run lint && npm run lint-test && npm run test && npm run build" },
package.json devDependencies
"devDependencies": { "babel": "^6.5.2", "babel-cli": "^6.10.1", "babel-core": "^6.10.4", "babel-preset-es2015": "^6.9.0", "coveralls": "^2.11.9", "esdoc": "^0.4.7", "eslint": "^3.0.1", "istanbul": "^1.0.0-alpha.2", "mocha": "^2.5.3", "should": "^8.3.1" },
.babelrc
{ "presets": ["es2015"] }
.travis.yml
language: node_js node_js: - 6 install: - npm install script: - npm run lint - npm run lint-test - npm run cover after_script: - "cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js"