From 875845c8240e569abed9b8178a1d1e0f18a3e09d Mon Sep 17 00:00:00 2001 From: Shan Date: Wed, 8 Jul 2020 14:47:20 -0400 Subject: [PATCH] Fix bug - baseline and comparison images write mode (#75) --- index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 99645fa..3707fc1 100644 --- a/index.js +++ b/index.js @@ -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'}`); } });