test: migrate to Vitest inline projects
- Migrates Vitest config from old deprecated APIs to the new ones
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
- Chores
- Updated test scripts and dependencies for improved compatibility and coverage.
- Consolidated and restructured test configurations for unit and end-to-end tests into a single configuration file.
- Removed obsolete test configuration files to simplify setup and maintenance.
Walkthrough
The changes consolidate Vitest test configurations by deleting separate config files for unit and e2e tests and moving to a single, project-based configuration in vitest.config.ts. Test scripts and dependencies in package.json are updated, and the workspace config is removed. No exported or public entity declarations are altered.
Changes
| File(s) | Change Summary |
|---|---|
| package.json | Updated test scripts to use glob patterns; upgraded @vitest/coverage-v8 and vitest dependencies. |
| vitest.config.ts | Replaced environment glob matching with a projects array for unit, unit-jsdom, and e2e test configs. |
| vitest.unit.config.ts, vitest.e2e.config.ts, vitest.workspace.ts | Deleted separate unit, e2e, and workspace Vitest config files. |
Sequence Diagram(s)
sequenceDiagram
participant Dev as Developer
participant VitestConfig as vitest.config.ts
participant Vitest as Vitest Runner
Dev->>VitestConfig: Run test script (unit*, e2e)
VitestConfig->>Vitest: Provide projects array (unit, unit-jsdom, e2e)
Vitest->>Vitest: Select matching project config
Vitest->>Dev: Execute tests with appropriate environment/settings
Poem
In the warren, configs once sprawled, Now a single burrow—neatly installed! With scripts that match and versions new, The tests all run, both old and true. Goodbye, confusion—hello, delight! The code hops forward, clean and light. 🐇✨
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between ba391f5fdf5d84bfacaca6a2a3e7057fc99efa34 and 98f70ad0e2f74221b2e5b98261499310205caa37.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
package.json(3 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.workspace.ts
- vitest.unit.config.ts
- vitest.e2e.config.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules
- GitHub Check: Header rules
- GitHub Check: Pages changed
🔇 Additional comments (4)
package.json (2)
20-20: LGTM! Script updates align with new project structure.The glob pattern
unit*correctly targets both "unit" and "unit-jsdom" projects defined in the new Vitest configuration, replacing the previous fixed project names.Also applies to: 24-24
77-77: Dependency upgrades support new Vitest features.The version bumps to
^3.2.4for bothvitestand@vitest/coverage-v8are necessary to support the new inline projects configuration introduced in this migration.Also applies to: 113-113
vitest.config.ts (2)
1-1: Necessary import for new project configuration.The addition of
configDefaultsimport is required to access default exclude patterns in the new project-based configuration.
49-84: Old Vitest Configs Fully RemovedVerification shows there are no leftover Vitest config files or references to the old split configs. The only remaining import is the new
vitest.config.ts:
- No files matching
vitest.(unit|e2e|workspace).config.(ts|js)- No
vitest.*configentries inpackage.jsonor elsewhere- Only
vitest.config.tsremains, as expected
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
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.
🪧 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.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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
Documentation and Community
- 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.
Thanks for this PR. but we already made these changes in the vapor branch (will be merge into main soon) see https://github.com/vuejs/core/commit/cd93dad4d97971d30e89924387c2378e8bc43c70
Perfect, thanks! Also make sure to replace the workspace config option with projects. It requires Vitest ^3.2. The 4.beta removes workspace option compeltely.
@edison1105 I've rebased latest main to this branch and it's ready to go. Are you able to re-open this PR? Github doesn't allow me to do that. If not, I'll open a new PR with this branch.
These changes make Vue pass with [email protected]. The beta.6 introduces breaking changes to module mocking and require actual test code changes.
@AriPerkkio Please open a new one.