garris / BackstopJS

Catch CSS curve balls.
http://backstopjs.org
MIT License
6.66k stars 602 forks source link

`requireSameDimensions` property is not working #1557

Closed rrojas-prmnt closed 4 months ago

rrojas-prmnt commented 4 months ago

According to the documentation, we can set the 'requireSameDimensions' property to 'false' if we do not want to trigger a failed test when the dimensions are not equal. However, after debugging, I discovered that the 'requireSameDimensions' property will never receive a value of 'false' because it is being ignored in this condition. https://github.com/garris/BackstopJS/blob/a0a9507e723d7ab90cc5c698c407b3707198b0d5/core/util/engineTools.js#L46

it will always fall into the next property and if these are also a falsy value, will always default to true. Which makes this function not working fine.

I think it should be:

return scenario?.requireSameDimensions ?? config?.requireSameDimensions ?? config?.defaultMisMatchThreshold ?? true;
dgrebb commented 4 months ago

Thanks for catching this @rrojas-prmnt; this is my mistake.

Fixed in #1558 along with misMatchThreshold, which was using the same—incorrect—pattern.