Ensuring stability with Vitest
Now that we have a working app, adding or removing a property can be done with ease. Just update the file and you’re ready. This is, however, not always a desirable situation. Having the ability to remove properties that easily could result in unwanted bugs in your application!
We can add more control to our code by describing its behavior using tests. In this part, we’ll take a look at adding unit tests with Vitest and Vue Test Utils, to demonstrate where unit tests can help you (and where they cannot).
Vue Test Utils
The official testing library for Vue.js projects is Vue Test Utils (https://test-utils.vuejs.org/). A testing framework is a series of tools and functions that you can use to create isolated instances of a component and manipulate it to assert certain behaviors.
The purpose of unit testing is to validate that each unit (or component) of the software is working as expected and meets the specified requirements. In...