Skip to content

chore(storybook): drop the now-redundant setProjectAnnotations call (Storybook >= 10.3 applies it automatically) #1898

Description

@cliffhall

Discovered while doing #1839 (the vitest/Storybook exact-pin untangle), which moved Storybook 10.2.1910.5.5.

npm run test:storybook now prints, on every run:

Info: Found a setup file with "setProjectAnnotations".
Skipping automatic provisioning of preview annotations to avoid conflicts.
Since Storybook 10.3, "@storybook/addon-vitest" applies these automatically.
You can safely remove the "setProjectAnnotations" call from your setup file,
or remove the file entirely if you don't have custom code there.

clients/web/.storybook/vitest.setup.ts contains nothing but that call:

import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
import { setProjectAnnotations } from "@storybook/react-vite";
import * as projectAnnotations from "./preview";

setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);

So the cleanup is: delete the file and drop setupFiles: [".storybook/vitest.setup.ts"] from the storybook project in clients/web/vite.config.ts.

Why it was not done in #1839

It was left in place deliberately, because a green run does not prove it worked. ./preview carries the Mantine provider decorator and a11yAddonAnnotations drives the a11y assertions inside the play functions. If the addon's automatic provisioning does not in fact pick both of those up, the 462 stories would render without the theme and with a11y checks inert — and would very likely still pass. That is a silent-failure mode, and a dependency-security PR is the wrong place to risk it.

What to do

Remove it, then prove the two things the setup file was providing survived, rather than inferring it from a green suite:

  • Theme decorator — assert a Mantine-provided computed style or CSS variable is present in a rendered story, so an unstyled render fails loudly.
  • a11y annotations — temporarily introduce a real a11y violation in one story and confirm the suite goes red; revert once observed.

If either does not survive, keep the file and instead silence the notice (or track the gap upstream).

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2Issues and PRs for v2

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions