mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Minor changes * Only exclude installed packages that are not @grafana/e2e itself * Explicitly load Cypress tsconfig for clarity * Fix Cypress tsconfig * it was trying to extend a config that is not published * it needs to be commonjs
26 lines
620 B
JavaScript
26 lines
620 B
JavaScript
const BlinkDiff = require('blink-diff');
|
|
|
|
function compareSnapshotsPlugin(args) {
|
|
args.threshold = args.threshold || 0.001;
|
|
|
|
return new Promise((resolve, reject) => {
|
|
const diff = new BlinkDiff({
|
|
imageAPath: args.pathToFileA,
|
|
imageBPath: args.pathToFileB,
|
|
thresholdType: BlinkDiff.THRESHOLD_PERCENT,
|
|
threshold: args.threshold,
|
|
imageOutputPath: args.pathToFileA.replace('.png', '.diff.png'),
|
|
});
|
|
|
|
diff.run((error, result) => {
|
|
if (error) {
|
|
reject(error);
|
|
} else {
|
|
resolve(result);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = compareSnapshotsPlugin;
|