Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate @storybook/addon-storyshots-puppeteer to strict TS #22407

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/addons/storyshots-puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"*.d.ts"
],
"scripts": {
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
"prep": "../../../scripts/prepare/tsc.ts"
},
"dependencies": {
Expand Down
14 changes: 7 additions & 7 deletions code/addons/storyshots-puppeteer/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>;
getCustomBrowser: () => Promise<Browser>;
getCustomBrowser?: () => Promise<Browser>;
/**
* Puppeteer browser launch options:
* {@link https://pptr.dev/api/puppeteer.puppeteernode.launch/ puppeteer.launch()}
Expand All @@ -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<void | ElementHandle>;
afterScreenshot: (options: { image: string | void | Buffer; context: Context }) => Promise<void>;
Expand Down Expand Up @@ -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,
};
2 changes: 1 addition & 1 deletion code/addons/storyshots-puppeteer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"skipLibCheck": true,
"types": ["node"],
"declaration": true,
"strict": false
"strict": true
},
"include": ["src/**/*"]
}