Skip to content

Commit

Permalink
fix(utils): separate matchScreenshot export from Cypress command add
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian committed May 21, 2023
1 parent 461a84b commit 30e9a73
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 11 additions & 0 deletions utils/match-screenshot-command.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
10 changes: 0 additions & 10 deletions utils/match-screenshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
},
"scripts": {
"build": "tsc",
"postbuild": "echo \"require('./dist/match-screenshot');\" > commands.js"
"postbuild": "echo \"require('./dist/match-screenshot-command');\" > commands.js"
}
}

0 comments on commit 30e9a73

Please sign in to comment.