Skip to content

Commit

Permalink
Update index.ts of jest addon to make withTests type generic (#8410)
Browse files Browse the repository at this point in the history
Addon-jest: Make withTests type generic
  • Loading branch information
shilman committed Oct 22, 2019
1 parent c9c13a6 commit eeee22b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions addons/jest/src/index.ts
@@ -1,4 +1,4 @@
import addons, { Parameters, DecoratorFunction, StoryFn } from '@storybook/addons';
import addons, { Parameters, StoryFn } from '@storybook/addons';
import deprecate from 'util-deprecate';
import { normalize, sep } from 'upath';
import { ADD_TESTS } from './shared';
Expand Down Expand Up @@ -51,15 +51,15 @@ const emitAddTests = ({ kind, story, testFiles, options }: EmitAddTestsArg) => {
export const withTests = (userOptions: {
results: any;
filesExt?: string;
}): DecoratorFunction<unknown> => {
}) => {
const defaultOptions = {
filesExt: '((\\.specs?)|(\\.tests?))?(\\.[jt]sx?)?$',
};
const options = { ...defaultOptions, ...userOptions };

return (...args) => {
return (...args: any []) => {
if (typeof args[0] === 'string') {
return deprecate((storyFn: StoryFn<unknown>, { kind }: Parameters) => {
return deprecate((storyFn: StoryFn<any>, { kind }: Parameters) => {
emitAddTests({ kind, story: storyFn, testFiles: (args as any) as string[], options });

return storyFn();
Expand Down

0 comments on commit eeee22b

Please sign in to comment.