Skip to content

fix: handle projects using extends configuration correctly#843

Merged
9aoy merged 2 commits intomainfrom
project-extends
Jan 8, 2026
Merged

fix: handle projects using extends configuration correctly#843
9aoy merged 2 commits intomainfrom
project-extends

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Jan 8, 2026

Summary

should run projects with extends configuration correctly.

export default defineConfig({
  projects: [
    {
      extends: withRslibConfig({ libId: 'node' }),
      include: ['tests/node/**/*.{test,spec}.?(c|m)[jt]s'],
    },
    {
      extends: withRslibConfig({ libId: 'react' }),
      include: ['tests/react/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
    },
  ],
});

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 8, 2026 04:04
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 8, 2026

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 51c31a3
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/695f2edf14bafc000840cafb
😎 Deploy Preview https://deploy-preview-843--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 reduce to Promise.all for 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.

Comment on lines +198 to +199
delete (extendsConfig as RstestConfig).projects;
projectConfig = mergeRstestConfig(extendsConfig, projectConfig);
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Suggested change
delete (extendsConfig as RstestConfig).projects;
projectConfig = mergeRstestConfig(extendsConfig, projectConfig);
const { projects: _ignored, ...extendsConfigWithoutProjects } =
extendsConfig as RstestConfig;
projectConfig = mergeRstestConfig(
extendsConfigWithoutProjects,
projectConfig,
);

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit 0ce27d0 into main Jan 8, 2026
23 of 25 checks passed
@9aoy 9aoy deleted the project-extends branch January 8, 2026 06:06
@9aoy 9aoy mentioned this pull request Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants