snapshottest icon indicating copy to clipboard operation
snapshottest copied to clipboard

First snapshot shouldn't be autosaved

Open JanBednarik opened this issue 7 years ago • 3 comments

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).

JanBednarik avatar Nov 29 '17 21:11 JanBednarik

This was v surprising behavior.

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

max-sixty avatar Apr 17 '18 12:04 max-sixty

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.

joscha avatar May 05 '18 22:05 joscha

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

pablopalacios avatar Jul 30 '18 18:07 pablopalacios