Step 1
Open the project in VSCode. Then, open the terminal at the root of the project. Next, install Jest:
npm install jest --save-dev
Notice the flag --save-dev
. This option indicates that dependency is required during the development only. For the app to run in production, this library is not needed. This saves the size of your production bundle.
In addition to Jest, we will use SuperTest:
npm install supertest --save-dev
SuperTest is an HTTP assertions library that allows you to test your HTTP servers. We primarily use it to run the API server without actually running the server! For testing, we will rely on Jest rather than SuperTest.