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

Enable fail on image size mismatch to be configurable #85

Closed
mishimaltd opened this issue Jun 25, 2018 · 3 comments
Closed

Enable fail on image size mismatch to be configurable #85

mishimaltd opened this issue Jun 25, 2018 · 3 comments

Comments

@mishimaltd
Copy link

I am snapshot testing a legacy project and the diff tool works wonderfully most of the time. The system I am testing will sometimes return HTML that is one pixel taller than the previously captured snapshot. Other than the height difference, the output is identical and the pixel match works fine.

Would it be possible to make the default fail on image size mismatch logic configurable? This would really help me with regression testing so that I can focus on significant differences and ignore these edge cases.

@anescobar1991
Copy link
Member

anescobar1991 commented Jun 27, 2018

@mishimaltd do the solutions in #83 (comment) help at all? I'd be reluctant to add this feature because an image of different dimensions is a different image and should fail. Doing a diff across differently sized images yields to unexpected and misleading results.

@mishimaltd
Copy link
Author

Hey, thanks very much for coming back to me. I do take your point on image size, it is a bit of a stretch.

I'll try using Jimp to clean up the image prior to comparing, I think it will do what I need.

Thanks again :-)

@adrianjost
Copy link
Contributor

adrianjost commented Jan 27, 2020

I'll try using Jimp to clean up the image prior to comparing, I think it will do what I need.

Just in case anyone will stumble across this Issue in the future: I can recommend sharp instead of JIMP because of performance reasons in favor of a bit less compatibility.

Our Performance Results:
Without manipulation images: ~3min
With Jimp autocrop: ~10min
With ahrp: ~3.5min

anescobar1991 pushed a commit that referenced this issue Apr 17, 2020
if the option `allowSizeMismatch` is set, a build will not always fail on
images with different sizes. Missing or Added Pixel will be counted as a
mismatch and respected by the set threshold.

Related #83, #85
oneamexbot added a commit that referenced this issue Apr 17, 2020
# [3.1.0](v3.0.1...v3.1.0) (2020-04-17)

### Features

* **options:** add option to pass on size missmatch ([#174](#174)) ([cee46b1](cee46b1)), closes [#83](#83) [#85](#85)
goverdhan07 pushed a commit to goverdhan07/jest-image-snapshot that referenced this issue Jul 23, 2023
)

if the option `allowSizeMismatch` is set, a build will not always fail on
images with different sizes. Missing or Added Pixel will be counted as a
mismatch and respected by the set threshold.

Related americanexpress#83, americanexpress#85
goverdhan07 pushed a commit to goverdhan07/jest-image-snapshot that referenced this issue Jul 23, 2023
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

3 participants