diff --git a/code/core/src/csf-tools/CsfFile.test.ts b/code/core/src/csf-tools/CsfFile.test.ts index abb22209a619..639e1a6dbfc6 100644 --- a/code/core/src/csf-tools/CsfFile.test.ts +++ b/code/core/src/csf-tools/CsfFile.test.ts @@ -2408,7 +2408,7 @@ describe('CsfFile', () => { `); }); - it.only('local defineConfig', () => { + it('local defineConfig', () => { expect(() => parse( dedent` diff --git a/code/core/src/csf-tools/CsfFile.ts b/code/core/src/csf-tools/CsfFile.ts index bd963f86aa46..d7ed7fe8eeb9 100644 --- a/code/core/src/csf-tools/CsfFile.ts +++ b/code/core/src/csf-tools/CsfFile.ts @@ -521,11 +521,19 @@ export class CsfFile { self._options.fileName ); } else if (!self._metaIsFactory && storyIsFactory) { - throw new BadMetaError( - 'meta() factory must be imported from .storybook/preview configuration', - storyNode as t.Node, - self._options.fileName - ); + if (self._metaNode) { + throw new MixedFactoryError( + 'expected non-factory story', + storyNode as t.Node, + self._options.fileName + ); + } else { + throw new BadMetaError( + 'meta() factory must be imported from .storybook/preview configuration', + storyNode as t.Node, + self._options.fileName + ); + } } const parameters: { [key: string]: any } = {}; if (t.isObjectExpression(storyNode)) {