Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
]).then(([actualHash, expectedHash]) => {
if (actualHash === expectedHash) {
if (!process || !process.send) return;
return process.send({ passed: true, image });
}
const diffImage = image.replace(/\.[^\.]+$/, ".png");
return imgDiff({
actualFilename: path.join(actualDir, image),
expectedFilename: path.join(expectedDir, image),
diffFilename: path.join(diffDir, diffImage),
options: {
threshold: matchingThreshold,
includeAA: !enableAntialias,
},
})
.then(({ width, height, diffCount }) => {
const passed = isPassed({ width, height, diffCount, thresholdPixel, thresholdRate });
if (!process || !process.send) return;
process.send({ passed, image });
})
})
};