spatie/phpunit-snapshot-assertions

Is it possible to allow certain differences in snapshots?

Closed this issue ยท 3 comments

Luc45 commented

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

That is currently not supported.

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

We don't have a roadmap. Feel free to PR this with tests and updated docs. ๐Ÿ‘