fix: handle projects using extends configuration correctly#843
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 handling the extends configuration in project definitions within the rstest testing framework. Projects can now extend base configurations either directly or via async functions, enabling better configuration reuse across test projects.
Key changes:
- Added extends handling logic for inline project configurations
- Refactored project processing from
reducetoPromise.allfor better parallelization - Added comprehensive e2e test coverage with fixtures testing both function-based and object-based extends
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/cli/init.ts | Added extends configuration handling for projects and refactored project resolution to use Promise.all for parallel processing |
| e2e/projects/index.test.ts | Added test case to verify projects with extends configuration run correctly |
| e2e/projects/fixtures/extends/rstest.config.ts | Test fixture demonstrating both function and object extends patterns |
| e2e/projects/fixtures/extends/base.config.ts | Base configuration that sets globals:true for reuse across projects |
| e2e/projects/fixtures/extends/project-a/test.ts | Test file for project-a |
| e2e/projects/fixtures/extends/project-b/test.ts | Test file for project-b |
| e2e/projects/fixtures/extends/rstestEnv.d.ts | TypeScript definitions for rstest globals |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| delete (extendsConfig as RstestConfig).projects; | ||
| projectConfig = mergeRstestConfig(extendsConfig, projectConfig); |
There was a problem hiding this comment.
The code mutates the extendsConfig object by deleting its projects property. When projectConfig.extends is a direct object reference (not a function), this will mutate the original shared config object. This could cause issues if the same base config is reused across multiple projects. Consider creating a shallow copy before deletion: const extendsConfigCopy = { ...extendsConfig }; delete extendsConfigCopy.projects; or use object destructuring: const { projects, ...extendsConfigCopy } = extendsConfig;
| delete (extendsConfig as RstestConfig).projects; | |
| projectConfig = mergeRstestConfig(extendsConfig, projectConfig); | |
| const { projects: _ignored, ...extendsConfigWithoutProjects } = | |
| extendsConfig as RstestConfig; | |
| projectConfig = mergeRstestConfig( | |
| extendsConfigWithoutProjects, | |
| projectConfig, | |
| ); |
Summary
should run projects with
extendsconfiguration correctly.Related Links
Checklist