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

fix: allowSizeMismatch error messaging #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Elte156
Copy link

@Elte156 Elte156 commented Jan 8, 2025

@Elte156 Elte156 force-pushed the fix-allowSizeMismatch-error-messaging branch from 71bded9 to 86d5b55 Compare January 8, 2025 03:14
diffRatio * 100
}% different from saved snapshot with ${diffPixelCount} different pixels.\nSee diff for details: ${diffOutputPath}`
const message =
diffSize && !options.allowSizeMismatch
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intention here to make this something the user can pass in?

Ideally we should add it to the options type - https://github.com/simonsmith/cypress-image-snapshot/blob/master/src/types.ts#L38-L45

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • That was not my original intention
  • This small change is to respect that option and report on the actual cause of error
    • If the diff is different and wrong size, the error will always show the wrong size message
    • With this small change; the error will accurately show the different message because allowSizeMismatch is true (so we should forgo showing the wrong size message)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, I didn't realise it was part of Jest 👍🏻

Looks like it might just need a test fix, and should be all good

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are failing in the pipeline, but it doesn't seem like my small change would have caused this or require a new baseline of snapshots.

I ran the tests locally on both master and this branch. They both succeeded with 13 passing tests.

yarn docker:build
yarn docker:run

Something doesn't seem right. @simonsmith can I get a sanity check here?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, if they're passing locally maybe a problem I've introduced on CI. I'll take a look for you. Thanks for checking!

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

Successfully merging this pull request may close these issues.

2 participants