Skip to content

BREAKING: Migrate nova-react-test-utils to Storybook v9#165

Merged
sjwilczynski merged 9 commits intomicrosoft:mainfrom
sjwilczynski:sjwilczy/storybook9
Mar 9, 2026
Merged

BREAKING: Migrate nova-react-test-utils to Storybook v9#165
sjwilczynski merged 9 commits intomicrosoft:mainfrom
sjwilczynski:sjwilczy/storybook9

Conversation

@sjwilczynski
Copy link
Contributor

@sjwilczynski sjwilczynski commented Jul 7, 2025

Summary

Breaking change for @nova/react-test-utils — requires Storybook ^9.0.0, drops Storybook v8 support.

@nova/react-test-utils changes

  • Peer dependencies updated: storybook and @storybook/react now require ^9.0.0
  • Removed v8 peer dependencies: @storybook/addon-actions, @storybook/preview-api, @storybook/types and their peerDependenciesMeta entries
  • Removed semver dependency — no longer needed since we don't do runtime version detection
  • Removed MakeDecoratorResult type export from shared-utils.ts — decorators now use Decorator<Args> from @storybook/react and ReturnType<typeof makeDecorator>
  • Import paths updated:
    • action imported from storybook/actions (was @storybook/addon-actions)
    • makeDecorator imported from storybook/internal/preview-api (was @storybook/preview-api)
    • StoryContext, Decorator, Args imported from @storybook/react (was @storybook/types PlayFunctionContext<ReactRenderer>)
    • ComposedStoryFn derived as ReturnType<typeof composeStory> (was imported from @storybook/types)

Examples package changes

  • All storybook deps updated to ^9.0.15
  • Removed v8 packages: @storybook/addon-essentials, @storybook/addon-links, @storybook/react, @storybook/test, @storybook/types
  • Added v9 package: @storybook/addon-vitest (replaces @storybook/experimental-addon-test)
  • Import paths updated: @storybook/teststorybook/test, @storybook/react@storybook/react-vite for Meta/Preview types
  • vitest.setup.ts simplified for v9 portable stories API
  • fn() type signatures updated to v9 API: fn<[Error]>()fn<(error: Error) => void>()

Migration guide for consumers

  1. Upgrade to Storybook 9: npm install storybook@^9 @storybook/react@^9
  2. Remove packages no longer needed: @storybook/addon-actions, @storybook/preview-api, @storybook/types
  3. Update test imports: @storybook/teststorybook/test

Test plan

  • yarn build passes
  • yarn types passes
  • yarn test passes (all 4 packages)
  • No remaining references to removed v8 packages

🤖 Generated with Claude Code

sjwilczynski and others added 9 commits July 6, 2025 22:59
- Merge main into storybook9 branch, resolving conflicts
- Remove Storybook v8 compat layer (storybook-compat.ts): drop runtime
  version detection, semver dependency, and dynamic imports
- Use static import of `action` from `storybook/actions` (v9 API)
- Remove `@storybook/addon-actions` and `@storybook/preview-api` peer deps
- Tighten storybook peer deps to `^9.0.0`
- Make `defaultBubble`/`defaultTrigger` synchronous again
- Fix v9 imports in example stories (`storybook/test` instead of `@storybook/test`)
- Regenerate codegen TypeMap to include relay resolver types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The compat layer was only needed for v8/v9 dual support. With v9-only,
import makeDecorator and action directly from storybook packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sjwilczynski sjwilczynski changed the title breaking(nova-react-test-utils): support Storybook 9 BREAKING: Migrate nova-react-test-utils to Storybook v9 Mar 9, 2026
@sjwilczynski sjwilczynski marked this pull request as ready for review March 9, 2026 11:42
@Markionium Markionium requested a review from Copilot March 9, 2026 12:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@sjwilczynski sjwilczynski merged commit 2418a4f into microsoft:main Mar 9, 2026
6 checks passed
@sjwilczynski sjwilczynski deleted the sjwilczy/storybook9 branch March 9, 2026 13:07
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.

3 participants