-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Conversation
WalkthroughConsolidates 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
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai
coderabbitai
bot
left a comment
There was a problem hiding this 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 projectsBeing 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 matchesThe 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 flakinessSingle-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.
📒 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 callUsing configDefaults.exclude keeps parity with Vitest defaults.
50-61
: Inline projects migration looks correctProject "unit" extends base config and cleanly excludes e2e and DOM-heavy packages. No issues spotted.
Size ReportBundles
Usages
|
@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
Uh oh!
There was an error while loading. Please reload this page.
vitest@v4.0.0-beta.5
. Thebeta.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 with4.beta
.https://github.com/vitest-dev/vitest-ecosystem-ci/actions/runs/15918783572/job/44901249704
Summary by CodeRabbit
Tests
Chores