Skip to content
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

Addon Vitest: Add experimental vitest integration #28768

Merged
merged 204 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 190 commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
6e24da4
Replace experimental_SIDEBAR_BOTTOM API with a core story status filt…
ghengeveld Jul 23, 2024
dd5e342
Merge branch 'next' into sidebar-bottom-filters
yannbf Jul 23, 2024
5a60cf5
Mark experimental_SIDEBAR_BOTTOM as deprecated
ghengeveld Jul 23, 2024
61a0223
Update stories
ghengeveld Jul 23, 2024
04bd79a
Mark experimental_SIDEBAR_TOP as deprecated
ghengeveld Jul 24, 2024
ed560db
Add migration notes for deprecated APIs
ghengeveld Jul 24, 2024
257f53d
Rename story for consistency
ghengeveld Jul 24, 2024
1964c2d
add Vitest integration tests to sandboxes
yannbf Jul 25, 2024
67a6a60
disable most CI checks (revert this commit)
yannbf Jul 25, 2024
8b309e4
skip html related sandboxes
yannbf Jul 25, 2024
eec554a
add svelte plugin
yannbf Jul 25, 2024
834647d
fix sandbox filter
yannbf Jul 25, 2024
8623b92
filter more sandboxes
yannbf Jul 26, 2024
d01d653
fix parallelization
yannbf Jul 26, 2024
ac1a81d
fix paths in sveltekit vitest config
yannbf Jul 26, 2024
f7f076c
add nextjs to vitest sandbox tests
yannbf Jul 29, 2024
ad09c0e
Update story status indicators and tooltips
ghengeveld Jul 29, 2024
1cb605f
Update summary logic
ghengeveld Jul 29, 2024
c5b2538
Update icons and fix some stories
ghengeveld Jul 29, 2024
7a7944a
Merge pull request #28693 from storybookjs/sidebar-bottom-filters
yannbf Jul 30, 2024
9b35a31
Merge branch 'vitest-integration' into sidebar-story-status-tooltips
yannbf Jul 30, 2024
84f5b63
Merge branch 'vitest-integration' into add-vitest-ci-task
yannbf Jul 30, 2024
abe32f6
set up nextjs
yannbf Jul 30, 2024
80b5481
Fix success icon
ghengeveld Jul 30, 2024
b644b1f
fix type usage in renderers
ndelangen Jul 29, 2024
3c6860b
Build: Use !test tag to disable test-runner tests
yannbf Jul 29, 2024
c3ede6b
Write changelog for 8.3.0-alpha.3 [skip ci]
storybook-bot Jul 29, 2024
fb78fc5
Bump version from "8.3.0-alpha.2" to "8.3.0-alpha.3" [skip ci]
storybook-bot Jul 29, 2024
fc6202e
Scaffold addon-vitest skeleton
ghengeveld Jul 29, 2024
39f688d
Setup addon-vitest in internal Storybook
ghengeveld Jul 29, 2024
b82c13a
Some fixes and cleanup
ghengeveld Jul 29, 2024
ac23ae6
Load Vitest results from JUnit report and update story statuses accor…
ghengeveld Jul 30, 2024
fe5a978
Add onClick handler
ghengeveld Jul 30, 2024
edef177
Update @storybook/icons dependency
ghengeveld Jul 30, 2024
1052856
Merge branch 'next' into vitest-integration
yannbf Jul 30, 2024
f3433c6
Merge branch 'vitest-integration' into add-vitest-ci-task
yannbf Jul 30, 2024
bd1d751
update scripts for nextjs
yannbf Jul 31, 2024
ecf1c85
fix
yannbf Jul 31, 2024
8caca19
Merge remote-tracking branch 'origin/next' into add-vitest-ci-task
valentinpalkovic Jul 31, 2024
503de44
Don't mess with the panel position
ghengeveld Jul 31, 2024
8f2c88d
Use internal renderToCanvas method if testingLibaryRender is not spec…
kasperpeulen Jul 31, 2024
afd11a8
Merge branch 'next' into kasper/render-agnostic
kasperpeulen Jul 31, 2024
ca74d8a
Merge remote-tracking branch 'refs/remotes/origin/next' into vitest-i…
kasperpeulen Jul 31, 2024
81b6775
Fix LinkWrapper on TooltipLinkList stories
ghengeveld Jul 31, 2024
d2965c9
Adjust snapshots
kasperpeulen Jul 31, 2024
b672f53
Merge remote-tracking branch 'origin/kasper/render-agnostic' into kas…
kasperpeulen Jul 31, 2024
5631f17
Adjust snapshots
kasperpeulen Jul 31, 2024
aa18abb
Merge branch 'vitest-integration' into add-vitest-ci-task
yannbf Jul 31, 2024
c6ebc2c
Fix hover behavior and search view
ghengeveld Aug 1, 2024
d57f328
Merge pull request #28739 from storybookjs/sidebar-story-status-tooltips
yannbf Aug 1, 2024
c4dbf12
Merge branch 'vitest-integration' into add-vitest-ci-task
yannbf Aug 1, 2024
a076ef1
Revert "disable most CI checks (revert this commit)"
yannbf Aug 1, 2024
ab76bac
pass rsc decorators but not the parameters
yannbf Aug 1, 2024
0841ad2
add remark on vitest file
yannbf Aug 1, 2024
2996b7f
Fix tests
kasperpeulen Aug 1, 2024
64a9fa3
Fix build
kasperpeulen Aug 1, 2024
8b59671
fix
yannbf Aug 1, 2024
d06ab28
Merge branch 'vitest-integration' into addon-vitest
ghengeveld Aug 1, 2024
07babfe
Fix act errors
kasperpeulen Aug 1, 2024
2241c54
yarn.lock
kasperpeulen Aug 1, 2024
87c6223
Merge pull request #28708 from storybookjs/add-vitest-ci-task
yannbf Aug 1, 2024
c62e41d
Merge branch 'vitest-integration' into addon-vitest
yannbf Aug 1, 2024
e30bfcc
Fix tests
kasperpeulen Aug 1, 2024
6289999
Merge remote-tracking branch 'refs/remotes/origin/vitest-integration'…
kasperpeulen Aug 1, 2024
21112bc
set up vitest addon in internal storybook
yannbf Aug 1, 2024
31183db
fix formatting
yannbf Aug 2, 2024
257a945
Allow vitest plugin to use composeStories from preview-api
kasperpeulen Aug 2, 2024
df69ef5
More reliable status reporting
ghengeveld Aug 2, 2024
89e4a1f
Merge branch 'next' into vitest-integration
yannbf Aug 2, 2024
c98e196
Merge branch 'vitest-integration' into addon-vitest
yannbf Aug 2, 2024
81c6a13
rename to experimental
yannbf Aug 2, 2024
072a951
Make it work with the plugin canary release
kasperpeulen Aug 2, 2024
76391dd
Merge remote-tracking branch 'refs/remotes/origin/vitest-integration'…
kasperpeulen Aug 2, 2024
89f3a13
Fix
kasperpeulen Aug 2, 2024
f90d77c
strip out junit logic (for now)
yannbf Aug 2, 2024
feccff5
Fix null pointer
kasperpeulen Aug 2, 2024
e532994
Fix check
kasperpeulen Aug 2, 2024
3f96682
Remove test
kasperpeulen Aug 2, 2024
4300175
wip: add vitest plugin to addon
yannbf Aug 4, 2024
ef94fa3
Merge branch 'next' into vitest-integration
yannbf Aug 5, 2024
0760555
Fix cypress test
kasperpeulen Aug 5, 2024
8fde44d
Fix more singleton issues
kasperpeulen Aug 5, 2024
43c0733
Remove redundant svelteVersion prop (was removed earlier)
kasperpeulen Aug 5, 2024
8f39a19
Remove write issue reminder
kasperpeulen Aug 5, 2024
92deb47
Merge pull request #28766 from storybookjs/kasper/render-agnostic
yannbf Aug 6, 2024
6556d03
setup bundling scripts for the vitest addon
yannbf Aug 6, 2024
52aa6fd
Merge branch 'vitest-integration' into yann/addon-vitest-barebones-wi…
yannbf Aug 6, 2024
385879e
fixes
yannbf Aug 6, 2024
7919ead
fix dependencies
yannbf Aug 6, 2024
f7de2e2
fix import
yannbf Aug 6, 2024
c748186
Merge branch 'next' into vitest-integration
yannbf Aug 6, 2024
632d0e4
Merge branch 'vitest-integration' into yann/addon-vitest-barebones-wi…
yannbf Aug 6, 2024
58dde10
fix version
yannbf Aug 6, 2024
dee15b2
fix types
yannbf Aug 6, 2024
6fd386b
fix check command
yannbf Aug 6, 2024
02d0789
fix type generation
yannbf Aug 6, 2024
17ba6e6
Merge branch 'next' into vitest-integration
yannbf Aug 6, 2024
f66506e
skip failing svelte tests for now
yannbf Aug 6, 2024
a3652bb
Merge branch 'vitest-integration' into yann/addon-vitest-barebones-wi…
yannbf Aug 6, 2024
b1e4f7c
enable browser mode
yannbf Aug 6, 2024
1368aef
fix default annotations from nextjs
yannbf Aug 7, 2024
3e33d2e
add storybook script
yannbf Aug 7, 2024
1b89fe1
use istanbul for coverage instead
yannbf Aug 7, 2024
e9db42a
add playwright to deps list
yannbf Aug 7, 2024
5f4ded2
Merge branch 'vitest-integration' into yann/fix-nextjs-issues
yannbf Aug 7, 2024
0007c42
Merge branch 'vitest-integration' into yann/addon-vitest-barebones-wi…
yannbf Aug 7, 2024
d62a856
use playwright machine for unit tests
yannbf Aug 7, 2024
433bbb5
fix exports order
yannbf Aug 7, 2024
12e0350
remove unnecessary flag from config
yannbf Aug 7, 2024
f4bf860
Merge pull request #28810 from storybookjs/yann/addon-vitest-barebone…
yannbf Aug 7, 2024
2e4b199
fix link mode
yannbf Aug 7, 2024
2ffd0d0
fix vue tests
yannbf Aug 7, 2024
a5ff402
update vue sandbox scripts
yannbf Aug 7, 2024
24e8a73
Merge branch 'vitest-integration' into yann/fix-nextjs-issues
yannbf Aug 7, 2024
e4320b1
Merge pull request #28825 from storybookjs/yann/fix-nextjs-issues
yannbf Aug 7, 2024
633f4b2
Merge branch 'vitest-integration' of github.com:storybookjs/storybook…
yannbf Aug 7, 2024
6d4caba
mock storybook channel in vitest plugin
yannbf Aug 7, 2024
9b4d61c
use vitest tag for filtering
yannbf Aug 7, 2024
d5995e3
Fix beforeAll type
kasperpeulen Aug 7, 2024
42d630e
fix issue with double error message
yannbf Aug 8, 2024
1c2888d
Merge branch 'next' into vitest-integration
yannbf Aug 9, 2024
81281ec
move from esbuild to jiti in vitest package.json
yannbf Aug 9, 2024
e8364db
support autotitle in vitest plugin
yannbf Aug 9, 2024
722e0d5
add error handling when configDir is incorrect
yannbf Aug 9, 2024
9dc93cc
improve storybook dir calculation
yannbf Aug 9, 2024
2a83669
fix
yannbf Aug 9, 2024
9728c77
cleanup
yannbf Aug 9, 2024
72164de
add browser interactivity api experiment
yannbf Aug 9, 2024
f31323d
fix nextjs test
yannbf Aug 9, 2024
40dfa9f
update flaky test
yannbf Aug 9, 2024
bffb920
Merge pull request #28847 from storybookjs/yann/support-autotitle
yannbf Aug 9, 2024
ee56cca
Merge branch 'next' into vitest-integration
yannbf Aug 10, 2024
53232db
add transformer tests
yannbf Aug 10, 2024
b617eb0
Merge remote-tracking branch 'refs/remotes/origin/vitest-integration'…
kasperpeulen Aug 12, 2024
14e18d9
Only set the parameter when the experimentalRSC feature is set
kasperpeulen Aug 12, 2024
4d0744f
Fix filename
kasperpeulen Aug 12, 2024
4c27387
Address feedback
kasperpeulen Aug 12, 2024
d1cb751
Address feedback
kasperpeulen Aug 12, 2024
1bf3c4c
fix lint and check issues
yannbf Aug 12, 2024
527e8ea
Merge remote-tracking branch 'refs/remotes/origin/vitest-integration'…
kasperpeulen Aug 12, 2024
49e7932
Merge branch 'refs/heads/vitest-integration' into kasper/refactor-rsc…
kasperpeulen Aug 12, 2024
f747943
Fix eslint
kasperpeulen Aug 12, 2024
603ea16
Fix eslint
kasperpeulen Aug 12, 2024
898405e
Merge pull request #28864 from storybookjs/beforeall
kasperpeulen Aug 12, 2024
be894e9
Merge pull request #28865 from storybookjs/kasper/refactor-rsc-support
kasperpeulen Aug 12, 2024
7798169
Merge branch 'next' into vitest-integration
yannbf Aug 12, 2024
f82153b
fix merge conflicts
yannbf Aug 12, 2024
e3f73c9
fix nextjs-vite sandbox generation
yannbf Aug 12, 2024
adc1cbb
Merge branch 'next' into vitest-integration
yannbf Aug 13, 2024
8aa5680
fix merge conflict
yannbf Aug 13, 2024
6c6268c
fix lint issue
yannbf Aug 13, 2024
c067329
fix test
yannbf Aug 13, 2024
b40b33e
fix parallelism
yannbf Aug 13, 2024
d3dae46
add vitest tag
yannbf Aug 13, 2024
b860bb5
hopefully fix the nextjs issue
yannbf Aug 13, 2024
e8805dd
first iteration - babel only
yannbf Aug 12, 2024
7ebafe1
wip
yannbf Aug 12, 2024
89b39a8
use csf-tools for transformation
yannbf Aug 12, 2024
0f15aa1
update lockfile
yannbf Aug 12, 2024
567f11f
fix test
yannbf Aug 13, 2024
3930877
move vitest transformation logic to csf-tools
yannbf Aug 13, 2024
c00a80f
reenable browser mode
yannbf Aug 13, 2024
8d0a92a
address review feedback
yannbf Aug 13, 2024
934cefb
readd properties and deprecate them
yannbf Aug 13, 2024
c066b8b
fix type issues
yannbf Aug 13, 2024
3861ac4
Merge pull request #28868 from storybookjs/yann/use-babel-in-transfor…
yannbf Aug 13, 2024
f2a90a9
Fix unit test
kasperpeulen Aug 13, 2024
af8c014
Remove timeout
kasperpeulen Aug 13, 2024
d2bc5fb
only set up optimizedeps for nextjs
yannbf Aug 13, 2024
1dbf820
fix plugin duplication
yannbf Aug 13, 2024
e2d63c5
fix story name
yannbf Aug 13, 2024
f508cc4
fix viewports issue
yannbf Aug 13, 2024
8c580c7
skip channel related tests
yannbf Aug 13, 2024
a687a68
fix autotitle
yannbf Aug 13, 2024
4af500e
fix vitest script (some stories might not have any tests)
yannbf Aug 13, 2024
4759c6a
fix viewports usage
yannbf Aug 13, 2024
f5f4f5a
warn on unconventional story exports
yannbf Aug 13, 2024
4969596
fix build error
yannbf Aug 13, 2024
8693eaf
fix unit test
yannbf Aug 13, 2024
da053e1
skip a few tests, try to fix flake
yannbf Aug 13, 2024
4bf0445
debug hanging nextjs tests
yannbf Aug 13, 2024
eb83b88
fix viewport setting
yannbf Aug 14, 2024
cb99e97
Add comment
kasperpeulen Aug 14, 2024
251d916
extra fixes
yannbf Aug 14, 2024
ba806c1
Merge branch 'vitest-integration' of github.com:storybookjs/storybook…
yannbf Aug 14, 2024
38a154e
Remove comment
kasperpeulen Aug 14, 2024
b48ac41
Clean up
kasperpeulen Aug 14, 2024
a6df95a
Fix lint
kasperpeulen Aug 14, 2024
1df2ab1
Remove BS
kasperpeulen Aug 14, 2024
13c5361
Cleanup
kasperpeulen Aug 14, 2024
45090b2
Add the composedStory to the context
kasperpeulen Aug 14, 2024
020b6c6
address PR feedback
yannbf Aug 14, 2024
67f5678
fix windows unit tests
yannbf Aug 14, 2024
fc07618
fix parallelism and skip more stories
yannbf Aug 14, 2024
f773687
increase test timeout
yannbf Aug 14, 2024
fddd3a5
fix script
yannbf Aug 14, 2024
c12e23e
skip sveltekit tests
yannbf Aug 14, 2024
6cade7d
skip vitest integration in nextjs sandbox
yannbf Aug 14, 2024
659994d
fix typescript issue
yannbf Aug 14, 2024
5f24e86
revamp sandbox setup to move to a workspace file
yannbf Aug 14, 2024
bd51a23
change pool options in sandboxes
yannbf Aug 14, 2024
1896a8c
fix style
yannbf Aug 14, 2024
f7ff019
more fixes
yannbf Aug 14, 2024
416cd00
Yeah... don't look at this
kasperpeulen Aug 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,15 @@ jobs:
name: Run tests
command: |
cd scripts
yarn test --coverage --coverage.all=false
yarn test --coverage
- store_test_results:
path: scripts/junit.xml
- report-workflow-on-failure
- cancel-workflow-on-failure
unit-tests:
executor:
class: xlarge
name: sb_node_22_browsers
name: sb_playwright
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
Expand All @@ -264,7 +264,7 @@ jobs:
name: Test
command: |
cd code
yarn test --coverage --coverage.all=false
yarn test --coverage
- store_test_results:
path: code/junit.xml
- persist_to_workspace:
Expand Down Expand Up @@ -411,6 +411,26 @@ jobs:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner)
- store_test_results:
path: test-results
vitest-integration:
parameters:
parallelism:
type: integer
executor:
class: large
name: sb_playwright
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- attach_workspace:
at: .
- run:
name: Running story tests in Vitest
command: yarn task --task vitest-integration --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task vitest-integration) --no-link --start-from=never --junit
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task vitest-integration)
- store_test_results:
path: test-results
test-runner-dev:
parameters:
parallelism:
Expand Down Expand Up @@ -715,6 +735,10 @@ workflows:
parallelism: 8
requires:
- build-sandboxes
- vitest-integration:
parallelism: 5
requires:
- create-sandboxes
- bench:
parallelism: 5
requires:
Expand Down Expand Up @@ -777,6 +801,10 @@ workflows:
parallelism: 14
requires:
- build-sandboxes
- vitest-integration:
parallelism: 5
requires:
- create-sandboxes
- test-portable-stories:
requires:
- build
Expand Down Expand Up @@ -840,6 +868,10 @@ workflows:
parallelism: 33
requires:
- build-sandboxes
- vitest-integration:
parallelism: 13
requires:
- create-sandboxes
- test-portable-stories:
requires:
- build
Expand Down
39 changes: 23 additions & 16 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<h1>Migration</h1>

- [From version 8.2.x to 8.3.x](#from-version-82x-to-83x)
- [Removed `experimental_SIDEBAR_BOTTOM` and deprecated `experimental_SIDEBAR_TOP` addon types](#removed-experimental_sidebar_bottom-and-deprecated-experimental_sidebar_top-addon-types)
- [New parameters format for addon backgrounds](#new-parameters-format-for-addon-backgrounds)
- [New parameters format for addon viewport](#new-parameters-format-for-addon-viewport)
- [From version 8.1.x to 8.2.x](#from-version-81x-to-82x)
Expand Down Expand Up @@ -104,17 +105,17 @@
- [Tab addons cannot manually route, Tool addons can filter their visibility via tabId](#tab-addons-cannot-manually-route-tool-addons-can-filter-their-visibility-via-tabid)
- [Removed `config` preset](#removed-config-preset-1)
- [From version 7.5.0 to 7.6.0](#from-version-750-to-760)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
- [typescript.skipBabel deprecated](#typescriptskipbabel-deprecated)
- [Primary doc block accepts of prop](#primary-doc-block-accepts-of-prop)
- [Addons no longer need a peer dependency on React](#addons-no-longer-need-a-peer-dependency-on-react)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
- [typescript.skipBabel deprecated](#typescriptskipbabel-deprecated)
- [Primary doc block accepts of prop](#primary-doc-block-accepts-of-prop)
- [Addons no longer need a peer dependency on React](#addons-no-longer-need-a-peer-dependency-on-react)
- [From version 7.4.0 to 7.5.0](#from-version-740-to-750)
- [`storyStoreV6` and `storiesOf` is deprecated](#storystorev6-and-storiesof-is-deprecated)
- [`storyIndexers` is replaced with `experimental_indexers`](#storyindexers-is-replaced-with-experimental_indexers)
- [`storyStoreV6` and `storiesOf` is deprecated](#storystorev6-and-storiesof-is-deprecated)
- [`storyIndexers` is replaced with `experimental_indexers`](#storyindexers-is-replaced-with-experimental_indexers)
- [From version 7.0.0 to 7.2.0](#from-version-700-to-720)
- [Addon API is more type-strict](#addon-api-is-more-type-strict)
- [Addon-controls hideNoControlsWarning parameter is deprecated](#addon-controls-hidenocontrolswarning-parameter-is-deprecated)
- [Addon API is more type-strict](#addon-api-is-more-type-strict)
- [Addon-controls hideNoControlsWarning parameter is deprecated](#addon-controls-hidenocontrolswarning-parameter-is-deprecated)
- [From version 6.5.x to 7.0.0](#from-version-65x-to-700)
- [7.0 breaking changes](#70-breaking-changes)
- [Dropped support for Node 15 and below](#dropped-support-for-node-15-and-below)
Expand All @@ -140,7 +141,7 @@
- [Deploying build artifacts](#deploying-build-artifacts)
- [Dropped support for file URLs](#dropped-support-for-file-urls)
- [Serving with nginx](#serving-with-nginx)
- [Ignore story files from node\_modules](#ignore-story-files-from-node_modules)
- [Ignore story files from node_modules](#ignore-story-files-from-node_modules)
- [7.0 Core changes](#70-core-changes)
- [7.0 feature flags removed](#70-feature-flags-removed)
- [Story context is prepared before for supporting fine grained updates](#story-context-is-prepared-before-for-supporting-fine-grained-updates)
Expand All @@ -154,7 +155,7 @@
- [Addon-interactions: Interactions debugger is now default](#addon-interactions-interactions-debugger-is-now-default)
- [7.0 Vite changes](#70-vite-changes)
- [Vite builder uses Vite config automatically](#vite-builder-uses-vite-config-automatically)
- [Vite cache moved to node\_modules/.cache/.vite-storybook](#vite-cache-moved-to-node_modulescachevite-storybook)
- [Vite cache moved to node_modules/.cache/.vite-storybook](#vite-cache-moved-to-node_modulescachevite-storybook)
- [7.0 Webpack changes](#70-webpack-changes)
- [Webpack4 support discontinued](#webpack4-support-discontinued)
- [Babel mode v7 exclusively](#babel-mode-v7-exclusively)
Expand Down Expand Up @@ -204,7 +205,7 @@
- [Dropped addon-docs manual babel configuration](#dropped-addon-docs-manual-babel-configuration)
- [Dropped addon-docs manual configuration](#dropped-addon-docs-manual-configuration)
- [Autoplay in docs](#autoplay-in-docs)
- [Removed STORYBOOK\_REACT\_CLASSES global](#removed-storybook_react_classes-global)
- [Removed STORYBOOK_REACT_CLASSES global](#removed-storybook_react_classes-global)
- [7.0 Deprecations and default changes](#70-deprecations-and-default-changes)
- [storyStoreV7 enabled by default](#storystorev7-enabled-by-default)
- [`Story` type deprecated](#story-type-deprecated)
Expand Down Expand Up @@ -419,6 +420,12 @@

## From version 8.2.x to 8.3.x

### Removed `experimental_SIDEBAR_BOTTOM` and deprecated `experimental_SIDEBAR_TOP` addon types

The experimental SIDEBAR_BOTTOM addon type was removed in favor of a built-in filter UI. The enum type definition will remain available until Storybook 9.0 but will be ignored. Similarly the experimental SIDEBAR_TOP addon type is deprecated and will be removed in a future version.

These APIs allowed addons to render arbitrary content in the Storybook sidebar. Due to potential conflicts between addons and challenges regarding styling, these APIs are/will be removed. In the future, Storybook will provide declarative API hooks to allow addons to add content to the sidebar without risk of conflicts or UI inconsistencies. One such API is `experimental_updateStatus` which allow addons to set a status for stories. The SIDEBAR_BOTTOM slot is now used to allow filtering stories with a given status.
Comment on lines +423 to +427
Copy link
Contributor

Choose a reason for hiding this comment

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

check: Consider providing examples or more detailed guidance on how to migrate from the deprecated experimental_SIDEBAR_TOP and removed experimental_SIDEBAR_BOTTOM addon types.


### New parameters format for addon backgrounds

The `addon-backgrounds` addon now uses a new format for parameters. The `backgrounds` parameter is now an object with a `values` key that contains the background values.
Expand Down Expand Up @@ -448,7 +455,7 @@ Setting an override value should now be done via a `globals` property on your co
export default {
component: Button,
globals: {
backgrounds: { value: 'twitter' },
backgrounds: { value: "twitter" },
},
};
```
Expand Down Expand Up @@ -494,7 +501,7 @@ Setting an override value should now be done via a `globals` property on your co
export default {
component: Button,
globals: {
viewport: { value: 'phone' },
viewport: { value: "phone" },
},
};
```
Expand Down Expand Up @@ -2411,8 +2418,8 @@ export default config;

#### Vite builder uses Vite config automatically

When using a [Vite-based framework](#framework-field-mandatory), Storybook will automatically use your `vite.config.(ctm)js` config file starting in 7.0.
Some settings will be overridden by Storybook so that it can function properly, and the merged settings can be modified using `viteFinal` in `.storybook/main.js` (see the [Storybook Vite configuration docs](https://storybook.js.org/docs/react/builders/vite#configuration)).
When using a [Vite-based framework](#framework-field-mandatory), Storybook will automatically use your `vite.config.(ctm)js` config file starting in 7.0.
Some settings will be overridden by Storybook so that it can function properly, and the merged settings can be modified using `viteFinal` in `.storybook/main.js` (see the [Storybook Vite configuration docs](https://storybook.js.org/docs/react/builders/vite#configuration)).
If you were using `viteFinal` in 6.5 to simply merge in your project's standard Vite config, you can now remove it.

For Svelte projects this means that the `svelteOptions` property in the `main.js` config should be omitted, as it will be loaded automatically via the project's `vite.config.js`.
Expand Down
3 changes: 2 additions & 1 deletion code/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.nx/cache
.nx/cache
.vite-inspect
1 change: 1 addition & 0 deletions code/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const config: StorybookConfig = {
'@storybook/addon-interactions',
'@storybook/addon-storysource',
'@storybook/addon-designs',
'@storybook/experimental-addon-vitest',
'@storybook/addon-a11y',
'@chromatic-com/storybook',
],
Expand Down
5 changes: 3 additions & 2 deletions code/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Fragment, useEffect } from 'react';
import * as React from 'react';
import { Fragment, useEffect } from 'react';

import type { Channel } from 'storybook/internal/channels';
import { DocsContext as DocsContextProps, useArgs } from 'storybook/internal/preview-api';
Expand Down Expand Up @@ -160,7 +161,7 @@ export const loaders = [
}
return { docsContext };
},
];
] as Loader[];

export const decorators = [
// This decorator adds the DocsContext created in the loader above
Expand Down
38 changes: 38 additions & 0 deletions code/.storybook/storybook.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { beforeAll, vi, expect as vitestExpect } from 'vitest';

import { setProjectAnnotations } from '@storybook/react';
import { userEvent as storybookEvent, expect as storybookExpect } from '@storybook/test';

import * as coreAnnotations from '../addons/toolbars/template/stories/preview';
import * as componentAnnotations from '../core/template/stories/preview';
// register global components used in many stories
import '../renderers/react/template/components';
import * as projectAnnotations from './preview';

vi.spyOn(console, 'warn').mockImplementation((...args) => console.log(...args));

const annotations = setProjectAnnotations([
// @ts-expect-error check type errors later
projectAnnotations,
// @ts-expect-error check type errors later
componentAnnotations,
coreAnnotations,
{
// experiment with injecting Vitest's interactivity API over our userEvent while tests run in browser mode
// https://vitest.dev/guide/browser/interactivity-api.html
loaders: async (context) => {
// eslint-disable-next-line no-underscore-dangle
if (globalThis.__vitest_browser__) {
const vitest = await import('@vitest/browser/context');
const { userEvent: browserEvent } = vitest;
context.userEvent = browserEvent.setup();
context.expect = vitestExpect;
} else {
context.userEvent = storybookEvent.setup();
context.expect = storybookExpect;
}
},
},
]);

beforeAll(annotations.beforeAll);
56 changes: 56 additions & 0 deletions code/.storybook/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { defaultExclude, defineProject, mergeConfig } from 'vitest/config';

import Inspect from 'vite-plugin-inspect';

import { vitestCommonConfig } from '../vitest.workspace';

const extraPlugins: any[] = [];
if (process.env.INSPECT === 'true') {
// this plugin assists in inspecting the Storybook Vitest plugin's transformation and sourcemaps
extraPlugins.push(
Inspect({
outputDir: '../.vite-inspect',
build: true,
open: true,
include: ['**/*.stories.*'],
})
);
}

export default mergeConfig(
vitestCommonConfig,
defineProject({
plugins: [
import('@storybook/experimental-addon-vitest/plugin').then(({ storybookTest }) =>
storybookTest({
configDir: process.cwd(),
})
),
...extraPlugins,
],
test: {
name: 'storybook-ui',
include: [
// TODO: test all core and addon stories later
// './core/**/components/**/*.{story,stories}.?(c|m)[jt]s?(x)',
'../addons/interactions/src/**/*.{story,stories}.?(c|m)[jt]s?(x)',
],
exclude: [
...defaultExclude,
'../node_modules/**',
'**/__mockdata__/**',
// expected to fail in Vitest because of fetching /iframe.html to cause ECONNREFUSED
'**/Zoom.stories.tsx',
],
browser: {
enabled: true,
name: 'chromium',
provider: 'playwright',
headless: true,
screenshotFailures: false,
},
setupFiles: ['./storybook.setup.ts'],
environment: 'happy-dom',
},
})
);
2 changes: 1 addition & 1 deletion code/addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
"devDependencies": {
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.5",
"@storybook/icons": "^1.2.10",
"@testing-library/react": "^14.0.0",
"lodash": "^4.17.21",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@storybook/icons": "^1.2.5",
"@storybook/icons": "^1.2.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.3.2"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"devDependencies": {
"@storybook/blocks": "workspace:*",
"@storybook/icons": "^1.2.5",
"@storybook/icons": "^1.2.10",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { global as globalThis } from '@storybook/global';

export default {
component: globalThis.Components.Button,
tags: ['autodocs', '!test'],
tags: ['autodocs', '!test', '!vitest'],
args: { label: 'Click Me!' },
parameters: { chromatic: { disable: true } },
};
Expand Down
4 changes: 3 additions & 1 deletion code/addons/interactions/template/stories/basics.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const WithLoaders = {
},
};

export const UserEventSetup = {
const UserEventSetup = {
play: async (context) => {
const { args, canvasElement, step } = context;
const user = userEvent.setup();
Expand All @@ -123,3 +123,5 @@ export const UserEventSetup = {
});
},
};

export { UserEventSetup };
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
actions: { argTypesRegex: '^on[A-Z].*' },
chromatic: { disable: true },
},
tags: ['!test'],
tags: ['!test', '!vitest'],
};

export const Default = {
Expand Down
2 changes: 1 addition & 1 deletion code/addons/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"upath": "^2.0.1"
},
"devDependencies": {
"@storybook/icons": "^1.2.5",
"@storybook/icons": "^1.2.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-resize-detector": "^7.1.2",
Expand Down
2 changes: 1 addition & 1 deletion code/addons/measure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"tiny-invariant": "^1.3.1"
},
"devDependencies": {
"@storybook/icons": "^1.2.5",
"@storybook/icons": "^1.2.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.3.2"
Expand Down
Loading
Loading