Skip to content

Test: Update vitest packages#33790

Closed
valentinpalkovic wants to merge 20 commits into
nextfrom
valentin/update-vitest-packages
Closed

Test: Update vitest packages#33790
valentinpalkovic wants to merge 20 commits into
nextfrom
valentin/update-vitest-packages

Conversation

@valentinpalkovic
Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic commented Feb 6, 2026

Closes #

What I did

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

Caution

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 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 publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Chores

    • Upgraded Vitest-related dependencies to version 4.0.18 across the project.
  • Refactor

    • Simplified mocking utilities implementation by leveraging external libraries, reducing internal code complexity.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Upgrades Vitest-related packages to version 4.0.18 across multiple package.json files, refactors automock implementation to delegate to @vitest/mocker, removes esmWalker module entirely, and updates resolution entries to reflect new package versions.

Changes

Cohort / File(s) Summary
Package Version Upgrades
code/core/package.json, code/package.json, package.json
Updated Vitest-related packages (@vitest/expect, @vitest/spy, @vitest/mocker, @vitest/utils, and vitest core) from 3.2.4/4.0.14 to 4.0.18; also updated patch resolution for @vitest/expect.
Automock Refactoring
code/core/src/mocking-utils/automock.ts
Replaced large in-file automockModule implementation with direct import from @vitest/mocker/automock. Introduced STORYBOOK_GLOBAL_THIS_ACCESSOR constant for globalThis access. Updated getAutomockCode to delegate to imported automockModule with new signature using ParseFn type.
ESM Walker Module Removal
code/core/src/mocking-utils/esmWalker.ts
Completely removed esmWalker module with all 343 lines of implementation, including exported functions (esmWalker, setIsNodeInPattern, isNodeInPattern, isStaticProperty, isStaticPropertyKey, isFunctionNode, isInDestructuringAssignment, getArbitraryModuleIdentifier), type exports, and estree re-exports.
Resolution Configuration Update
scripts/ecosystem-ci/existing-resolutions.js
Updated EXISTING_RESOLUTIONS set by replacing '@vitest/expect@npm:3.2.4' with '@vitest/expect@npm:4.0.18' entry.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • storybookjs/storybook#33315: Modifies mocking-utils surface and changes how Storybook consumes @vitest/mocker, directly overlapping with automock refactoring changes.
  • storybookjs/storybook#33086: Performs matching Vitest v4 dependency upgrades with similar package version updates to 4.0.18.
  • storybookjs/storybook#33277: Modifies scripts/ecosystem-ci/existing-resolutions.js and updates the EXISTING_RESOLUTIONS exported constant.
✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@valentinpalkovic valentinpalkovic marked this pull request as draft February 9, 2026 12:20
@valentinpalkovic valentinpalkovic self-assigned this Feb 9, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Feb 23, 2026

View your CI Pipeline Execution ↗ for commit 02ee558

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ❌ Failed 1m 15s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-03 09:26:37 UTC


if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
-if (!Object.hasOwn(globalThis, MATCHERS_OBJECT)) {
+if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this really needed now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unfortunately yes, because we support running tests in "portable stories" with Jest. Because the test utilities rely on Vitest utilities, then this clash occurs

Image

@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot Bot commented Feb 26, 2026

Package Benchmarks

Commit: 01d6f5f, ran on 27 February 2026 at 13:21:20 UTC

The following packages have significant changes to their size or dependencies:

storybook

Before After Difference
Dependency count 49 45 🎉 -4 🎉
Self size 20.19 MB 20.43 MB 🚨 +236 KB 🚨
Dependency size 16.52 MB 16.15 MB 🎉 -378 KB 🎉
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 183 179 🎉 -4 🎉
Self size 779 KB 779 KB 0 B
Dependency size 67.37 MB 67.23 MB 🎉 -142 KB 🎉
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 176 172 🎉 -4 🎉
Self size 32 KB 32 KB 🚨 +36 B 🚨
Dependency size 65.89 MB 65.75 MB 🎉 -142 KB 🎉
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 50 46 🎉 -4 🎉
Self size 1.04 MB 1.04 MB 0 B
Dependency size 36.72 MB 36.57 MB 🎉 -142 KB 🎉
Bundle Size Analyzer node node

@valentinpalkovic valentinpalkovic added this to the 11 milestone Mar 3, 2026
Base automatically changed from valentin/support-vite-8 to next March 10, 2026 08:05
@github-actions
Copy link
Copy Markdown
Contributor

Fails
🚫 PR is marked with "BREAKING CHANGE" label.
🚫 The "#### Manual testing" section must be filled in. Please describe how to test the changes you've made, step by step, so that reviewers can confirm your PR works as intended.

Generated by 🚫 dangerJS against 02ee558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants