Unit testing of Node.js code with Mocha and Istanbul

May 18, 2015

A quick overview of unit testing in Node.js.

Useful tips

Basic usage

./node_modules/.bin/_mocha --reporter spec

This command will help you run just a subset of tests in a given directory.

./node_modules/.bin/_mocha recursive test/my-subdir

Quick coverage check

./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha