feat(examples): migrate to examples to Storybook test addon#150
Merged
sjwilczynski merged 27 commits intomicrosoft:mainfrom Apr 8, 2025
Merged
feat(examples): migrate to examples to Storybook test addon#150sjwilczynski merged 27 commits intomicrosoft:mainfrom
sjwilczynski merged 27 commits intomicrosoft:mainfrom
Conversation
…to sjwilczy/testAddon
…to sjwilczy/testAddon
…to sjwilczy/testAddon
Contributor
Author
|
Check source maps. Update: @alloy I checked and they behave fine: |
alloy
approved these changes
Apr 8, 2025
Member
alloy
left a comment
There was a problem hiding this comment.
Other than the request to check if source-maps are working correctly, this looks great!
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.

The initial plan for Storybook folks to make stories behave as tests, was using @storybook/test-runner. As useful as it was, the fact that it used jest as orchestrator made things slower than they should be. On top of that the current default for Storybook + React is to use vite instead of webpack just because of perf gains. No surprise then that to make the vite integration even more simplest, they wanted to integrate with vitest, their test runner. Their result of that integration is test addon. Even tough it is marked as experimental, Storybook folks already announced this as future of their testing workflow. Check how nicely it integrates both with command line and UI:
You can run your stories as tests both from UI and from command line without any issues with awesome DX provided by vitest which is significantly faster than jest.
1JS is still on Storybook 7 so might be a bit harder to use it like that there but other repos have the benefit of being able to use latest greatest and (looking at you @kerrynf ) I would recommend start to experiment with it there.
This allows us to migrate majority of jest tests directly into Storybook, only left the ones that really verify something in jest environment. Part of this PR is extracted to #151 for easier review