Working with Mocha.js, Chai.js, and Sinon.js

  • 2h 9m
  • Skillsoft
  • 2014

This book explains how mocha.js, chai.js, and sinon.js can be used to test JavaScript code, perform assertions, and test functions having real-time dependencies. These testing tools are relatively easy to use and can cut your troubleshooting time down.

Testing JavaScript code is important because you can reduce the number of bugs by checking for all conceivable test cases. Even though implementing a testing framework takes time and effort, it can prevent customer dissatisfaction, system breakdown, and possibly legal consequences. In this book, we discuss setting up a testing environment using the mocha testing framework, chai for assertions, and sinon for mocking.

In this Book

  • Importance of Testing in JavaScript
  • Server-Side JavaScript
  • Introduction to Mocha
  • Mocha Interfaces and Reporters
  • Assertion Library—Chai
  • Testing Applications Using Sinon — I
  • Testing Applications Using Sinon – II
  • Implementing Assertions and Matchers Using Sinon
  • Introduction to UI Testing
  • Implementing UI Testing