Snapshot testing

Pros:

  • Easy to write tests

  • The cheaperst way to increase code coverage

  • Documentanion role (devleloper able to see the markup of the component in different cases)

Cons:

  • Failures are hard to understand (It’s often hard to see what changed by looking at the snapshot failure diff)

  • We tend to update snapshots without thinking

  • Easy to commit snapshots with bugs (since we usually don’t read these files carefully)

  • Coupling with low level modules (if you don’t use shallow rendering)

  • A false sense of security (Snapshots offer no guarantees that component appearance or behavior is correct)

Last updated