diff --git a/packages/storybook/src/utils/utilities.spec.ts b/packages/storybook/src/utils/utilities.spec.ts index 3bd6ea908dac8..3a4ca203c55bf 100644 --- a/packages/storybook/src/utils/utilities.spec.ts +++ b/packages/storybook/src/utils/utilities.spec.ts @@ -88,6 +88,24 @@ describe('testing utilities', () => { ` ); + appTree.write( + `test-ui-lib/src/lib/button/button.other.stories.ts`, + ` + import type { Meta } from '@storybook/react'; + import { Button } from './button'; + + const Story: Meta = { + component: Button, + title: 'Layout/Texts/Button', + }; + export default Story; + + export const Primary = { + args: {}, + }; + ` + ); + appTree.write( `test-ui-lib/src/lib/button/button.component.other.ts`, ` @@ -155,6 +173,14 @@ describe('testing utilities', () => { expect(fileIsStory).toBeTruthy(); }); + it('should verify it is story when using Meta', () => { + const fileIsStory = isTheFileAStory( + appTree, + 'test-ui-lib/src/lib/button/button.other.stories.ts' + ); + expect(fileIsStory).toBeTruthy(); + }); + it('should verify it is story for ReactNative', () => { const fileIsStory = isTheFileAStory( appTree, diff --git a/packages/storybook/src/utils/utilities.ts b/packages/storybook/src/utils/utilities.ts index 05f1d0eb2715a..7846997dcf090 100644 --- a/packages/storybook/src/utils/utilities.ts +++ b/packages/storybook/src/utils/utilities.ts @@ -221,6 +221,7 @@ export function isTheFileAStory(tree: Tree, path: string): boolean { importSpecifiers.forEach((importSpecifier: ts.ImportSpecifier) => { if ( importSpecifier.getText() === 'Story' || + importSpecifier.getText() === 'Meta' || importSpecifier.getText() === 'storiesOf' || importSpecifier.getText() === 'ComponentStory' ) {