From 30e9a7347ad0d6cd17a9668ea55f4eb87e218e3b Mon Sep 17 00:00:00 2001 From: Dan Adajian Date: Sun, 21 May 2023 16:37:54 -0500 Subject: [PATCH] fix(utils): separate matchScreenshot export from Cypress command add --- utils/match-screenshot-command.ts | 11 +++++++++++ utils/match-screenshot.ts | 10 ---------- utils/package.json | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 utils/match-screenshot-command.ts diff --git a/utils/match-screenshot-command.ts b/utils/match-screenshot-command.ts new file mode 100644 index 00000000..0737f226 --- /dev/null +++ b/utils/match-screenshot-command.ts @@ -0,0 +1,11 @@ +import { matchScreenshot, MatchScreenshotArgs } from './match-screenshot'; + +Cypress.Commands.add('matchScreenshot', { prevSubject: ['optional', 'element', 'window', 'document'] }, matchScreenshot); + +declare global { + namespace Cypress { + interface Chainable { + matchScreenshot(args?: MatchScreenshotArgs): Chainable; + } + } +} diff --git a/utils/match-screenshot.ts b/utils/match-screenshot.ts index 1c624397..b0f105be 100644 --- a/utils/match-screenshot.ts +++ b/utils/match-screenshot.ts @@ -90,13 +90,3 @@ export function matchScreenshot(subject: Cypress.JQueryWithSelector | Window | D return null; }); } - -Cypress.Commands.add('matchScreenshot', { prevSubject: ['optional', 'element', 'window', 'document'] }, matchScreenshot); - -declare global { - namespace Cypress { - interface Chainable { - matchScreenshot(args?: MatchScreenshotArgs): Chainable; - } - } -} diff --git a/utils/package.json b/utils/package.json index ff994e00..7bfea53f 100644 --- a/utils/package.json +++ b/utils/package.json @@ -27,6 +27,6 @@ }, "scripts": { "build": "tsc", - "postbuild": "echo \"require('./dist/match-screenshot');\" > commands.js" + "postbuild": "echo \"require('./dist/match-screenshot-command');\" > commands.js" } }