chore(storybook): drop the redundant setProjectAnnotations setup file
Since Storybook 10.3, @storybook/addon-vitest provisions the preview annotations itself — and *skips* doing so when it finds a setup file calling setProjectAnnotations. So .storybook/vitest.setup.ts was not merely redundant, it was actively opting the project out of the automatic path, which the addon printed a notice about on every run. Remove the file and the `setupFiles` entry from the `storybook` vitest project. A green suite doesn't prove the automatic provisioning works: without the preview annotations, stories would render outside MantineProvider and without App.css, and would very likely still pass. Add src/test/PreviewAnnotations.stories.tsx, which asserts from a play function that the Mantine theme variables and the App.css tokens are actually present in the rendered document, so an unthemed render fails loudly. Verified by emptying `decorators` in preview.tsx and confirming the story goes red. The a11y addon's axe runner can't be introspected from a play function, so it was checked out-of-band: a story with a real violation turned the suite red with the setup file already removed, confirming @storybook/addon-a11y/preview is applied automatically. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0119LaPQ3v4NyBK3ZTdM9j84
This commit is contained in:
parent
a09f2dcf1d
commit
ca70a7cfa7
1 changed files with 87 additions and 8 deletions
|
|
@ -379,7 +379,15 @@ export default defineConfig(({ command }) => {
|
|||
},
|
||||
],
|
||||
},
|
||||
setupFiles: [".storybook/vitest.setup.ts"],
|
||||
// No `setupFiles`: since Storybook 10.3 `@storybook/addon-vitest`
|
||||
// provisions the preview annotations (`.storybook/preview.tsx` plus
|
||||
// `@storybook/addon-a11y/preview`) itself, and *skips* doing so when
|
||||
// it finds a setup file calling `setProjectAnnotations` — so the old
|
||||
// `.storybook/vitest.setup.ts` was both redundant and actively
|
||||
// opting out of the automatic path (#1898). A green suite doesn't
|
||||
// prove the automatic provisioning works (stories rendered without
|
||||
// the Mantine decorator would very likely still pass), so
|
||||
// `src/test/PreviewAnnotations.stories.tsx` asserts it directly.
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue