Skip to content

CSF Next: Propagate skip tags to .test children#34964

Merged
Sidnioulz merged 1 commit into
storybookjs:nextfrom
kwonoj:fix-test-factory-tags
May 29, 2026
Merged

CSF Next: Propagate skip tags to .test children#34964
Sidnioulz merged 1 commit into
storybookjs:nextfrom
kwonoj:fix-test-factory-tags

Conversation

@kwonoj
Copy link
Copy Markdown
Contributor

@kwonoj kwonoj commented May 28, 2026

Closes #34962

What I did

This PR is an attempt to close #34962, allow to propagate skip tags to the test() story child with csf factories. Original issue explains current behavior - tags are not currently passed through.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

ø

Manual testing

  1. Clone repro
  2. Install with NPM and then swap Sb for canary version
  3. Run npm run test-storybook

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make 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-34964-sha-e5a2e62a. Try it out in a new sandbox by running npx storybook@0.0.0-pr-34964-sha-e5a2e62a sandbox or in an existing project with npx storybook@0.0.0-pr-34964-sha-e5a2e62a upgrade.

More information
Published version 0.0.0-pr-34964-sha-e5a2e62a
Triggered by @Sidnioulz
Repository kwonoj/storybook
Branch fix-test-factory-tags
Commit e5a2e62a
Datetime Fri May 29 10:22:56 UTC 2026 (1780050176)
Workflow run 26631901616

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=34964

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed skip tags not being properly forwarded to child story tests, ensuring consistent filtering behavior across all generated test cases.
  • Tests

    • Added test coverage for skip tags propagation with child tests in both standard and factory-based story patterns.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a798b3d1-7cdc-43ed-a7dd-072b352fc089

📥 Commits

Reviewing files that changed from the base of the PR and between 62e3fc2 and e5a2e62.

📒 Files selected for processing (2)
  • code/core/src/csf-tools/vitest-plugin/transformer.test.ts
  • code/core/src/csf-tools/vitest-plugin/transformer.ts

📝 Walkthrough

Walkthrough

The PR propagates tagsFilter.skip to child .test() calls on stories, not just top-level story tests. A single-line change in getDescribeStatementForStory uses the configured skipTagsId instead of an empty array. Two new test cases verify this behavior for both traditional CSF and CSF Factory patterns, checking generated describe/test wrapping and correct tag forwarding.

Changes

Skip-tag propagation to child tests

Layer / File(s) Summary
Core implementation: skipTags propagation
code/core/src/csf-tools/vitest-plugin/transformer.ts
getDescribeStatementForStory now passes skipTagsId (derived from tagsFilter.skip) to each testStory options object instead of an empty array, ensuring child tests respect skip-tag configuration.
Test coverage for child test skip-tag propagation
code/core/src/csf-tools/vitest-plugin/transformer.test.ts
Two new snapshot test cases verify propagation of skipTags to child .test() calls for both CSF v1/v2/v3-style stories and CSF Factory patterns, asserting correct _describe wrapping, _test emissions, and distinct storyId/testName values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sidnioulz Sidnioulz changed the title fix(csf): propagate skip tags to .test children CSF Next: Propagate skip tags to .test children May 29, 2026
@Sidnioulz Sidnioulz self-assigned this May 29, 2026
@Sidnioulz Sidnioulz requested review from Sidnioulz and yannbf May 29, 2026 09:27
@Sidnioulz Sidnioulz moved this to Empathy Backlog in Core Team Projects May 29, 2026
@storybook-app-bot
Copy link
Copy Markdown

Package Benchmarks

Commit: e5a2e62, ran on 29 May 2026 at 09:45:48 UTC

The following packages have significant changes to their size or dependencies:

storybook

Before After Difference
Dependency count 72 72 0
Self size 20.38 MB 20.31 MB 🎉 -71 KB 🎉
Dependency size 36.11 MB 36.11 MB 0 B
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 203 203 0
Self size 908 KB 908 KB 🎉 -144 B 🎉
Dependency size 88.57 MB 88.50 MB 🎉 -71 KB 🎉
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 196 196 0
Self size 32 KB 32 KB 🚨 +36 B 🚨
Dependency size 87.06 MB 86.99 MB 🎉 -71 KB 🎉
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 73 73 0
Self size 1.08 MB 1.08 MB 🎉 -66 B 🎉
Dependency size 56.49 MB 56.42 MB 🎉 -71 KB 🎉
Bundle Size Analyzer node node

Copy link
Copy Markdown
Contributor

@Sidnioulz Sidnioulz left a comment

Choose a reason for hiding this comment

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

Tested with canary, fixes the bug. Handing over to @yannbf.

@Sidnioulz Sidnioulz merged commit d6ce689 into storybookjs:next May 29, 2026
139 of 149 checks passed
@github-project-automation github-project-automation Bot moved this from Empathy Backlog to Done in Core Team Projects May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: skip tags on CSF Next .test() children are ignored

2 participants