When a Test Fails
Explore how to analyze and manage snapshot test failures in Vue.js components with Jest. Understand the significance of snapshot testing in identifying regressions, deciding when to update snapshots, and combining snapshots with specific assertions for thorough testing.
We'll cover the following...
We'll cover the following...
The snapshots generated are the source of truth for deciding if a test is valid or not. That’s the way regressions are checked, and in the end, it depends on your criteria.
Example
For example, go to the ContactBox.vue component and change the fullName computed prop to be separated by a comma:
If you run the tests again, some of them will fail since the rendering result is different than before. You’ll get an error like this: ...