americanexpress / jest-image-snapshot

✨ Jest matcher for image comparisons. Most commonly used for visual regression testing.
Apache License 2.0
3.84k stars 200 forks source link

Clarify what "unique customSnapshotIdentifier" means when using with jest.retryTimes() #348

Open mihkeleidast opened 9 months ago

mihkeleidast commented 9 months ago

When using jest.retryTimes, toMatchImageSnapshot fails if there is no custom customSnapshotIdentifier configured. However, I don't really understand what the docs mean in this case in terms of "uniqueness".

For example, if I define it like this:

customSnapshotIdentifier: (options) => {
    return `${options.defaultIdentifier}-snap`;
}

which is effectively the same as the default snapshot identifier, I get past the thrown error, and it seems to work OK. So why does it need to be configured at all?