Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.buildDiff = function(opts, cb) {
var diffOptions = {
reference: opts.reference,
current: opts.current,
diff: opts.diff,
highlightColor: opts.diffColor
};
if ('tolerance' in opts) {
diffOptions.tolerance = opts.tolerance;
}
looksSame.createDiff(diffOptions, cb);
};
captureWindow('Finder', title, function (err, pngPath) {
if (err) return cb(err)
const opts = Object.assign({
reference: expectedPath,
current: pngPath,
highlightColor: '#f0f'
}, toleranceOpts)
looksSame.createDiff(opts, function (err, data) {
if (err) return cb(err)
temp.writeFile(data, function (err, diffPath) {
if (err) return cb(err)
cb(null, { diff: diffPath, actual: pngPath })
})
})
})
}
return Promise.fromCallback((cb) => looksSame.createDiff(diffOptions, cb));
}
createDiff: function(img1, img2, callback) {
var options = objectAssign({}, this._options, {
reference: img1,
current: img2
});
looksSame.createDiff(options, callback);
}
});
LooksSameAdaptor.prototype.createDiff = function(img1, img2, callback) {
var options = {
reference: img1,
current: img2,
highlightColor: '#ff00ff',
strict: true,
save: false
};
looksSame.createDiff(options, callback);
}