jest-screenshot icon indicating copy to clipboard operation
jest-screenshot copied to clipboard

Allow modifying screenshot filename

Open mihkeleidast opened this issue 4 years ago • 1 comments

Hello! I'm trying to evaluate if I can migrate from jest-image-snapshot to this library since this seems to run a lot faster.

Since I've got a lot of existing snapshots that I would rather not rename/update (so I wouldn't have to validate everything manually), I would like to change the name of the snapshots so I could use the same naming scheme as jest-image-snapshot uses. Additionally, we need to have the ability to change the filename based on some env variables, so a function would be good.

jest-image-snapshot allows doing this with the customSnapshotIdentifier option that can be a function. Would you consider adding something similar?

I tried doing this in my project by overriding the toMatchImageSnapshot with a custom matcher, but got stuck with the test count in the filename.

mihkeleidast avatar Jul 23 '21 10:07 mihkeleidast

Allowing to provide a custom snapshot identifier would be awesome!

fjaeger avatar Feb 16 '22 07:02 fjaeger