Chapter 9: Testing Next.js
Testing is an essential part of the whole development workflow. It gives you more assurance that you're not introducing bugs into your code, as well as that you're not breaking any existing features.
Testing Next.js specifically is not different from testing any other React app or Express.js, Fastify, or Koa application. In fact, we can divide the testing phases into three different stages:
- Unit testing
- End-to-end testing
- Integration testing
We will look at those concepts in detail in this chapter's sections.
If you already have previous experience in writing a React application, you're likely to re-utilize your knowledge for testing a Next.js-based website.
In this chapter, we will look in detail at the following:
- An introduction to testing and testing frameworks
- Setting up a testing environment
- How to use some of the most popular test runners, frameworks, and utility libraries
By...