September 2017
Intermediate to advanced
450 pages
11h 24m
English
Let's explore how to apply unit testing using the popular Mocha and Chai Node.js libraries to our Express web server. Before we start, we'll want to ensure that we install these libraries and their TypeScript type definitions to our application's package.json file:
npm install mocha chai @types/mocha @types/chai --save-dev
In keeping with our convention to use TypeScript consistently, we will need to add some additional libraries to assist with creating unit tests in Mocha with TypeScript:
npm install mocha-typescript ts-node node-mocks-http --save-dev
These libraries provide a range of tools for testing with Mocha in a TypeScript friendly Node.js environment:
Read now
Unlock full access