Mistake: Blindly Updating Snapshot
Question
What is wrong with this approach?
Code
// Snapshot test failed after code change
// Developer runs: jest --updateSnapshot
// All snapshots now pass
Hint
Updating snapshots without reviewing can hide bugs.
Explanation
The mistake is blindly running --updateSnapshot without reviewing what changed. If the output changed because of a bug, updating the snapshot hides the bug. The fix: always review the snapshot diff carefully before updating. Use --ci flag in CI to prevent accidental snapshot updates, and review changes manually in development.
Related Resources
Related Lessons
- Snapshot Testing
Using snapshots effectively.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.