Skip to content

Commit 22d08b5

Browse files
authored
Merge pull request #34 from Kartikeya99/ignoredBox
Base Image Absent Error
2 parents c043b88 + 887d70f commit 22d08b5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

index.js

+15
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ class ResembleHelper extends Helper {
2626
image1 = this.config.baseFolder + image1;
2727
image2 = this.config.screenshotFolder + image2;
2828

29+
// check whether the base and the screenshot images are present.
30+
fs.access(image1, fs.constants.F_OK | fs.constants.W_OK, (err) => {
31+
if (err) {
32+
throw new Error(
33+
`${image1} ${err.code === 'ENOENT' ? 'base image does not exist' : 'is read-only'}`);
34+
}
35+
});
36+
37+
fs.access(image2, fs.constants.F_OK | fs.constants.W_OK, (err) => {
38+
if (err) {
39+
throw new Error(
40+
`${image2} ${err.code === 'ENOENT' ? 'screenshot image does not exist' : 'is read-only'}`);
41+
}
42+
});
43+
2944
return new Promise((resolve, reject) => {
3045

3146
resemble.outputSettings({

0 commit comments

Comments
 (0)