feat(vitest): rework story naming logic#364
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 8e8ef7b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ff8731b to
354a0b5
Compare
commit: |
75d6c30 to
53e4f53
Compare
f6ac079 to
176f38e
Compare
AriPerkkio
commented
May 26, 2026
Comment on lines
+19
to
+32
| describe('', () => { | ||
| configure({ title: 'Components/Button', disableAutoSnapshot: false }); | ||
|
|
||
| beforeEach(() => { | ||
| document.body.innerHTML = '<button>Example</button>'; | ||
| }); | ||
|
|
||
| test('Primary', () => {}); | ||
| test('Secondary', () => {}); | ||
| test('Hovered', () => {}); | ||
| test('Pressed', () => {}); | ||
| test('Focused', () => {}); | ||
| test('Disabled', () => {}); | ||
| }); |
43e04b6 to
a21854e
Compare
674216f to
015e474
Compare
015e474 to
8e8ef7b
Compare
valentinpalkovic
approved these changes
Jun 1, 2026
This was referenced Jun 2, 2026
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
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.


Issue: Milestone 1 of #353
See Chromatic projects with this PR changes:
main/@chromatic-com/vitest@0.0.8)This PR introduces temporary solution for story naming issue. However changes of this PR will never be reverted - the
titleandstories[].nameneed to remain stable. We'll introduce proper long-term fix in #376 using other fields in the story JSON.What Changed
"title"of a*.stories.jsonis now just the file name, e.g.src/components/accordion/accordion.test.tsx. Previously it also contained(optional test suite) / (test case).{ - "title": "accordion/opens and closes", + "title": "accordion", "stories": [ { - "name": "default", + "name": "opens and closes / default", "globals": { ... }, "parameters": {...} }, { - "name": "open", + "name": "opens and closes / open", "globals": { ... }, "parameters": {...} }, { - "name": "close", + "name": "opens and closes / close", "globals": { ... }, "parameters": {...} } ] }Also adds new
titleoption inconfigure()API, that can be used to set completely custom title in the story. This is similar as Storybook'smeta.componentproperty.This is especially useful in following cases:
test/sign-in/Page.test.tsxtest/sign-out/Page.test.tsxconfigure({ title })How to test
yarn install; yarn build; yarn test:vitest; yarn archive-storybook:vitest