node.js project coverage with codeship.io && coveralls.io
May 6, 2016
coveralls.io is great. however, the default instruction sets
are tailored to ruby and travis. i use neither.
for many of us, we want coveralls to work with codeship.io
the coveralls docs re-direct you to:
https://github.com/nickmerwin/node-coveralls, which helps us get the job done.
however, you may like just a simple clear step-by-step.
Here are the steps, short and sweet:
npm i --save-dev coveralls into your npm project
- make sure that your package's test scripts generate coverage documentation
- for example, i have the following npm scripts in my packages:
"description": "A SUPER GREAT MODULE",
"test": "nyc --reporter=lcov --check-coverage --functions=90 --branches=90 node test/"
- setup your project in coveralls.io
- log on, follow the add repo instructions (can't miss 'em)
- copy and paste the secret token--we need to enter this in your codeship
npm test # or your test command
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- open the environment settings, and set the following keys:
- assuming that you have linked your git project with codeship, simply commit
your changes to your package and push!
- don't forget to add a pretty little badge to your README! you can copy the
markdown syntax from with within your project settings on coveralls.
- please note that it may take a couple of minutes for your badge to render
You're all done!