syrusakbary / snapshottest

Snapshot Testing utils for Python 📸
MIT License
535 stars 103 forks source link

First snapshot shouldn't be autosaved #25

Open JanBednarik opened 6 years ago

JanBednarik commented 6 years ago

When I create snapshot for the first time I have no idea what was saved in snapshot. If it's right or wrong. SnapshotTest assumes that first snapshot is always right. But user should decide. It should be considered wrong until user explicitly checks it in test report and confirms it (e.g. by --snapshot-update).

max-sixty commented 6 years ago

This was v surprising behavior.

Are there other similar libraries that share this? I haven't come across one

joscha commented 6 years ago

Are there other similar libraries that share this? I haven't come across one

https://github.com/facebook/jest does this as well, first run will create the baseline. Given we hopefully all use VCS I personally think the behaviour is okay.

pablopalacios commented 6 years ago

The current behaviour mimics jest behaviour which is pretty fine if you follow this workflow:

  1. Write a test
  2. Write a stub implementation which will generate a dumb snapshot
  3. Write the real implementation
  4. Update the dumb snapshot only when you think the real implementation is right
  5. Commit