From 76b304049673a566616cad97be47c10685874161 Mon Sep 17 00:00:00 2001 From: 1234tgk <1234tgk@gmail.com> Date: Wed, 3 May 2023 12:28:06 -0400 Subject: [PATCH 1/2] add yarn check --- code/addons/storyshots-puppeteer/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/code/addons/storyshots-puppeteer/package.json b/code/addons/storyshots-puppeteer/package.json index f503650e1a52..02a4a9d8078c 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": { From 20dde1af02334c273fd77dbf0a0267d89d70d420 Mon Sep 17 00:00:00 2001 From: 1234tgk <1234tgk@gmail.com> Date: Thu, 4 May 2023 05:35:59 -0400 Subject: [PATCH 2/2] migrate @storybook/addons-storyshots-puppeteer to strict TS --- code/addons/storyshots-puppeteer/src/config.ts | 14 +++++++------- code/addons/storyshots-puppeteer/tsconfig.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) 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/**/*"] }