snapshottest
snapshottest copied to clipboard
First snapshot shouldn't be autosaved
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
).
This was v surprising behavior.
Are there other similar libraries that share this? I haven't come across one
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.
The current behaviour mimics jest behaviour which is pretty fine if you follow this workflow:
- Write a test
- Write a stub implementation which will generate a dumb snapshot
- Write the real implementation
- Update the dumb snapshot only when you think the real implementation is right
- Commit