Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cache.forEach(({ diffRatio, diffPixelCount, diffOutputPath }) => {
console.log(
`\n - ${diffOutputPath}\n Screenshot was ${diffRatio *
100}% different from saved snapshot with ${diffPixelCount} different pixels.\n`
);
termImage(diffOutputPath, { fallback });
});
}
public async saveScreenshot(fn: (path: string) => Promise): Promise {
const path = this.workRoot.join('screenshots', `${cuid()}.jpg`)
debugScreenshot(`Saving screenshot to: ${path}`)
if (await fn(path)) {
this.screenshots.push(path)
debugScreenshot(`Saved screenshot to: ${path}`)
termImg(path, {
width: '40%',
fallback: () => {
return `Screenshot path: ${path}`
},
})
}
}
}