Skip to content

JavaScript unit tests with mocha, chai and sinon - workshop material

Notifications You must be signed in to change notification settings

lfpimenta/Js-unit-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Js-unit-tests

Necessary Packages

In order to begin tests we need these packages:

  • mocha
  • chai

To spy, stub or mock we need:

  • sinon

In order to have test coverage reporting:

  • istanbul

Setup (if package.json is not set)

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

Setup (when package.json is properly set)

npm install

Source code

Code to be tested is in app folder

How to run tests

npm test

or

./node_modules/mocha/bin/mocha tests/*.js

Run tests with Coverage

./node_modules/.bin/istanbul cover node_modules/.bin/_mocha tests/*.js

About

JavaScript unit tests with mocha, chai and sinon - workshop material

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •