Creating a functional test using Mocha

In order to illustrate the process of writing tests for our TDD approach, we will use a tool called Mocha (https://mochajs.org/). Mocha is a very common and easy-to-use JavaScript test framework to create a test.

We will install it locally on our system using the following npm, the Node.js package manager command.

First, we will initialize npm with the following command:

$ npm config set registry http://registry.npmjs.org/$ npm init –yes

The output of running the preceding command is as follows:

This will create a new file called package.json. Next, we will install Mocha and add it to our list of development ...

Get Effective DevOps with AWS - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.