-
Notifications
You must be signed in to change notification settings - Fork 397
refactor: use Vitest projects config instead of deprecated workspace #361
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
- Add root vitest.config.ts with projects array (replaces deprecated workspace) - Add name property to each project's vitest.config.ts for filtering - Update package.json test scripts to use vitest projects - Add vitest to root devDependencies This addresses the Vitest warning about multiple configs impacting performance by running all projects in a single Vitest process. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 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. Comment |
Summary of ChangesHello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the project's testing infrastructure by adopting Vitest's Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This is a great refactoring to adopt the modern projects feature in Vitest, which should improve performance as noted. The changes look correct and align with the goal of replacing the deprecated workspace functionality. I have a couple of suggestions to further improve the maintainability of the new test configuration, mainly around using glob patterns to avoid manually updating lists of projects in the future. Overall, a solid improvement.
package.json
Outdated
| "test:server:coverage": "npm run test:cov --workspace=apps/server", | ||
| "test:packages": "npm run test -w @automaker/types -w @automaker/utils -w @automaker/prompts -w @automaker/platform -w @automaker/model-resolver -w @automaker/dependency-resolver -w @automaker/git-utils --if-present", | ||
| "test:all": "npm run test:packages && npm run test:server", | ||
| "test:packages": "vitest run --project=utils --project=platform --project=prompts --project=model-resolver --project=dependency-resolver --project=git-utils", |
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.
This command is quite long and lists all package projects explicitly. This could become difficult to maintain as more packages are added. A more maintainable approach would be to create a separate configuration file for testing packages.
For example, you could create a vitest.packages.config.ts file in the root with this content:
// vitest.packages.config.ts
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
projects: ['libs/*'],
},
});Then you could simplify the script to use this new config file.
| "test:packages": "vitest run --project=utils --project=platform --project=prompts --project=model-resolver --project=dependency-resolver --project=git-utils", | |
| "test:packages": "vitest run -c vitest.packages.config.ts", |
Address PR review feedback: - Use 'libs/*/vitest.config.ts' glob to auto-discover lib projects - Simplify test:packages script to use --project='!server' exclusion - New libs with vitest.config.ts will be automatically included 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@gemini-code-assist re-review |
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.
Code Review
This pull request refactors the project's test setup to leverage Vitest's project configuration, moving from npm run test --workspace commands to vitest run --project commands. The changes include adding a name property to the vitest.config.ts files within various apps and libs directories, creating a new root vitest.config.ts to define test projects using glob patterns, and updating package.json scripts to reflect these changes, along with adding vitest as a dev dependency. Review comments noted that the libs/types package might no longer have its tests executed due to the new project discovery mechanism, as no vitest.config.ts was added for it, and suggested making the apps/server project path more explicit in the root vitest.config.ts for consistency.
Address PR review feedback for consistency - use full path 'apps/server/vitest.config.ts' instead of just 'apps/server'. Note: libs/types has no tests (type definitions only), so it doesn't need a vitest.config.ts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
vitest.config.tswith projects array (replaces deprecated workspace feature)nameproperty to each project's vitest.config.ts for filtering with--projectThis addresses the Vitest warning about having 5+ config files impacting performance by running all projects in a single Vitest process using the new
test.projectsconfiguration (introduced in Vitest 3.2 as replacement for workspace).Test plan
npm run test:unitruns all projectsnpm run test:packagesruns only lib testsnpm run test:serverruns only server tests--project=model-resolver)🤖 Generated with Claude Code