Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: migrate to Vitest inline projects #13838

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

Merged
edison1105 merged 1 commit into vuejs:main from AriPerkkio:test/vitest-inline-workspace
Sep 1, 2025

Conversation

Copy link
Contributor

@AriPerkkio AriPerkkio commented Sep 1, 2025
edited by coderabbitai bot
Loading

  • Re-open of test: migrate to Vitest inline projects #13537
  • Migrates Vitest config from old deprecated APIs to the new ones
  • These changes make Vue pass with vitest@v4.0.0-beta.5. The beta.6 introduces breaking changes to module mocking and require actual test code changes.

Currently Vitest Ecosystem CI is failing for Vue. That's running 4.beta releases which removed these deprecated APIs. With these changes, Vue repo starts to pass with 4.beta.

https://github.com/vitest-dev/vitest-ecosystem-ci/actions/runs/15918783572/job/44901249704

Summary by CodeRabbit

  • Tests

    • Streamlined test setup with a consolidated multi-project configuration (unit, unit-jsdom, e2e) for clearer environments and isolation.
    • Updated test scripts to target a broader "unit*" scope, improving coverage across related projects.
    • Improved CI reliability by constraining threading for end-to-end runs.
  • Chores

    • Removed redundant test configuration files and workspace aggregation, reducing maintenance overhead and simplifying project structure.

Copy link

coderabbitai bot commented Sep 1, 2025
edited
Loading

Walkthrough

Consolidates Vitest configurations into a single multi-project vitest.config.ts defining unit, unit-jsdom, and e2e projects. Removes legacy vitest.unit.config.ts, vitest.e2e.config.ts, and vitest.workspace.ts. Updates package.json test scripts to target projects via unit* wildcard. Explicitly sets environments and includes/excludes per project.

Changes

Cohort / File(s) Summary
Vitest multi-project consolidation
vitest.config.ts
Replaces environmentMatchGlobs with explicit projects array: unit, unit-jsdom (jsdom), e2e (jsdom, singleThread in CI). Uses configDefaults for excludes and defines per-project include/exclude patterns.
Remove legacy split configs
vitest.unit.config.ts, vitest.e2e.config.ts, vitest.workspace.ts
Deletes separate unit/e2e config files and the workspace aggregator, superseded by the single multi-project config.
Script targeting adjustment
package.json
Updates test scripts to use --project unit* (instead of unit) and retains --coverage for coverage script.

Sequence Diagram(s)

sequenceDiagram
 autonumber
 actor Dev as Developer
 participant NPM as npm script (test-*)
 participant VT as Vitest CLI
 participant CFG as vitest.config.ts (projects)
 participant P1 as project: unit
 participant P2 as project: unit-jsdom
 participant P3 as project: e2e
 Dev->>NPM: run test-unit / test-coverage
 NPM->>VT: vitest --project unit*
 VT->>CFG: load multi-project config
 CFG-->>VT: projects: [unit, unit-jsdom, e2e]
 alt name matches "unit*"
 VT->>P1: select "unit" (node env, excludes e2e + vue/runtime-dom)
 VT->>P2: select "unit-jsdom" (jsdom env, include vue/runtime-dom)
 note right of P2: jsdom environment
 else other scripts (e2e)
 VT->>P3: select "e2e" (jsdom, singleThread on CI)
 note right of P3: threads.singleThread = CI ? true : false
 end
 P1-->>VT: run tests per include/exclude
 P2-->>VT: run tests per include/exclude
 P3-->>VT: run tests per include pattern
 VT-->>Dev: report results (and coverage if requested)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump my paws on spotless ground,
One config now—so sleek, so sound.
Unit hops left, jsdom hops right,
E2E moonwalks through the night.
With wildcard whiskers, scripts take flight—
Tests all pass? Carrot delight! 🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 0

🧹 Nitpick comments (3)
package.json (1)

24-24: Make coverage script explicit to ensure aggregation across both unit projects

Being explicit avoids any CLI glob ambiguity and makes intent clear.

- "test-coverage": "vitest run --project unit* --coverage",
+ "test-coverage": "vitest run --project unit --project unit-jsdom --coverage",
vitest.config.ts (2)

66-69: Tighten include glob to avoid accidental matches

The pattern **/*.{test,spec}.* can overmatch. Narrow to JS/TS (incl. c/m modules) for safer selection.

- include: ['packages/{vue,vue-compat,runtime-dom}/**/*.{test,spec}.*'],
+ include: [
+ 'packages/{vue,vue-compat,runtime-dom}/**/*.{test,spec}.[cm]?[jt]s?(x)'
+ ],

74-82: Optional: add retries for e2e to reduce CI flakiness

Single-threading helps. Adding minimal retries can smooth transient failures.

 name: 'e2e',
 environment: 'jsdom',
 poolOptions: {
 threads: {
 singleThread: !!process.env.CI,
 },
 },
+ retry: process.env.CI ? 2 : 0,
 include: ['packages/vue/__tests__/e2e/*.spec.ts'],
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 24fccb4 and 1c51e5f.

📒 Files selected for processing (5)
  • package.json (1 hunks)
  • vitest.config.ts (2 hunks)
  • vitest.e2e.config.ts (0 hunks)
  • vitest.unit.config.ts (0 hunks)
  • vitest.workspace.ts (0 hunks)
💤 Files with no reviewable changes (3)
  • vitest.unit.config.ts
  • vitest.e2e.config.ts
  • vitest.workspace.ts
🔇 Additional comments (3)
package.json (1)

20-20: Ignore wildcard refactor—Vitest v3+ supports globs for --project
Wildcards like --project=unit* have been supported since Vitest v3 (see CLI docs and GH PR #4747), so no change is needed.

Likely an incorrect or invalid review comment.

vitest.config.ts (2)

1-1: LGTM: importing configDefaults is the right call

Using configDefaults.exclude keeps parity with Vitest defaults.


50-61: Inline projects migration looks correct

Project "unit" extends base config and cleanly excludes e2e and DOM-heavy packages. No issues spotted.

Copy link

github-actions bot commented Sep 1, 2025

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB 38.4 kB 34.6 kB
vue.global.prod.js 159 kB 58.5 kB 52.2 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.5 kB 18.2 kB 16.7 kB
createApp 54.5 kB 21.2 kB 19.4 kB
createSSRApp 58.7 kB 22.9 kB 20.9 kB
defineCustomElement 59.5 kB 22.8 kB 20.8 kB
overall 68.5 kB 26.4 kB 24 kB

Copy link

pkg-pr-new bot commented Sep 1, 2025

Open in StackBlitz

@vue/compiler-core
npm i https://pkg.pr.new/@vue/compiler-core@13838
@vue/compiler-dom
npm i https://pkg.pr.new/@vue/compiler-dom@13838
@vue/compiler-sfc
npm i https://pkg.pr.new/@vue/compiler-sfc@13838
@vue/compiler-ssr
npm i https://pkg.pr.new/@vue/compiler-ssr@13838
@vue/reactivity
npm i https://pkg.pr.new/@vue/reactivity@13838
@vue/runtime-core
npm i https://pkg.pr.new/@vue/runtime-core@13838
@vue/runtime-dom
npm i https://pkg.pr.new/@vue/runtime-dom@13838
@vue/server-renderer
npm i https://pkg.pr.new/@vue/server-renderer@13838
@vue/shared
npm i https://pkg.pr.new/@vue/shared@13838
vue
npm i https://pkg.pr.new/vue@13838
@vue/compat
npm i https://pkg.pr.new/@vue/compat@13838

commit: 1c51e5f

@edison1105 edison1105 merged commit 233b125 into vuejs:main Sep 1, 2025
14 checks passed
@AriPerkkio AriPerkkio deleted the test/vitest-inline-workspace branch September 1, 2025 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /