-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
CSF: Add Storybook test syntax (Storybook v10) #32455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Telemetry: Send index stats on dev exit (cherry picked from commit c5d386f)
…readonly CLI: Fix throwing in readonly environments (cherry picked from commit d87db5c)
Docs: Further improvements (cherry picked from commit 84ea113)
Onboarding: Tweak referral wording in survey (cherry picked from commit 74aa094)
Release: Patch 9.1.1
…st-9-1 Docs: Fix incorrect @next version specifiers
Docs: Add `afterEach` guidance (cherry picked from commit b6edefe)
Docs: Fix broken link in migration guide (cherry picked from commit 8c8bdc5)
Angular: Inherit options from browserTarget (cherry picked from commit b0f9e0d)
…nces Docs: Fix essentials addon references (cherry picked from commit ee184ba)
Addon Docs: Fix Symbol conversion issue in docs page and controls panel (cherry picked from commit fef67c8)
Telemetry: Improve dev cancellation handling (cherry picked from commit a65cd6b)
Angular: Fix `entry.polyfills` undefined error (cherry picked from commit 9f75bbb)
Core: Improve addon detection in automigrations on windows (cherry picked from commit 70fff63)
Next.js: Return mocked router instead of actual router in useRouter (cherry picked from commit f0d9efe)
This was referenced Oct 1, 2025
This was referenced Oct 9, 2025
This was referenced Oct 16, 2025
This was referenced Oct 24, 2025
This was referenced Nov 10, 2025
8 tasks
This was referenced Dec 13, 2025
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.
Closes #32244
What I did
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Follow the documentation here:
https://chromatic-ui.notion.site/Storybook-test-syntax-in-CSF-2566e816203480cb95ddc674ddfbf5d3?pvs=74
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This pull request has been released as version
0.0.0-pr-32455-sha-5e1c0619. Try it out in a new sandbox by runningnpx [email protected] sandboxor in an existing project withnpx [email protected] upgrade.More information
0.0.0-pr-32455-sha-5e1c0619feature/test-syntax-in-csf-sb105e1c06191758701730)To request a new release of this pull request, mention the
@storybookjs/coreteam.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=32455Greptile Summary
Updated On: 2025-09-15 09:49:43 UTC
This PR implements a major new feature for Storybook v10: CSF
.testsyntax that allows developers to write component tests using a familiar, Jasmine-like syntax directly within their story files. The implementation introduces a hierarchical story structure where tests can be attached to stories using astory.test()method (e.g.,Primary.test('should render', () => {})).The feature adds comprehensive infrastructure changes including:
subtypefield distinguishes between regular stories (subtype: 'story') and test entries (subtype: 'test'), withAPI_TestEntryinterface and parent-child relationships viaparentandparentNamefieldscsf-factories.tswith.test()method that creates child stories withtest-fnand!autodocstags, combining parent play functions with test functionstoTestId()with colon separator format (storyId:testName)TestNodecomponent with beaker icons, and enhanced tag filtering with inclusion/exclusion logicdescribe/testblocks and enhanced test utilities for executing individual story testsThe implementation maintains full backward compatibility while enabling a more organized testing workflow where tests are co-located with stories and displayed as expandable groups in the sidebar. Documentation has been updated to reference
@latestinstead of@next, indicating preparation for stable release.Confidence score: 2/5
scripts/tasks/sandbox-parts.ts(duplicate function), URL construction bugs in CLI migration files, and console.log statements in StoryStore.tsSummary by CodeRabbit