-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Vitest plugin: Fix renamed export stories #29250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
☁️ Nx Cloud ReportCI is running/has finished running commands for commit d23542f. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Changes look good, but I found a bug in CsfFile (which could be done in a separate PR) where the story names are not handled in reexported consts like so:
const B = () => {}
B.storyName = 'Custom name B'
const C = {
name: 'Custom name C'
}
// story name is still B and D, should be "Custom name ..." for each story
export { B, C as D }
…ed-exports Vitest plugin: Fix renamed export stories (cherry picked from commit ed00bc5)
…ed-exports Vitest plugin: Fix renamed export stories (cherry picked from commit ed00bc5)
Closes #29244
What I did
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
In a sandbox, create a story that uses a renamed export and verify that the Vitest test succeeds. (I did not test!)
🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>
Greptile Summary
This PR adds support for renamed exports in the Storybook Vitest plugin, addressing issue #29244.
localName
property toStaticStory
interface inCsfFile.ts
to store original variable namestransformer.ts
to uselocalName
when generating test statements for renamed exportsCsfFile.test.ts
to include tests for the newlocalName
propertytransformer.test.ts
to verify handling of renamed exported stories