Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: support Property Matchers like Jest #75

Open
cdignam-segment opened this issue Jan 24, 2022 · 1 comment
Open

Feature request: support Property Matchers like Jest #75

cdignam-segment opened this issue Jan 24, 2022 · 1 comment

Comments

@cdignam-segment
Copy link

Jest has a great feature for matching specific types for fields: https://jestjs.io/docs/snapshot-testing#property-matchers

It would be great if this library also support this.

@bradleyjkemp
Copy link
Owner

Hey 👋🏻

Unfortunately, this sounds a pretty tricky feature to implement in this library. Whereas jest has you specify your snapshots in code, cupaloy does the snapshotting for you and saves them to disk.

The closest library I know of that might help is https://github.com/sebdah/goldie which lets you have Go templates as your snapshots and interpolate values into them at test-time: https://github.com/sebdah/goldie#assertions-using-templates

In contast, cupaloy is very simple and so requires that the datastructure you pass in already has any non-deterministic/non-repeatable data (like timestamps, etc.) mocked out with static values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants