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 Test: Support Vitest 3 browser.test.instances field #30309

Merged
merged 10 commits into from
Jan 22, 2025

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Jan 20, 2025

Closes #30299
Closes #30308
Closes #30363

What I did

When creating a vitest.workspace or vitest.config file for the user upon @storybook/experimental-addon-test initialization, we will correctly set a Vitest 3 compatible configuration if we detect that the user is using Vitest 3.

Checklist for Contributors

Testing

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

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

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

More information
Published version 0.0.0-pr-30309-sha-d2c3d566
Triggered by @valentinpalkovic
Repository storybookjs/storybook
Branch valentin/introduce-instances-vitest-3
Commit d2c3d566
Datetime Wed Jan 22 13:39:55 UTC 2025 (1737553195)
Workflow run 12909468903

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 canary-release-pr.yml --field pr=30309

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.9 MB 77.9 MB 0 B 1.32 0%
initSize 131 MB 131 MB 0 B 1.45 0%
diffSize 53 MB 53 MB 0 B 1.51 0%
buildSize 7.19 MB 7.19 MB 0 B 1 0%
buildSbAddonsSize 1.85 MB 1.85 MB 0 B -1 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.87 MB 1.87 MB 0 B 1 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.91 MB 3.91 MB 0 B 1 0%
buildPreviewSize 3.28 MB 3.28 MB 0 B 1 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 6.8s 22s 15.1s 1.37 🔺68.8%
generateTime 20.5s 22.2s 1.6s 0.67 7.4%
initTime 16.7s 15.2s -1s -463ms 0.57 -9.6%
buildTime 9.1s 10.7s 1.6s 0.9 14.9%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 4.3s 5.1s 867ms 0.68 16.7%
devManagerResponsive 3.3s 3.6s 332ms 0.48 9.1%
devManagerHeaderVisible 489ms 594ms 105ms 0.22 17.7%
devManagerIndexVisible 494ms 625ms 131ms 0.19 21%
devStoryVisibleUncached 1.7s 1.9s 197ms 0.2 10.1%
devStoryVisible 552ms 631ms 79ms 0.19 12.5%
devAutodocsVisible 431ms 524ms 93ms 0.32 17.7%
devMDXVisible 431ms 492ms 61ms -0.54 12.4%
buildManagerHeaderVisible 509ms 583ms 74ms 0.44 12.7%
buildManagerIndexVisible 601ms 670ms 69ms 0.37 10.3%
buildStoryVisible 499ms 563ms 64ms 0.35 11.4%
buildAutodocsVisible 383ms 468ms 85ms 0.07 18.2%
buildMDXVisible 382ms 429ms 47ms -0.33 11%

Greptile Summary

Based on the provided information, I'll create a concise summary of the changes in this PR:

Updates Storybook's test addon to support Vitest 3's new browser configuration format, replacing the deprecated browser.name with browser.instances array.

  • Modified code/addons/test/src/postinstall.ts to detect Vitest version and generate appropriate browser configuration
  • Updated code/.storybook/vitest.config.ts to use browser.instances array for Vitest 3 compatibility
  • Updated test-storybooks/portable-stories-kitchen-sink/react/vitest.workspace.ts to align with new Vitest 3 browser configuration format
  • Added TypeScript type definitions for Vitest 3 browser providers while maintaining backward compatibility

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
This reverts commit e90d717.
Copy link

nx-cloud bot commented Jan 20, 2025

View your CI Pipeline Execution ↗ for commit 2bf54fb.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-22 14:24:55 UTC

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@valentinpalkovic valentinpalkovic force-pushed the valentin/introduce-instances-vitest-3 branch from d208cfb to 678fb8f Compare January 20, 2025 15:06
@valentinpalkovic valentinpalkovic added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Jan 21, 2025
@storybook-bot
Copy link
Contributor

Failed to publish canary version of this pull request, triggered by @valentinpalkovic. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/12909400525

@valentinpalkovic valentinpalkovic changed the title Addon Test: Use browser.test.instances instead of browser.test.name Addon Test: Support Vitest 3 browser.test.instances field Jan 22, 2025
@valentinpalkovic valentinpalkovic merged commit 4d2989d into next Jan 22, 2025
58 of 61 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/introduce-instances-vitest-3 branch January 22, 2025 14:51
shilman pushed a commit that referenced this pull request Jan 22, 2025
…es-vitest-3

Addon Test: Support Vitest 3 browser.test.instances field

(cherry picked from commit 4d2989d)
@github-actions github-actions bot mentioned this pull request Jan 24, 2025
5 tasks
valentinpalkovic added a commit that referenced this pull request Jan 27, 2025
…es-vitest-3

Addon Test: Support Vitest 3 browser.test.instances field

(cherry picked from commit 4d2989d)
@github-actions github-actions bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jan 27, 2025
@github-actions github-actions bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: test bug ci:normal patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
3 participants