From 1e802aaf9c36bd4c32af30a2ca7ab268366721b5 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sat, 5 Sep 2020 00:18:27 +0200 Subject: [PATCH] fix(storyshots): match typings of "test"-method to real usage closes #12361 --- .../src/api/StoryshotsOptions.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/addons/storyshots/storyshots-core/src/api/StoryshotsOptions.ts b/addons/storyshots/storyshots-core/src/api/StoryshotsOptions.ts index 8f1837d9d920..ee35d4443641 100644 --- a/addons/storyshots/storyshots-core/src/api/StoryshotsOptions.ts +++ b/addons/storyshots/storyshots-core/src/api/StoryshotsOptions.ts @@ -3,6 +3,24 @@ import { Stories2SnapsConverter } from '../Stories2SnapsConverter'; import { SupportedFramework } from '../frameworks'; import { RenderTree } from '../frameworks/Loader'; +export interface TestMethodOptions { + story: any; + context: any; + renderTree: RenderTree; + renderShallowTree: RenderTree; + stories2snapsConverter: Stories2SnapsConverter; + snapshotFileName: string; + options: any; +} + +export interface StoryshotsTestMethod { + (args: TestMethodOptions): any; + beforeAll?: () => void | Promise; + beforeEach?: () => void | Promise; + afterAll?: () => void | Promise; + afterEach?: () => void | Promise; +} + export interface StoryshotsOptions { asyncJest?: boolean; config?: (options: any) => void; @@ -12,7 +30,7 @@ export interface StoryshotsOptions { storyKindRegex?: RegExp | string; storyNameRegex?: RegExp | string; framework?: SupportedFramework; - test?: (story: any, context: any, renderTree: RenderTree, options?: any) => any; + test?: StoryshotsTestMethod; renderer?: Function; snapshotSerializers?: jest.SnapshotSerializerPlugin[]; /**