Skip to content

Fix bug - baseline and comparison images write mode (#75) #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2020
Merged
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
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ class ResembleHelper extends Helper {
const actualImage = this.screenshotFolder + image;

// check whether the base and the screenshot images are present.
fs.access(baseImage, fs.constants.F_OK | fs.constants.W_OK, (err) => {
fs.access(baseImage, fs.constants.F_OK | fs.constants.R_OK, (err) => {
if (err) {
throw new Error(
`${baseImage} ${err.code === 'ENOENT' ? 'base image does not exist' : 'is read-only'}`);
`${baseImage} ${err.code === 'ENOENT' ? 'base image does not exist' :
'base image has an access error'}`);
}
});

fs.access(actualImage, fs.constants.F_OK | fs.constants.W_OK, (err) => {
fs.access(actualImage, fs.constants.F_OK | fs.constants.R_OK, (err) => {
if (err) {
throw new Error(
`${actualImage} ${err.code === 'ENOENT' ? 'screenshot image does not exist' : 'is read-only'}`);
`${actualImage} ${err.code === 'ENOENT' ? 'screenshot image does not exist' :
'screenshot image has an access error'}`);
}
});

Expand Down