Skip to content

maxDiffThreshold doesn't allow 0 #213

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
OriR opened this issue Feb 8, 2023 · 1 comment
Closed

maxDiffThreshold doesn't allow 0 #213

OriR opened this issue Feb 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@OriR
Copy link

OriR commented Feb 8, 2023

Describe the bug
maxDiffThreshold is a number that represents the maximum fractional value of pixels changed, where 1 means all pixels are different and 0 means all pixels are the same.

However, when setting it to 0, it fallbacks to 0.01.

To Reproduce
Set maxDiffThreshold to 0, create a test that matches the snapshots and run it, then change a single character and see that the test still passes.

Expected behavior
The above test should fail.

Additional context
It appears to be because the default value is set using || and not using ?? which makes 0 a falsy value and thus fallbacks to 0.01.

@OriR OriR added the bug Something isn't working label Feb 8, 2023
@FRSgit
Copy link
Member

FRSgit commented Mar 26, 2023

Hey, this got fixed in commit f4d3ec9 and got release under v3.2.11

@FRSgit FRSgit closed this as completed Mar 26, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants