Testing Your App with Vitest and Cypress
No matter how much experience you have under your belt in writing code, testing your app is a must to produce a high-quality code base. There are different testing tools out there, but in this book, we are going to learn Vitest for unit tests and Cypress for end-to-end testing.
Testing is a large topic, and in this chapter, we will learn the basics of both testing methodologies, leaving out advanced techniques for future reading and training that you will encounter in the course of your career.
First, we are going to learn the different testing methods and how they each contribute to producing quality software. We will then introduce unit tests by learning how to use Vitest and Vue Test Utils to test individual components in our application. Then, we will move our focus away from the individual components and concentrate on our application, by introducing E2E (end-to-end) tests with Cypress. We will then write an E2E test to cover a small...