Skip to content

feat(storybook): support Storybook 11 - #381

Merged
gregberge merged 1 commit into
mainfrom
feat/storybook-11
Sep 13, 2026
Merged

gregberge merged 1 commit into
mainfrom
feat/storybook-11

Conversation

@gregberge

@gregberge gregberge commented Sep 11, 2026

Copy link
Copy Markdown
Member

Makes @argos-ci/storybook compatible with Storybook 11, checked point by point against the addon migration guide and the 10 → 11 migration notes.

Storybook 11 is only available as 11.0.0-alpha.0 (next tag) today. The package has no manager or preview code, so most of the guide does not apply (no definePreviewAddon, setConfig layout options, TAB addon type, useThemeParameters, icons, or index parsing). What did apply is below.

Changes

  • Peer range. The package never declared storybook as a peer dependency. It now declares ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0-0. 8 is included because the Test Runner flow has no runtime dependency on the storybook package and the docs list Storybook 8+ for it; the Vitest flow needs 9+ (@storybook/addon-vitest and storybook/preview-api only exist from 9). ^11.0.0-0 keeps the 11 pre-releases in range, as @storybook/test-runner does.
  • Viewport parameters. Storybook 9 renamed viewport.viewports to viewport.options and turned the viewport global into { value, isRotated }; Storybook 10 removed defaultViewport. getViewport only understood the legacy shapes, so an Argos mode such as { viewport: "ipad" } silently kept the default size on a current config. It now reads options first and falls back to viewports, accepts string, number and { value, isRotated } globals, and honors rotation (including the legacy defaultOrientation: "landscape"). Unit tests added. The fixture preview moved to options, and the mode screenshots' metadata confirms the sizes (mobile 428×926, tablet 768×1024).
  • CI. New e2e-storybook-next job: upgrades the package to the newest Storybook 11 pre-release (>=11.0.0-0 <12.0.0-0 ranges, so minimumReleaseAge still applies) and runs the Vitest suite under its own build name, mirroring the Vitest 4 compat job. Backed by an e2e-next script and Turborepo task.
  • Dependencies. @storybook/test-runner 0.24.4 → 0.24.5, the first release declaring ^11.0.0-0. When its Jest dependencies are re-resolved (as pnpm up did locally), Jest 30.5 pulls in @parcel/watcher, whose install script pnpm 11 refuses (ERR_PNPM_IGNORED_BUILDS) and fails the install; it is denied in allowBuilds so neither the workspace nor the Storybook 11 job trips on it. Playwright 1.62.1 → 1.63.0 across the three packages so the workspace and the test runner resolve one playwright-core (otherwise tsc fails on two incompatible Page types).
  • README. Short compatibility section.

Verification

Check Storybook 10.5.5 Storybook 11.0.0-alpha.0
build, tsc, lint, unit tests
storybook build
Vitest e2e (15 stories, 28 screenshots)
Test Runner e2e (15 stories, 26 screenshots) ❌ upstream

Every internal the package touches still exists in 11: addons.hasChannel/setChannel, storybook/internal/channels, ComposedStoryFn, the __STORYBOOK_PREVIEW__ and __STORYBOOK_ADDONS_PREVIEW globals, channel.last, the globalsUpdated payload's initialGlobals, and context.story in the Vitest addon.

The Test Runner failure on 11 is not ours: Storybook 11's importModule (used by serverRequire to load .storybook/test-runner.ts) now calls module.register(), which jest-runtime 30 rejects ("module.register() is not supported in Jest") before any Argos code loads. No upstream issue exists yet. The new CI job therefore covers the Vitest flow only, with a comment saying why.

Review notes

  • Behavior change: a story or preview that sets the modern globals.viewport (for example { value: "mobile1" }) is now screenshotted at that size instead of the default. This matches what Storybook renders and how the legacy defaultViewport was already honored, but it can move baselines for users who relied on the global being ignored.
  • Companion docs PR: docs(storybook): document Storybook 9+ parameters and supported versions docs#255.

🤖 Generated with Claude Code

Verified against storybook@11.0.0-alpha.0 following the addon migration
guide (https://storybook.js.org/docs/11/addons/addon-migration-guide).
Every internal the package relies on still exists, and the Vitest suite
passes end to end on 11.

- Declare the `storybook` peer range (8 through 11, including the 11
  pre-releases) as the guide recommends.
- Resolve viewports from the Storybook 9+ `viewport.options` parameter
  and the `{ value, isRotated }` global, keeping the legacy `viewports`
  and `defaultViewport` shapes. Storybook 10 removed `defaultViewport`,
  so modes with viewports silently kept the default size on current
  configs.
- Add an `e2e-storybook-next` CI job that runs the Vitest suite against
  the newest Storybook 11 pre-release. The Test Runner suite is left
  out: Storybook 11's config loader calls `module.register()`, which
  Jest refuses, so `@storybook/test-runner` cannot load its config yet.
- Bump `@storybook/test-runner` to 0.24.5 (first release declaring 11
  support) and align Playwright on 1.63.0 so a single `playwright-core`
  is resolved.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
argos-js-sdk-reference Ready Ready Preview Sep 11, 2026 7:43pm UTC

Request Review

@gregberge
gregberge merged commit f05b974 into main Sep 13, 2026
76 checks passed
@gregberge
gregberge deleted the feat/storybook-11 branch September 13, 2026 11:18
pull Bot pushed a commit to Jimimaku/docs.argos-ci.com that referenced this pull request Sep 13, 2026
Companion to argos-ci/argos-javascript#381, which makes @argos-ci/storybook
resolve viewports from the Storybook 9+ `viewport.options` parameter and the
`{ value, isRotated }` global.

- Story modes guide: viewports and backgrounds are built into Storybook 9+
  and configured through `options` maps, and a mode selects a background by
  key. A hint keeps the Storybook 8 format (`viewports`, `values`, color as
  value) for readers still on 8.
- SDK reference: a Compatibility section (Storybook 8 through 11, Vitest 4
  or 5, Node.js 22) and a Viewports section describing how a mode's or a
  story's `viewport` global is resolved.
- Storybook Quickstart: the Vitest addon requires Storybook 9 or later.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants