mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-11 00:06:25 +08:00
CsfFile: Improve meta error handling and fix failing test
This commit is contained in:
parent
84f2ae609c
commit
3753cde16c
@ -2408,7 +2408,7 @@ describe('CsfFile', () => {
|
||||
`);
|
||||
});
|
||||
|
||||
it.only('local defineConfig', () => {
|
||||
it('local defineConfig', () => {
|
||||
expect(() =>
|
||||
parse(
|
||||
dedent`
|
||||
|
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user