garris/BackstopJS

`requireSameDimensions` property is not working

rrojas-prmnt opened this issue · 1 comments

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.

return scenario?.requireSameDimensions || config?.requireSameDimensions || config?.defaultMisMatchThreshold || true;

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;

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

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