diff --git a/code/addons/storyshots-puppeteer/package.json b/code/addons/storyshots-puppeteer/package.json index 6f362da4a48c..f5e61cd30a19 100644 --- a/code/addons/storyshots-puppeteer/package.json +++ b/code/addons/storyshots-puppeteer/package.json @@ -31,6 +31,7 @@ "*.d.ts" ], "scripts": { + "check": "../../../scripts/node_modules/.bin/tsc --noEmit", "prep": "../../../scripts/prepare/tsc.ts" }, "dependencies": { diff --git a/code/addons/storyshots-puppeteer/src/config.ts b/code/addons/storyshots-puppeteer/src/config.ts index f899a3d9a3ec..25d6633540bc 100644 --- a/code/addons/storyshots-puppeteer/src/config.ts +++ b/code/addons/storyshots-puppeteer/src/config.ts @@ -28,10 +28,10 @@ interface DirectNavigationOptions { export interface CommonConfig { storybookUrl: string; - chromeExecutablePath: string; - getGotoOptions: (options: Options) => DirectNavigationOptions; + chromeExecutablePath?: string; + getGotoOptions: (options: Options) => DirectNavigationOptions | undefined; customizePage: (page: Page) => Promise; - getCustomBrowser: () => Promise; + getCustomBrowser?: () => Promise; /** * Puppeteer browser launch options: * {@link https://pptr.dev/api/puppeteer.puppeteernode.launch/ puppeteer.launch()} @@ -48,7 +48,7 @@ export interface PuppeteerTestConfig extends CommonConfig { } export interface ImageSnapshotConfig extends CommonConfig { - getMatchOptions: (options: Options) => MatchImageSnapshotOptions; + getMatchOptions: (options: Options) => MatchImageSnapshotOptions | undefined; getScreenshotOptions: (options: Options) => Base64ScreenShotOptions; beforeScreenshot: (page: Page, options: Options) => Promise; afterScreenshot: (options: { image: string | void | Buffer; context: Context }) => Promise; @@ -95,11 +95,11 @@ export const defaultImageSnapshotConfig: ImageSnapshotConfig = { ...defaultCommonConfig, getMatchOptions: noop, getScreenshotOptions: defaultScreenshotOptions, - beforeScreenshot: noop, - afterScreenshot: noop, + beforeScreenshot: asyncNoop, + afterScreenshot: asyncNoop, }; export const defaultAxeConfig: AxeConfig = { ...defaultCommonConfig, - beforeAxeTest: noop, + beforeAxeTest: asyncNoop, }; diff --git a/code/addons/storyshots-puppeteer/tsconfig.json b/code/addons/storyshots-puppeteer/tsconfig.json index 471c35718cf5..b32dad6f525c 100644 --- a/code/addons/storyshots-puppeteer/tsconfig.json +++ b/code/addons/storyshots-puppeteer/tsconfig.json @@ -4,7 +4,7 @@ "skipLibCheck": true, "types": ["node"], "declaration": true, - "strict": false + "strict": true }, "include": ["src/**/*"] }