Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/diff-looks-same/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"main": "src/index.js",
"dependencies": {
"fs-extra": "^9.1.0",
"looks-same": "^4.0.0"
"looks-same": "^8.1.0"
},
"publishConfig": {
"access": "public"
Expand Down
36 changes: 15 additions & 21 deletions packages/diff-looks-same/src/create-looks-same-differ.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,24 @@ function createLooksSameDiffer(config) {
return reject(new Error('Current image is empty'));
}

return looksSame(reference, current, instanceConfig, (err, isSame) => {
if (err) {
reject(err);
} else if (isSame) {
resolve(isSame);
try {
const { equal } = await looksSame(reference, current, instanceConfig);
if (equal) {
resolve(equal);
} else {
fs.ensureFileSync(diffPath);
looksSame.createDiff(
{
...instanceConfig,
reference,
current,
diff: diffPath,
highlightColor: '#ff00ff',
},
(diffErr) => {
if (diffErr) {
reject(diffErr);
}
resolve(false);
}
);
const diff = await looksSame.createDiff({
...instanceConfig,
reference,
current,
diff: diffPath,
highlightColor: '#ff00ff',
});
resolve(diff);
}
});
} catch (err) {
reject(err);
}
});
};
}
Expand Down
Loading