Unit Testing
In previous chapters, we saw how to build reasonably complex Vue.js applications. This chapter is about testing them to maintain code quality and prevent defects. We will look at approaches to unit testing Vue.js applications in order to improve the quality and speed of delivery of our applications.
We will also look at using tests to drive development using Test-Driven Development (TDD). As we proceed, we will gain an understanding of why code needs to be tested and what kinds of testing can be employed on different parts of a Vue.js application.
In this chapter, we will cover the following topics:
- Understanding testing and the need to test code
- Building your first test
- Testing components
- Testing methods
- Testing routing
- Testing state management with Pinia
- Snapshot testing