Skip to content

feat(core): support composing multiple extends configs#1060

Merged
fi3ework merged 2 commits intomainfrom
feat/extends-array-composition
Mar 17, 2026
Merged

feat(core): support composing multiple extends configs#1060
fi3ework merged 2 commits intomainfrom
feat/extends-array-composition

Conversation

@fi3ework
Copy link
Copy Markdown
Member

Summary

Background

extends only accepted a single config source, which made it awkward to compose shared presets and adapter output in one Rstest config.

Implementation

  • allow extends to accept ExtendConfig, ExtendConfigFn, or an array of mixed entries
  • resolve array entries independently against the original user config, then merge them left-to-right before applying local config
  • add coverage for top-level config and inline project config, and document the merge precedence and function semantics in both docs

User Impact

Users can now combine multiple extends sources in one config while keeping deterministic override behavior.

Checklist

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

Validation

  • Ran pnpm --filter @rstest/core test -- 'tests/extends.test.ts'
  • Ran pnpm --filter @rstest/core test -- 'tests/cli/init.test.ts'
  • Skipped the full repo validation suite locally, so this PR is opened as draft

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying rstest with  Cloudflare Pages  Cloudflare Pages

Latest commit: 302a86b
Status: ✅  Deploy successful!
Preview URL: https://bf8741a7.rstest.pages.dev
Branch Preview URL: https://feat-extends-array-compositi.rstest.pages.dev

View logs

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

Adds support for composing multiple extends sources in @rstest/core config, enabling users to layer presets/adapters deterministically while keeping local config as the highest-precedence override.

Changes:

  • Allow extends to accept a single entry or an array of mixed ExtendConfig / ExtendConfigFn entries.
  • Centralize extends resolution in resolveExtends and reuse it for both top-level config loading and inline project configs.
  • Update docs (EN/ZH) and add test coverage for array semantics and function input behavior.

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
website/docs/zh/config/test/extends.mdx Documents array extends, precedence, and function semantics (ZH).
website/docs/en/config/test/extends.mdx Documents array extends, precedence, and function semantics (EN).
website/AGENTS.md Adds docs guidance for TypeScript signature formatting in documentation.
packages/core/tests/extends.test.ts Adds tests for top-level extends arrays and function input semantics.
packages/core/tests/cli/init.test.ts Adds tests for inline project configs using extends arrays.
packages/core/src/types/config.ts Expands RstestConfig.extends type to accept arrays.
packages/core/src/config.ts Implements resolveExtends to resolve/merge multiple entries.
packages/core/src/cli/init.ts Switches inline project extends handling to resolveExtends.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@fi3ework fi3ework requested a review from 9aoy March 17, 2026 06:33
@fi3ework fi3ework marked this pull request as ready for review March 17, 2026 06:33
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3630ac1977

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fi3ework fi3ework merged commit b61a43a into main Mar 17, 2026
10 checks passed
@fi3ework fi3ework deleted the feat/extends-array-composition branch March 17, 2026 07:01
@9aoy 9aoy mentioned this pull request Mar 18, 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.

3 participants