Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for inline project configuration in the projects field, allowing users to define multiple test projects directly in the configuration without creating separate config files. This feature simplifies project setup for scenarios where multiple test environments need different configurations.
- Updates type definitions to support both string and object configurations in the projects array
- Modifies project resolution logic to handle inline configuration objects
- Adds comprehensive documentation in both English and Chinese
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/core/src/types/config.ts |
Adds ProjectConfig type and updates TestProject to support inline configs |
packages/core/src/types/core.ts |
Updates ProjectContext to use NormalizedProjectConfig type |
packages/core/src/core/rstest.ts |
Updates type casting for project configuration normalization |
packages/core/src/cli/init.ts |
Implements logic to handle inline project configurations during resolution |
e2e/projects/inline.test.ts |
Adds end-to-end test for inline project configuration feature |
e2e/projects/fixtures/rstest.inline.config.ts |
Test fixture demonstrating inline project configuration |
website/docs/en/config/test/projects.mdx |
Updates English documentation with inline config examples |
website/docs/zh/config/test/projects.mdx |
Updates Chinese documentation with inline config examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const config = withDefaultConfig( | ||
| project.config, | ||
| ) as NormalizedProjectConfig; |
There was a problem hiding this comment.
The type assertion as NormalizedProjectConfig is potentially unsafe. Consider using a type guard or ensuring withDefaultConfig returns the correct type to avoid runtime type mismatches.
| ).reduce( | ||
| (total, p) => { | ||
| const projectStr = p.replace('<rootDir>', root); | ||
| if (typeof p === 'object') { |
There was a problem hiding this comment.
The type check typeof p === 'object' will return true for null values, which could cause runtime errors. Use typeof p === 'object' && p !== null or p && typeof p === 'object' to safely check for object types.
| if (typeof p === 'object') { | |
| if (typeof p === 'object' && p !== null) { |
Summary
Supports configuring projects inline in the
projectsfield. This lets you define multiple test projects in a single root without creating separate config files for each test project.Related Links
Checklist