Node Coveralls

1 min read testing, nodejs

Written in 2015. Tools, APIs and prices may have changed since.

Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/node-coveralls-playground.

Coverage Status

node-coveralls-playground

To learn and experiment with coveralls test coverage service.

Setup Steps

  1. Install deps

    $ npm install mocha coveralls mocha-lcov-reporter --save-dev
    
  2. Install istanbul

    $ npm install istanbul --save-dev -g
    
  3. If running from command line, ensure .coveralls.yml is in current directory. It should contain a line with repo_token: REPO_TOKEN

Running

To run on the tests in the test/ directory.

$ istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

You can view the raw coverage output in the ./coverage directory.

Keep learning

Get new guides and courses by email

An occasional email when I publish a new guide, course or post. No spam, and you can unsubscribe any time.

Sent with Buttondown. I never share your address. Prefer a feed? Use the RSS feed.