Testing the Fastify application
We are ready to implement the tests for our Fastify application. Before we start, we need to choose a framework that will help us write the code. Let’s complete this task first!
Installing the test framework
There are a lot of testing frameworks in the Node.js panorama. Some of them are highly opinionated, and others try to be agnostic. We are not going to discuss comparing the most famous modules. It is worth mentioning the ones most used by the community (in alphabetical order):
- AVA: https://www.npmjs.com/package/ava
- Jest: https://www.npmjs.com/package/jest
- Mocha: https://www.npmjs.com/package/mocha
- node-tap: https://www.npmjs.com/package/tap
- Tape: https://www.npmjs.com/package/tape
The framework we will use is node-tap
because it has all the key features out of the box without needing extra configuration, such as the following:
- An easy-to-use and solid implementation
- Comprehensive assertions ...