Skip to content

Commit

Permalink
reduce pixelmatch threshold to 0 for non-mapbox also fail on mapbox b…
Browse files Browse the repository at this point in the history
…ig diffs
  • Loading branch information
archmoj committed Jun 17, 2021
1 parent 7a44a8e commit b1de0bb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/image/compare_pixels_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,18 @@ for(var i = 0; i < allMockList.length; i++) {
height: height
});

var numDiffPixels = pixelmatch(img0.data, img1.data, diff.data, width, height, {threshold: 0.1});
var shouldBePixelPerfect = mockName.substr(0, 7) !== 'mapbox_' && [
// list flaky mocks other than mapbox:
'gl3d_bunny-hull'
].indexOf(mockName) === -1;

var numDiffPixels = pixelmatch(img0.data, img1.data, diff.data, width, height, {
threshold: shouldBePixelPerfect ? 0 : 0.2
});

if(numDiffPixels) {
fs.writeFileSync(imagePaths.diff, PNG.sync.write(diff));

// mapbox behave differently from run-to-run
// skip error on mapbox diff
if(mockName.substr(7) === 'mapbox_') continue;

console.error('pixels do not match: ' + numDiffPixels);
fail(mockName);
} else {
Expand Down

0 comments on commit b1de0bb

Please # to comment.