项目作者: lfpimenta

项目描述 :
JavaScript unit tests with mocha, chai and sinon - workshop material
高级语言: JavaScript
项目地址: git://github.com/lfpimenta/Js-unit-tests.git
创建时间: 2017-01-28T11:03:32Z
项目社区:https://github.com/lfpimenta/Js-unit-tests

开源协议:

下载


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)

  1. npm istall mocha --save-dev
  2. npm install chai --save-dev
  3. npm install sinon --save-dev
  4. npm install istanbul --save-dev
  5. npm install mocha-istanbul --save-dev

Setup (when package.json is properly set)

  1. npm install

Source code

Code to be tested is in app folder

How to run tests

  1. npm test

or

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

Run tests with Coverage

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