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));
}
function compare_(x) {
var color = pickRGB(image.getRGBA(x, row));
return looksSame.colors(color, searchColor);
}
}
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);
}
return new Promise((resolve, reject) => {
looksSame(image1, image2, { ignoreCaret: true }, (error, { equal }) => {
if (equal) {
resolve(equal);
return;
}
const { diff, one, two } = getDiffPaths();
md(dirname(diff))
.then(() => {
return Promise.all([write(one, image1), write(two, image2)]);
})
.then(() => {
createDiff(
{
reference: image1,
current: image2,
diff: diff,