
上QQ阅读APP看书,第一时间看更新
Chapter 2. Automating Tests with Mocha, Chai, and Sinon
Before we start making some BDD, let's familiarize ourselves with the basic tools available in JavaScript to write and execute a test. In this chapter, we will explore the main capabilities of Mocha, the most popular test runner in JavaScript. We will perform the following tasks:
- Writing expressive assertions using the Chai package
- Creating test doubles using the Sinon and sinon-chai packages
- Exploring the basic techniques for organizing our test codebase
To achieve these goals, we will perform a small code kata, or coding exercise, where we will be able to practice not only the tools, but also the test-first cycle explained in the previous chapter.