Repository navigation
test(storybook): stop calling setProjectAnnotations in the addon-vitest setup file - #397
Merged
Merged
Conversation
…st setup file Storybook 11.0.0-alpha.3 throws SB_ADDON_VITEST_0002 (ProjectAnnotationsAlreadyAppliedError) when a setup file of an `@storybook/addon-vitest` project calls `setProjectAnnotations()`: the addon applies the project annotations itself (it has since 10.3), which broke every story suite of the `e2e-storybook-next` job. - Drop the setup file from the `storybook` Vitest project. - Register `storybook-addon-pseudo-states` in `.storybook/main` so the addon applies its annotations. - Move the setup file to `vitest-sdk/portable-stories.setup.ts`: only the portable stories project still needs the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
e2e-storybook-nextjob fails. The job upgrades to the Storybook 11 pre-release, which now resolves to11.0.0-alpha.3. That version throwsSB_ADDON_VITEST_0002 (ProjectAnnotationsAlreadyAppliedError)when a setup file of an@storybook/addon-vitestproject callssetProjectAnnotations(), so all 6 story suites failed on import.Since Storybook 10.3, addon-vitest applies the project annotations itself:
.storybook/previewplus the previews of the addons registered in.storybook/main. On 10.x the manual call only turned that off; 11 makes it an error. See the Storybook migration note.Changes, all in the e2e setup of
packages/storybook(no SDK code):storybookVitest project no longer has a setup file.storybook-addon-pseudo-statesis registered in.storybook/main, so the addon applies its annotations. Before, they only came in through the setup file.vitest-sdk/portable-stories.setup.ts. Only the portable stories project still uses it, because portable stories need the call.Type of changes
bugChecklist
Optional checks:
Further comments
Checked locally:
main.pnpm upas the CI job): 23/23 pass, with the same screenshots.Expect 2 changed screenshots in the test-runner Argos build:
example-button--primary-hover(light and dark). The pseudo-states addon was never registered for the built Storybook, so the test-runner flow ignored the story'spseudo: { hover: true }and shot a plain button. It now renders hovered, which matches the Vitest flow.examples/storybook-vitest/.storybook/vitest.setup.jsmakes the same call and will hit this error on Storybook 11. It is left for a separate change.🤖 Generated with Claude Code