Open kolodny opened 1 year ago
I'd like to try out the ssim-cie94 method of @playwright/test. To do that I'd need to be able to provide a custom function to comparisonMethod (as opposed to just the two string options: 'pixelmatch' | 'ssim'). I think this property can accept a function and just execute that function with the same arguments it's already using for the other two methods https://github.com/americanexpress/jest-image-snapshot/blob/c3cfd12be15eb92f0213ab91cf2cc071c909bacc/src/diff-snapshot.js#L225
ssim-cie94
comparisonMethod
'pixelmatch' | 'ssim'
Essentially it'll change to this
- const comparisonFn = comparisonMethod === 'ssim' ? ssimMatch : pixelmatch; + const comparisonFn = typeof comparisonMethod === 'function' ? comparisonMethod : + comparisonMethod === 'ssim' ? ssimMatch : pixelmatch;
This will also make the library more robust to handle other custom diffing strategies moving forward.
I'd like to try out the
ssim-cie94
method of @playwright/test. To do that I'd need to be able to provide a custom function tocomparisonMethod
(as opposed to just the two string options:'pixelmatch' | 'ssim'
). I think this property can accept a function and just execute that function with the same arguments it's already using for the other two methods https://github.com/americanexpress/jest-image-snapshot/blob/c3cfd12be15eb92f0213ab91cf2cc071c909bacc/src/diff-snapshot.js#L225Essentially it'll change to this
This will also make the library more robust to handle other custom diffing strategies moving forward.