diff --git a/src/commands.ts b/src/commands.ts index effadbef..c59373f5 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -162,7 +162,7 @@ Cypress.Commands.add( }, log: false, }) - .then(() => imgPath); + .then(() => cy.task(TASK.processImgPath, { path: imgPath }).then(newImgPath => imgPath = newImgPath)); }) .then((imgPath) => cy diff --git a/src/task.hook.ts b/src/task.hook.ts index 64f4ccba..70102db5 100644 --- a/src/task.hook.ts +++ b/src/task.hook.ts @@ -183,6 +183,8 @@ export const compareImagesTask = async ( export const doesFileExistTask = ({ path }: { path: string }) => fs.existsSync(path); +export const processImgPath = ({ path: string }) => path; + /* c8 ignore start */ export const initTaskHook = (config: Cypress.PluginConfigOptions) => ({ [TASK.getScreenshotPathInfo]: getScreenshotPathInfoTask, @@ -190,5 +192,6 @@ export const initTaskHook = (config: Cypress.PluginConfigOptions) => ({ [TASK.doesFileExist]: doesFileExistTask, [TASK.approveImage]: approveImageTask, [TASK.compareImages]: compareImagesTask, + [TASK.processImgPath]: processImgPath, }); /* c8 ignore stop */