spatie / phpunit-snapshot-assertions

A way to test without writing actual test cases
https://spatie.be/courses/testing-laravel-with-pest/snapshot-testing
MIT License
641 stars 70 forks source link

Is it possible to allow certain differences in snapshots? #139

Closed Luc45 closed 2 years ago

Luc45 commented 2 years ago

When generating a snapshot for a certain data, is it possible to allow certain differences? Such as an id JSON property or created_at timestamp? Similar to the tolerable differences seen here https://github.com/lucatume/wp-snapshot-assertions

freekmurze commented 2 years ago

That is currently not supported.

ShaneOH commented 2 years ago

@freekmurze Any way to re-open this and put it on the roadmap? A setTolerableDifferences method would be extremely helpful when dealing with snapshots with non-deterministic fields (timestamps, IDs, etc.) and markedly better than manually having to remove them from the snapshots etc.

freekmurze commented 2 years ago

We don't have a roadmap. Feel free to PR this with tests and updated docs. 👍