Skip to content

Conversation

@yannbf
Copy link
Member

@yannbf yannbf commented Nov 18, 2025

Closes #

What I did

Simple refactor to stop using workspaces and use projects instead, as workspaces is deprecated in Vitest.

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 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
    • Reorganized Vitest test configuration across the monorepo to use a shared configuration module instead of individual workspace configurations.
    • Updated root Vitest configuration to discover and run tests from multiple project entry points, enabling centralized test execution across all packages and frameworks.

@yannbf yannbf self-assigned this Nov 18, 2025
@yannbf yannbf added build Internal-facing build tooling & test updates ci:normal labels Nov 18, 2025
@nx-cloud
Copy link

nx-cloud bot commented Nov 18, 2025

View your CI Pipeline Execution ↗ for commit e2ff8a1

Command Status Duration Result
nx run-many -t check -c production --parallel=7 ✅ Succeeded 1m 7s View ↗
nx run-many -t build -c production --parallel=3 ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-20 10:40:15 UTC

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

📝 Walkthrough

Walkthrough

Approximately 40 vitest configuration files across the monorepo update their import source for vitestCommonConfig from vitest.workspace to vitest.shared. Additionally, code/vitest.config.ts introduces a multi-project test setup via test.projects array, and code/vitest.shared.ts transitions from defineWorkspace to defineConfig.

Changes

Cohort / File(s) Summary
Addon configurations
code/addons/{a11y,docs,links,onboarding,pseudo-states,themes,vitest}/vitest.config.ts
Updated import source of vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared in each addon config
Framework configurations
code/frameworks/{angular,ember,nextjs,nextjs-vite,preact-vite,react,react-native-web-vite,react-vite,react-webpack5,server-webpack5,svelte-vite,sveltekit,vue3-vite,web-components-vite}/vitest.config.ts
Updated import source of vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared in each framework config
Builder configurations
code/builders/builder-{vite,webpack5}/vitest.config.ts
Updated import source of vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared
Library and renderer configurations
code/lib/{cli-sb,cli-storybook,codemod,core-webpack,create-storybook,csf-plugin}/vitest.config.ts, code/renderers/{html,preact,react,server,svelte,vue3,web-components}/vitest.config.ts
Updated import source of vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared in each lib and renderer config
Preset configuration
code/presets/server-webpack/vitest.config.ts
Updated import source of vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared
Core and main vitest configs
code/core/vitest.config.ts, code/vitest-storybook.config.mts
Updated import source of vitestCommonConfig from ../vitest.workspace or ./vitest.workspace to ../vitest.shared or ./vitest.shared
Main vitest configuration
code/vitest.config.ts
Added test.projects array containing glob patterns to discover and run multiple nested vitest configs as separate projects (vitest-storybook.config.mts, addons/*, frameworks/*, lib/*, core, builders/*, presets/*, renderers/*)
Shared vitest configuration
code/vitest.shared.ts
Transitioned from defineWorkspace with multi-config array to defineConfig with single configuration; updated imports accordingly

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Rationale: The bulk of changes are homogeneous, repetitive import path updates across 40+ configuration files following an identical pattern. Once the mapping from vitest.workspace to vitest.shared is understood, the individual file changes require minimal review. The two structural changes (vitest.config.ts projects array and vitest.shared.ts export pattern shift) introduce slight complexity but remain straightforward configuration adjustments.
  • Attention areas:
    • Verify that code/vitest.shared.ts exports the same configuration through defineConfig as the previous defineWorkspace arrangement provided
    • Confirm code/vitest.config.ts glob patterns correctly discover all project configs
    • Spot-check a sample of files from each cohort to ensure import paths were updated consistently

Possibly related PRs

✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (7)
code/frameworks/svelte-vite/vitest.config.ts (1)

3-3: LGTM!

Import path update is consistent with the migration from deprecated workspaces to projects in Vitest.

code/addons/docs/vitest.config.ts (1)

3-3: LGTM!

Import path correctly updated to use the shared configuration module.

code/renderers/server/vitest.config.ts (1)

3-3: LGTM!

Import path update aligns with the repository-wide refactor.

code/renderers/react/vitest.config.ts (1)

3-3: LGTM!

Import path correctly updated. The additional test.setupFiles configuration is properly preserved.

code/builders/builder-vite/vitest.config.ts (1)

3-3: LGTM!

Import path update is correct and consistent.

code/lib/create-storybook/vitest.config.ts (1)

3-3: LGTM!

Import path correctly updated to reference the shared configuration.

code/renderers/svelte/vitest.config.ts (1)

3-3: LGTM!

Import path correctly updated. The Svelte-specific plugins and test environment configuration are properly preserved.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e79c9b2 and 848bd41.

📒 Files selected for processing (40)
  • code/addons/a11y/vitest.config.ts (1 hunks)
  • code/addons/docs/vitest.config.ts (1 hunks)
  • code/addons/links/vitest.config.ts (1 hunks)
  • code/addons/onboarding/vitest.config.ts (1 hunks)
  • code/addons/pseudo-states/vitest.config.ts (1 hunks)
  • code/addons/themes/vitest.config.ts (1 hunks)
  • code/addons/vitest/vitest.config.ts (1 hunks)
  • code/builders/builder-vite/vitest.config.ts (1 hunks)
  • code/builders/builder-webpack5/vitest.config.ts (1 hunks)
  • code/core/vitest.config.ts (1 hunks)
  • code/frameworks/angular/vitest.config.ts (1 hunks)
  • code/frameworks/ember/vitest.config.ts (1 hunks)
  • code/frameworks/nextjs-vite/vitest.config.ts (1 hunks)
  • code/frameworks/nextjs/vitest.config.ts (1 hunks)
  • code/frameworks/preact-vite/vitest.config.ts (1 hunks)
  • code/frameworks/react-native-web-vite/vitest.config.ts (1 hunks)
  • code/frameworks/react-vite/vitest.config.ts (1 hunks)
  • code/frameworks/react-webpack5/vitest.config.ts (1 hunks)
  • code/frameworks/server-webpack5/vitest.config.ts (1 hunks)
  • code/frameworks/svelte-vite/vitest.config.ts (1 hunks)
  • code/frameworks/sveltekit/vitest.config.ts (1 hunks)
  • code/frameworks/vue3-vite/vitest.config.ts (1 hunks)
  • code/frameworks/web-components-vite/vitest.config.ts (1 hunks)
  • code/lib/cli-sb/vitest.config.ts (1 hunks)
  • code/lib/cli-storybook/vitest.config.ts (1 hunks)
  • code/lib/codemod/vitest.config.ts (1 hunks)
  • code/lib/core-webpack/vitest.config.ts (1 hunks)
  • code/lib/create-storybook/vitest.config.ts (1 hunks)
  • code/lib/csf-plugin/vitest.config.ts (1 hunks)
  • code/presets/server-webpack/vitest.config.ts (1 hunks)
  • code/renderers/html/vitest.config.ts (1 hunks)
  • code/renderers/preact/vitest.config.ts (1 hunks)
  • code/renderers/react/vitest.config.ts (1 hunks)
  • code/renderers/server/vitest.config.ts (1 hunks)
  • code/renderers/svelte/vitest.config.ts (1 hunks)
  • code/renderers/vue3/vitest.config.ts (1 hunks)
  • code/renderers/web-components/vitest.config.ts (1 hunks)
  • code/vitest-storybook.config.mts (1 hunks)
  • code/vitest.config.ts (1 hunks)
  • code/vitest.shared.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-01T15:24:01.060Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32594
File: code/core/src/components/components/Popover/WithPopover.tsx:7-9
Timestamp: 2025-10-01T15:24:01.060Z
Learning: In the Storybook repository, "react-aria-components/patched-dist/*" (e.g., "react-aria-components/patched-dist/Dialog", "react-aria-components/patched-dist/Popover", "react-aria-components/patched-dist/Tooltip") are valid import paths created by a patch applied to the react-aria-components package. These imports should not be flagged as broken or invalid until a maintainer explicitly states they are no longer acceptable.

Applied to files:

  • code/addons/a11y/vitest.config.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: normal
  • GitHub Check: Core Unit Tests, windows-latest
  • GitHub Check: get-parameters
🔇 Additional comments (34)
code/builders/builder-webpack5/vitest.config.ts (1)

3-7: Import path update aligns with shared Vitest config refactor

The new vitestCommonConfig import from ../../vitest.shared is consistent with the repo-wide move off vitest.workspace; no further changes needed here.

code/addons/themes/vitest.config.ts (1)

3-7: Shared config import looks correct

Switching vitestCommonConfig to ../../vitest.shared matches the new shared Vitest configuration pattern and keeps the rest of the config intact.

code/addons/links/vitest.config.ts (1)

3-7: Consistent use of vitest.shared for links addon

The updated vitestCommonConfig import from ../../vitest.shared is consistent with other addons and should preserve behavior.

code/frameworks/nextjs-vite/vitest.config.ts (1)

3-7: Framework config correctly points to shared Vitest config

Importing vitestCommonConfig from ../../vitest.shared keeps this Next.js Vite config aligned with the global Vitest setup.

code/frameworks/react-vite/vitest.config.ts (1)

3-7: React Vite config import change looks good

The switch to ../../vitest.shared for vitestCommonConfig is correct and consistent with other framework configs.

code/addons/vitest/vitest.config.ts (1)

3-7: Addon Vitest config now uses shared base config

Updating vitestCommonConfig to come from ../../vitest.shared matches the rest of the addons and should behave identically.

code/vitest-storybook.config.mts (1)

7-24: Storybook Vitest config correctly switched to vitest.shared

Using vitestCommonConfig from ./vitest.shared keeps this Storybook-specific setup aligned with the new shared Vitest configuration.

code/addons/pseudo-states/vitest.config.ts (1)

3-13: Pseudo-states addon now correctly uses shared Vitest config

The vitestCommonConfig import from ../../vitest.shared looks correct and keeps the existing test.typecheck overrides intact.

code/frameworks/react-native-web-vite/vitest.config.ts (1)

3-3: Verification confirms the import path update is correct.

The script confirms that:

  • code/vitest.shared.ts properly exports vitestCommonConfig
  • No remaining imports from the deprecated vitest.workspace exist in active TypeScript code
  • The only remaining reference to vitest.workspace is in a template file, which is expected

The change from vitest.workspace to vitest.shared is complete and consistent across the codebase.

code/addons/onboarding/vitest.config.ts (1)

3-3: LGTM! Clean migration to shared config.

The import path update from vitest.workspace to vitest.shared is correct and aligns with the migration away from deprecated Vitest workspaces to the new projects-based approach.

code/renderers/preact/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

The change properly references the new shared configuration source, consistent with the workspace deprecation migration.

code/frameworks/react-webpack5/vitest.config.ts (1)

3-3: LGTM! Consistent refactor.

Import source properly updated to use the shared configuration module.

code/lib/cli-storybook/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

The migration to vitest.shared is properly implemented.

code/frameworks/vue3-vite/vitest.config.ts (1)

3-3: LGTM! Migration completed correctly.

The import source has been properly updated. The usage of Vitest 3.2.4 should fully support the new projects-based configuration.

code/renderers/vue3/vitest.config.ts (1)

5-5: LGTM! Import correctly updated.

The shared configuration import is properly updated, and the Vue plugin integration remains unchanged.

code/frameworks/angular/vitest.config.ts (1)

3-3: LGTM! Import path properly updated.

The shared config import is correct, and the Angular-specific test configuration (globals and setupFiles) remains properly structured.

code/lib/cli-sb/vitest.config.ts (1)

3-3: All vitest config files correctly updated across the monorepo.

Verification confirms:

  • 38 files import vitestCommonConfig (matches the ~40 mentioned in summary)
  • All imports correctly reference vitest.shared (no incorrect paths found)
  • vitest.shared properly exports vitestCommonConfig
  • Changes are consistent across all affected files

The migration is complete. Test suite verification would need to be confirmed during CI/CD pipeline execution.

code/frameworks/ember/vitest.config.ts (1)

3-3: LGTM - Import path updated correctly.

The import source change from vitest.workspace to vitest.shared aligns with the migration from Vitest's deprecated workspaces to the projects feature. The relative path is correct for this file location.

code/frameworks/nextjs/vitest.config.ts (1)

3-3: LGTM - Import path updated correctly.

The import source change from vitest.workspace to vitest.shared aligns with the migration from Vitest's deprecated workspaces to the projects feature. The relative path is correct for this file location.

code/lib/core-webpack/vitest.config.ts (1)

3-3: LGTM - Import path updated correctly.

The import source change from vitest.workspace to vitest.shared aligns with the migration from Vitest's deprecated workspaces to the projects feature. The relative path is correct for this file location.

code/presets/server-webpack/vitest.config.ts (1)

3-3: LGTM - Import path updated correctly.

The import source change from vitest.workspace to vitest.shared aligns with the migration from Vitest's deprecated workspaces to the projects feature. The relative path is correct for this file location.

code/frameworks/server-webpack5/vitest.config.ts (1)

3-3: LGTM - Import path updated correctly.

The import source change from vitest.workspace to vitest.shared aligns with the migration from Vitest's deprecated workspaces to the projects feature. The relative path is correct for this file location.

code/lib/csf-plugin/vitest.config.ts (1)

3-3: LGTM - Import path updated correctly.

The import source change from vitest.workspace to vitest.shared aligns with the migration from Vitest's deprecated workspaces to the projects feature. The relative path is correct for this file location.

code/renderers/html/vitest.config.ts (1)

3-3: LGTM - Import path updated correctly.

The import source change from vitest.workspace to vitest.shared aligns with the migration from Vitest's deprecated workspaces to the projects feature. The relative path is correct for this file location.

code/lib/codemod/vitest.config.ts (2)

3-3: LGTM - Import path updated correctly.

The import source change from vitest.workspace to vitest.shared aligns with the migration from Vitest's deprecated workspaces to the projects feature. The relative path is correct for this file location.


1-10: Migration successfully verified and complete.

All verification checks passed:

  • No remaining imports from vitest.workspace
  • vitestCommonConfig properly exported from code/vitest.shared.ts
  • Root vitest.config.ts correctly configured with projects array containing all workspace paths
  • Vitest 3.2.x supports the projects feature and deprecates the old workspace configuration

The code changes are consistent with the official Vitest migration pattern.

code/renderers/web-components/vitest.config.ts (1)

3-3: LGTM! Clean import path migration.

The import source change from vitest.workspace to vitest.shared aligns with the PR's objective to migrate from deprecated workspaces to projects. This pattern is consistently applied across all config files in this PR.

code/core/vitest.config.ts (1)

3-3: LGTM! Import path updated correctly.

The change aligns with the repository-wide migration to vitest.shared.

code/frameworks/preact-vite/vitest.config.ts (1)

3-3: LGTM! Consistent with the workspace-to-projects migration.

code/frameworks/web-components-vite/vitest.config.ts (1)

3-3: LGTM! Import path migration applied correctly.

code/addons/a11y/vitest.config.ts (1)

3-3: LGTM! Import updated to use shared config.

code/frameworks/sveltekit/vitest.config.ts (1)

3-3: LGTM! Import path change is correct.

code/vitest.shared.ts (2)

3-3: LGTM! Correct transition from workspace to single config.

The change from defineWorkspace to defineConfig is the key part of migrating away from Vitest's deprecated workspaces feature. The shared configuration export remains compatible with all importing configs.


16-33: Configuration structure looks good.

The vitestCommonConfig export provides sensible defaults for the monorepo: thread pooling with CI-aware thread counts, test timeouts, and shared setup files.

Comment on lines +9 to +18
projects: [
'vitest-storybook.config.mts',
'addons/*/vitest.config.ts',
'frameworks/*/vitest.config.ts',
'lib/*/vitest.config.ts',
'core/vitest.config.ts',
'builders/*/vitest.config.ts',
'presets/*/vitest.config.ts',
'renderers/*/vitest.config.ts',
],
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

LGTM! Projects setup replaces deprecated workspaces.

The test.projects array correctly establishes the multi-project setup using glob patterns to discover individual configs. This is the standard approach for Vitest's projects feature.

Verify that all intended config files are matched by the glob patterns:


🏁 Script executed:

#!/bin/bash
# Description: Verify all vitest.config.ts files are covered by the projects patterns

echo "=== Checking project patterns coverage ==="
echo ""

# List all vitest config files
echo "All vitest config files in code directory:"
fd -e ts -e mts 'vitest.*config' code/ --type f

echo ""
echo "=== Files that should match project patterns ==="
echo "Pattern: vitest-storybook.config.mts"
fd 'vitest-storybook.config.mts' code/ --type f

echo ""
echo "Pattern: addons/*/vitest.config.ts"
fd 'vitest.config.ts' code/addons/ --max-depth 2 --type f

echo ""
echo "Pattern: frameworks/*/vitest.config.ts"
fd 'vitest.config.ts' code/frameworks/ --max-depth 2 --type f

echo ""
echo "Pattern: lib/*/vitest.config.ts"
fd 'vitest.config.ts' code/lib/ --max-depth 2 --type f

echo ""
echo "Pattern: core/vitest.config.ts"
fd 'vitest.config.ts' code/core/ --max-depth 1 --type f

echo ""
echo "Pattern: builders/*/vitest.config.ts"
fd 'vitest.config.ts' code/builders/ --max-depth 2 --type f

echo ""
echo "Pattern: presets/*/vitest.config.ts"
fd 'vitest.config.ts' code/presets/ --max-depth 2 --type f

echo ""
echo "Pattern: renderers/*/vitest.config.ts"
fd 'vitest.config.ts' code/renderers/ --max-depth 2 --type f

Length of output: 3920


Gathering additional information to verify the coverage of named config files.

Add glob pattern for named vitest configs in lib packages

The pattern lib/*/vitest.config.ts does not match vitest.integration.config.ts files, which are valid Vitest configuration files that match the pattern (vite|vitest).*.config.*.

Update the projects array to include named configurations:

'lib/*/vitest.config.ts',
'lib/*/vitest.*.config.ts',

This ensures code/lib/eslint-plugin/vitest.integration.config.ts and similar named configs are recognized as projects.

🤖 Prompt for AI Agents
In code/vitest.config.ts around lines 9 to 18, the projects array only includes
'lib/*/vitest.config.ts' which misses named config files like
vitest.integration.config.ts; add an additional glob entry that matches named
Vitest config patterns (e.g., 'lib/*/vitest.*.config.ts') so both default and
named configs under lib/* are picked up; update the projects array to include
this new pattern alongside the existing one.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

📝 Walkthrough

Walkthrough

This PR refactors the Vitest configuration system across the codebase by consolidating shared configuration imports. All addon, builder, framework, library, preset, and renderer vitest.config.ts files are updated to import vitestCommonConfig from vitest.shared instead of vitest.workspace. The central vitest.shared.ts is refactored from a defineWorkspace pattern to a defineConfig approach, and the main vitest.config.ts adds a projects array to support multi-project Vitest workflows.

Changes

Cohort / File(s) Summary
Addon configs
code/addons/a11y/vitest.config.ts, code/addons/docs/vitest.config.ts, code/addons/links/vitest.config.ts, code/addons/onboarding/vitest.config.ts, code/addons/pseudo-states/vitest.config.ts, code/addons/themes/vitest.config.ts, code/addons/vitest/vitest.config.ts
Updated import source for vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared
Builder configs
code/builders/builder-vite/vitest.config.ts, code/builders/builder-webpack5/vitest.config.ts
Updated import source for vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared
Framework configs
code/frameworks/angular/vitest.config.ts, code/frameworks/ember/vitest.config.ts, code/frameworks/nextjs-vite/vitest.config.ts, code/frameworks/nextjs/vitest.config.ts, code/frameworks/preact-vite/vitest.config.ts, code/frameworks/react-native-web-vite/vitest.config.ts, code/frameworks/react-vite/vitest.config.ts, code/frameworks/react-webpack5/vitest.config.ts, code/frameworks/server-webpack5/vitest.config.ts, code/frameworks/svelte-vite/vitest.config.ts, code/frameworks/sveltekit/vitest.config.ts, code/frameworks/vue3-vite/vitest.config.ts, code/frameworks/web-components-vite/vitest.config.ts
Updated import source for vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared
Library configs
code/lib/cli-sb/vitest.config.ts, code/lib/cli-storybook/vitest.config.ts, code/lib/codemod/vitest.config.ts, code/lib/core-webpack/vitest.config.ts, code/lib/create-storybook/vitest.config.ts, code/lib/csf-plugin/vitest.config.ts
Updated import source for vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared
Preset & renderer configs
code/presets/server-webpack/vitest.config.ts, code/renderers/html/vitest.config.ts, code/renderers/preact/vitest.config.ts, code/renderers/react/vitest.config.ts, code/renderers/server/vitest.config.ts, code/renderers/svelte/vitest.config.ts, code/renderers/vue3/vitest.config.ts, code/renderers/web-components/vitest.config.ts
Updated import source for vitestCommonConfig from ../../vitest.workspace to ../../vitest.shared
Core config
code/core/vitest.config.ts
Updated import source for vitestCommonConfig from ../vitest.workspace to ../vitest.shared
Storybook vitest config
code/vitest-storybook.config.mts
Updated import source for vitestCommonConfig from ./vitest.workspace to ./vitest.shared
Main vitest config
code/vitest.config.ts
Added projects array property listing multiple vitest.config.ts entry points (e.g., vitest-storybook.config.mts, addons/\\*/vitest.config.ts, frameworks/\\*/vitest.config.ts, etc.) to enable multi-project Vitest workflows
Shared vitest config
code/vitest.shared.ts
Refactored from defineWorkspace pattern with glob patterns to defineConfig approach; changes export mechanism and config structure

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The changes are predominantly homogeneous import path updates across 40+ files following the same pattern
  • The central logic change in code/vitest.shared.ts (migration from defineWorkspace to defineConfig) requires verification that the new export maintains compatibility
  • The projects array addition in code/vitest.config.ts should be validated to ensure all referenced config paths are correct and the multi-project setup functions as intended

Possibly related PRs

✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (6)
code/frameworks/nextjs/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

code/frameworks/react-webpack5/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

code/renderers/vue3/vitest.config.ts (1)

5-5: LGTM! Import path correctly updated.

code/addons/pseudo-states/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

code/addons/vitest/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

code/lib/csf-plugin/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e79c9b2 and 848bd41.

📒 Files selected for processing (40)
  • code/addons/a11y/vitest.config.ts (1 hunks)
  • code/addons/docs/vitest.config.ts (1 hunks)
  • code/addons/links/vitest.config.ts (1 hunks)
  • code/addons/onboarding/vitest.config.ts (1 hunks)
  • code/addons/pseudo-states/vitest.config.ts (1 hunks)
  • code/addons/themes/vitest.config.ts (1 hunks)
  • code/addons/vitest/vitest.config.ts (1 hunks)
  • code/builders/builder-vite/vitest.config.ts (1 hunks)
  • code/builders/builder-webpack5/vitest.config.ts (1 hunks)
  • code/core/vitest.config.ts (1 hunks)
  • code/frameworks/angular/vitest.config.ts (1 hunks)
  • code/frameworks/ember/vitest.config.ts (1 hunks)
  • code/frameworks/nextjs-vite/vitest.config.ts (1 hunks)
  • code/frameworks/nextjs/vitest.config.ts (1 hunks)
  • code/frameworks/preact-vite/vitest.config.ts (1 hunks)
  • code/frameworks/react-native-web-vite/vitest.config.ts (1 hunks)
  • code/frameworks/react-vite/vitest.config.ts (1 hunks)
  • code/frameworks/react-webpack5/vitest.config.ts (1 hunks)
  • code/frameworks/server-webpack5/vitest.config.ts (1 hunks)
  • code/frameworks/svelte-vite/vitest.config.ts (1 hunks)
  • code/frameworks/sveltekit/vitest.config.ts (1 hunks)
  • code/frameworks/vue3-vite/vitest.config.ts (1 hunks)
  • code/frameworks/web-components-vite/vitest.config.ts (1 hunks)
  • code/lib/cli-sb/vitest.config.ts (1 hunks)
  • code/lib/cli-storybook/vitest.config.ts (1 hunks)
  • code/lib/codemod/vitest.config.ts (1 hunks)
  • code/lib/core-webpack/vitest.config.ts (1 hunks)
  • code/lib/create-storybook/vitest.config.ts (1 hunks)
  • code/lib/csf-plugin/vitest.config.ts (1 hunks)
  • code/presets/server-webpack/vitest.config.ts (1 hunks)
  • code/renderers/html/vitest.config.ts (1 hunks)
  • code/renderers/preact/vitest.config.ts (1 hunks)
  • code/renderers/react/vitest.config.ts (1 hunks)
  • code/renderers/server/vitest.config.ts (1 hunks)
  • code/renderers/svelte/vitest.config.ts (1 hunks)
  • code/renderers/vue3/vitest.config.ts (1 hunks)
  • code/renderers/web-components/vitest.config.ts (1 hunks)
  • code/vitest-storybook.config.mts (1 hunks)
  • code/vitest.config.ts (1 hunks)
  • code/vitest.shared.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: normal
  • GitHub Check: Core Unit Tests, windows-latest
  • GitHub Check: get-parameters
🔇 Additional comments (27)
code/renderers/web-components/vitest.config.ts (1)

3-3: Import path updated correctly.

code/presets/server-webpack/vitest.config.ts (1)

3-3: Import path updated correctly.

code/addons/docs/vitest.config.ts (1)

3-3: Import path updated correctly.

code/frameworks/sveltekit/vitest.config.ts (1)

3-3: Import path updated correctly.

code/frameworks/vue3-vite/vitest.config.ts (1)

3-3: Import path updated correctly.

code/addons/links/vitest.config.ts (1)

3-3: Import path updated correctly.

code/lib/cli-sb/vitest.config.ts (1)

3-3: Import path updated correctly.

code/frameworks/react-vite/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

The import path change from vitest.workspace to vitest.shared is correct and aligns with the migration from deprecated workspaces to projects.

code/core/vitest.config.ts (1)

3-3: LGTM! Import path correctly updated.

The import path uses ../vitest.shared (one level up) which is correct for the code/core/ location.

code/lib/csf-plugin/vitest.config.ts (1)

1-10: Let me gather more context on these references to understand if they're legitimate or if they indicate the migration is incomplete:

Let me examine the specific contexts of these references to understand if they're migration code or if they indicate active usage:

No action required - migration verification complete.

Based on the script results:

  1. ✅ The workspace configuration was renamed to projects in Vitest 3.2, and this code correctly uses the shared config pattern with vitest.shared.

  2. ✅ The code/vitest.shared.ts file exists and properly exports vitestCommonConfig.

  3. ✅ The old vitest.workspace file does not exist in the repository.

The references to vitest.workspace that appear throughout the codebase are intentional: they're in Storybook's postinstall migration logic and tests that detect old workspace files in user projects—not active imports of the old file. This is expected and correct for backward compatibility.

The change to vitest.config.ts at code/lib/csf-plugin/ is properly implemented using the new shared config approach.

code/frameworks/server-webpack5/vitest.config.ts (1)

3-3: LGTM! Import path updated correctly.

The import source has been updated consistently with the repository-wide migration from workspace-based to shared configuration.

code/frameworks/web-components-vite/vitest.config.ts (1)

3-3: LGTM! Import path updated correctly.

The import source has been updated consistently with the repository-wide migration.

code/builders/builder-webpack5/vitest.config.ts (1)

3-3: LGTM! Import path updated correctly.

The import source has been updated consistently with the repository-wide migration.

code/frameworks/preact-vite/vitest.config.ts (1)

3-3: LGTM! Import path updated correctly.

The import source has been updated consistently with the repository-wide migration.

code/lib/core-webpack/vitest.config.ts (1)

3-3: LGTM! Import path updated correctly.

The import source has been updated consistently with the repository-wide migration.

code/addons/onboarding/vitest.config.ts (1)

3-3: LGTM! Import path updated correctly.

The import source has been updated consistently with the repository-wide migration.

code/renderers/svelte/vitest.config.ts (1)

3-3: LGTM! Import path updated correctly.

The import source has been updated consistently with the repository-wide migration. The Svelte-specific plugin configuration remains properly integrated with the shared configuration.

code/addons/a11y/vitest.config.ts (1)

3-3: Import change verified and correct.

The import path '../../vitest.shared' properly resolves to the shared configuration file, which exports vitestCommonConfig using defineConfig(). The a11y config correctly merges this shared configuration using mergeConfig(), following Vitest's recommended pattern for the workspace-to-projects migration.

code/lib/cli-storybook/vitest.config.ts (1)

3-3: Import update follows Vitest deprecation—verified and approved.

Vitest deprecated the workspace option since v3.2 in favor of projects, and this change correctly migrates away from that deprecated pattern. The code/vitest.shared.ts file exists and properly exports vitestCommonConfig using defineConfig, confirming the shared config setup is in place and ready.

code/frameworks/nextjs-vite/vitest.config.ts (1)

3-3: Import source switch looks correct

Using vitestCommonConfig from ../../vitest.shared keeps the existing merge pattern and aligns this framework config with the shared setup; no issues spotted here.

code/frameworks/ember/vitest.config.ts (1)

3-3: Consistent shared config import

The Ember Vitest config now pulls vitestCommonConfig from ../../vitest.shared, matching the other framework configs. Change looks good.

code/renderers/server/vitest.config.ts (1)

3-3: Server renderer config aligned with shared source

Switching to ../../vitest.shared for vitestCommonConfig keeps this renderer in sync with the new shared Vitest configuration strategy.

code/frameworks/svelte-vite/vitest.config.ts (1)

3-3: Shared config import update looks good

The Svelte/Vite framework config now reuses vitestCommonConfig from ../../vitest.shared, consistent with the rest of the repo. No issues here.

code/renderers/react/vitest.config.ts (1)

3-11: React renderer now reuses new shared config source

Only the vitestCommonConfig import source changed; the React-specific test.setupFiles configuration is untouched, so behavior should be preserved while aligning with vitest.shared.

code/builders/builder-vite/vitest.config.ts (1)

3-3: Builder Vite config now reuses shared Vitest config

The Vite builder’s tests now consume vitestCommonConfig from ../../vitest.shared, matching the new shared configuration pattern across the repo. Looks good.

code/vitest.shared.ts (1)

3-33: Shared Vitest config is correct and follows documented patterns

The configuration shape is valid. The defineConfig from vitest/config correctly accepts test.pool = 'threads', poolOptions.threads.{minThreads, maxThreads}, setupFiles, globals, and environment nested under the test key, and no additional top-level fields are needed. Importing defineConfig and exporting vitestCommonConfig for consumption via mergeConfig in per-package configs is consistent with the documented pattern.

code/vitest.config.ts (1)

9-18: No action needed — the configuration is already correct

According to current Vitest documentation, projects is properly defined under the test configuration (i.e., test.projects), not as a top-level sibling. The code in this PR already follows the documented structure. The suggestion to move projects to the top level is based on an incorrect assumption about Vitest's configuration schema and should be disregarded.

Likely an incorrect or invalid review comment.

import Inspect from 'vite-plugin-inspect';

import { vitestCommonConfig } from './vitest.workspace';
import { vitestCommonConfig } from './vitest.shared';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Import path updated correctly for Vitest migration.

The import source change from vitest.workspace to vitest.shared aligns with the PR's objective to migrate away from deprecated Vitest workspaces.

Please verify that:

  1. The vitest.shared module correctly exports vitestCommonConfig
  2. All references to vitest.workspace have been updated across the codebase
  3. The Vitest workspaces feature is indeed deprecated

🏁 Script executed:

#!/bin/bash
# Verify no remaining references to vitest.workspace in config files
rg -n "vitest\.workspace" --type=ts --type=js

# Verify vitest.shared exports vitestCommonConfig
rg -n "export.*vitestCommonConfig" --type=ts code/vitest.shared.ts

Length of output: 1502


🌐 Web query:

Is the workspaces feature deprecated in Vitest? What is the recommended migration path to projects?

💡 Result:

Short answer: Yes — the workspace option (and separate vitest.workspace file) is deprecated since Vitest 3.2 and you should migrate to the test.projects pattern. Replace your workspace file (or workspace setting) by moving its array into the root vitest.config (use test.projects). Example migration shown in the official guide. [1][2]

References:

  • Config docs (workspace deprecated; use projects). [1]
  • Migration guide showing move from vitest.workspace to test.projects in root vitest.config. [2]

Incomplete Vitest workspace migration — multiple references still need updating.

Verification confirms that while vitest.shared correctly exports vitestCommonConfig and Vitest workspaces are indeed deprecated (since 3.2), the migration is incomplete. The codebase still contains 12+ active references to vitest.workspace that must be updated to complete the deprecation migration:

  • scripts/tasks/sandbox-parts.ts:500
  • code/lib/create-storybook/src/ink/steps/checks/vitestConfigFiles.tsx:102
  • code/lib/create-storybook/src/ink/steps/checks/vitestConfigFiles.test.ts:79, 82, 127, 131
  • code/addons/vitest/src/node/vitest-manager.ts:79
  • code/addons/vitest/src/postinstall.ts:380, 407
  • code/addons/vitest/src/updateVitestFile.test.ts:1059, 1115

These files reference the deprecated workspace pattern and should be updated to use test.projects instead. Complete the migration before this PR can be merged.

@yannbf yannbf merged commit e23169e into next Nov 20, 2025
67 of 68 checks passed
@yannbf yannbf deleted the yann/vitest-use-projects branch November 20, 2025 11:04
@coderabbitai coderabbitai bot mentioned this pull request Nov 20, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Internal-facing build tooling & test updates ci:normal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants