Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
const snapshotDotPath = path.join(
snapshotsDir,
`${snapshotIdentifier}${dotSnap}`
);
const diffDir = customDiffDir
? path.join(process.cwd(), customDiffDir, relativePath)
: path.join(snapshotsDir, '__diff_output__');
const diffDotPath = path.join(diffDir, `${snapshotIdentifier}${dotDiff}`);
if (fs.pathExistsSync(snapshotDotPath)) {
fs.copySync(snapshotDotPath, snapshotKebabPath);
}
snapshotResult = diffImageToSnapshot({
snapshotsDir,
diffDir,
receivedImageBuffer,
snapshotIdentifier,
failureThreshold,
failureThresholdType,
updateSnapshot: updateSnapshots,
...options,
});
const { pass, added, updated, diffOutputPath } = snapshotResult;
if (!pass && !added && !updated) {
fs.copySync(diffOutputPath, diffDotPath);
fs.removeSync(diffOutputPath);
fs.removeSync(snapshotKebabPath);