Summary
Throughout this chapter, we’ve looked at different approaches to testing different types of Vue.js applications.
Testing in general is useful for empirically showing that the system is working. Unit tests are the cheapest to build and maintain and should be the base of testing functionality. System tests are the next level up in the testing pyramid and allow you to gain confidence that the majority of features are working as expected. End-to-end tests show that the main flows of the full system work.
We’ve seen how to unit test components and methods, as well as testing through layers, and testing component output in a black-box fashion instead of inspecting component internals to test functionality. Using the Vitest testing library, we tested advanced functionality, such as routing and applications, that leverage Pinia.
Finally, we looked at snapshot testing and saw how it can be an effective way to write tests for template-heavy chunks of code.
In...