feat(browser): add providerOptions for browser mode config#1041
Merged
feat(browser): add providerOptions for browser mode config#1041
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploying rstest with
|
| Latest commit: |
995c7a6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b694e3de.rstest.pages.dev |
| Branch Preview URL: | https://feat-browser-provider-option.rstest.pages.dev |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opaque browser.providerOptions passthrough to Browser Mode configuration so users can forward provider-specific options (not interpreted by rstest) to the underlying provider (Playwright).
Changes:
- Extend core config types/defaults to include
browser.providerOptionsand normalize it to{}. - Thread
providerOptionsthrough browser host/controller + provider contracts, validate it as a plain object, and enforce cross-project consistency (deep equality). - Update Playwright provider runtime to consume
providerOptions.launch/providerOptions.context, add tests, and document usage (EN/ZH) with a newApiMetacomponent.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/theme/components/ConfigOverview.tsx | Adds browser.providerOptions to config overview navigation/grouping. |
| website/theme/components/ApiMeta.tsx | New doc component for “Added/Deprecated/Removed in” metadata. |
| website/theme/components/ApiMeta.module.scss | Styles for the new ApiMeta component. |
| website/docs/zh/config/test/coverage.mdx | Uses ApiMeta instead of inline version text. |
| website/docs/zh/config/test/browser.mdx | Documents providerOptions + Playwright conventions and satisfies typing pattern. |
| website/docs/en/config/test/coverage.mdx | Uses ApiMeta instead of inline version text. |
| website/docs/en/config/test/browser.mdx | Documents providerOptions + Playwright conventions and satisfies typing pattern. |
| packages/core/tests/core/snapshots/rstest.test.ts.snap | Updates snapshots to include providerOptions: {} in normalized browser config. |
| packages/core/tests/snapshots/config.test.ts.snap | Updates config merge snapshot to include providerOptions: {}. |
| packages/core/src/types/config.ts | Adds providerOptions to BrowserModeConfig and NormalizedBrowserModeConfig. |
| packages/core/src/config.ts | Sets default + normalized providerOptions to {}. |
| packages/browser/tests/playwrightRuntime.test.ts | New test verifying passthrough behavior for launch/context options. |
| packages/browser/src/providers/playwright/runtime.ts | Reads providerOptions.launch/providerOptions.context and wraps newContext. |
| packages/browser/src/providers/playwright/implementation.ts | Threads providerOptions into Playwright runtime launch. |
| packages/browser/src/providers/index.ts | Extends provider contracts with providerOptions and documents provider-neutral policy. |
| packages/browser/src/index.ts | Minor cleanup in exports formatting. |
| packages/browser/src/hostController.ts | Stores and forwards providerOptions, and enforces consistency across projects using deep equality. |
| packages/browser/src/configValidation.ts | Validates browser.providerOptions is a plain object in normalized config. |
| packages/browser/AGENTS.md | Adds provider-agnostic design guidelines for Browser Mode. |
| AGENTS.md | Adds guidance to avoid namespace imports unless required by module shape. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add an opaque `providerOptions` field to `BrowserModeConfig` that lets
users forward provider-specific options (e.g. Playwright launch/context
options) through rstest's browser mode configuration.
- Add `providerOptions: Record<string, unknown>` to config types and
normalization (defaults to `{}`)
- Pass providerOptions through the full chain: config → launch → newContext
- Playwright provider spreads `.launch` into `browserType.launch()` and
`.context` into `browser.newContext()`
- Validate providerOptions is a plain object
- Enforce cross-project consistency via `isDeepStrictEqual`
- Remove framework-owned provider type exports (provider-agnostic boundary)
- Add unit test for launch/context passthrough
- Document providerOptions config and Playwright provider options (en/zh)
… for version badges
608a84a to
995c7a6
Compare
9aoy
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
browser.providerOptionsfield (Record<string, unknown>) to browser mode config, allowing users to forward provider-specific options through rstest without the framework interpreting themproviderOptions.launch(spread intobrowserType.launch()) andproviderOptions.context(spread intobrowser.newContext())satisfiespattern for type safety (en/zh)Motivation
Resolves the request in #1013 (reply in thread) — users with large projects need to configure Playwright-specific options (e.g. launch timeout) that rstest doesn't expose as first-class config.
Design
providerOptionsis an opaque passthrough — the framework does not validate, decode, or translate its contents. The entire bag is forwarded to the provider at both browser launch and context creation time. The provider decides how to interpret the keys.For Playwright, the convention is:
providerOptions.launch→browserType.launch()providerOptions.context→browser.newContext()Users get type safety via the
satisfiespattern with types imported directly from theplaywrightpackage — no provider-specific types are exported from@rstest/browser.Changes
packages/core/src/types/config.ts,packages/core/src/config.tspackages/browser/src/configValidation.tspackages/browser/src/providers/index.tspackages/browser/src/hostController.tspackages/browser/src/providers/playwright/runtime.ts,implementation.tspackages/browser/src/index.ts(removed provider type re-export)packages/browser/tests/playwrightRuntime.test.tswebsite/docs/{en,zh}/config/test/browser.mdx,ConfigOverview.tsxAGENTS.md,packages/browser/AGENTS.md