Skip to main content

Why are snapshots often considered an anti-pattern?

Snapshots are often considered an anti-pattern because they easily turn into noise that essentially checks nothing and makes tests harder to maintain.

The main reasons:


1. Tests stop checking the logic

A snapshot captures a huge "wall of text" as the result, and when changes happen, developers often just update the snapshot without checking whether the change is actually correct. As a result, the test guarantees nothing, it turns into a formality.


2. A false sense of security

It seems that "the component is covered by tests," but a snapshot does not check the important details. It only compares the "before/after" state and does not answer the main question: does the component work correctly. The test is green, but the bug remains.


3. Noisy diffs and weak signaling

Snapshots are often large. In a diff it is hard to notice exactly what changed, and it is easy to miss a real defect among a mass of insignificant changes.


4. Fragility

The smallest cosmetic changes (indentation, a line wrap, a minor refactoring move in JSX) break the snapshot. Tests start failing too often, encouraging developers to simply "update the snapshot and move on", and the benefit disappears.


5. Lack of explicit assertions

A good test answers the question:

"what specific behavior am I checking?"

A snapshot test answers:

"everything should be like before"

But this is too vague, and the test loses its meaning.


Summary

Snapshots are not evil, but:

  • they are easy to use lazily
  • they poorly express the intent of the test
  • they quickly turn into anti-useful noise

That is why many developers consider snapshots an anti-pattern and prefer explicit expectations and targeted checks that test the meaning, not the "picture."

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.