JavaScript unit tests with mocha, chai and sinon - workshop material
In order to begin tests we need these packages:
To spy, stub or mock we need:
In order to have test coverage reporting:
npm istall mocha --save-dev
npm install chai --save-dev
npm install sinon --save-dev
npm install istanbul --save-dev
npm install mocha-istanbul --save-dev
npm install
Code to be tested is in app folder
npm test
or
./node_modules/mocha/bin/mocha tests/*.js
./node_modules/.bin/istanbul cover node_modules/.bin/_mocha tests/*.js