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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.