Skip to content

refactor: extract shared config logic from sauce.config.cjs/mjs#316

Open
anupam-sl wants to merge 2 commits into
mainfrom
refactor/modularize-sauce-config
Open

refactor: extract shared config logic from sauce.config.cjs/mjs#316
anupam-sl wants to merge 2 commits into
mainfrom
refactor/modularize-sauce-config

Conversation

@anupam-sl
Copy link
Copy Markdown
Contributor

@anupam-sl anupam-sl commented Feb 18, 2026

Summary

  • The CJS and MJS entrypoints were ~95% identical, differing only in import/export syntax and config loading (require vs await import)
  • Extracts shared merge logic into sauce-config-shared.cjs so changes only need to be made once
  • The shared module is CJS so both entrypoints can consume it (ESM can import CJS). This loses tree-shaking, but it's not too much of an issue since these are small config files running in Node.js at build time
  • Fixes a pre-existing inconsistency where the MJS file was missing contextOptions: {} in the initial overrides

Note: This PR is based on fix/merge-project-level-context-options (#315) — merge that first

anupam-sl and others added 2 commits February 18, 2026 16:34
Playwright resolves project config by replacing root-level `use`
properties with project-level ones. When a project defines its own
`use.contextOptions` (e.g. reducedMotion), it completely overrides
the root-level contextOptions — losing the SC tunnel proxy settings
and causing scripted requests to fail with ENOTFOUND.

This iterates over user-defined projects and merges proxy settings
into each project's contextOptions so both coexist.

Fixes INT-11

Co-Authored-By: Claude Opus 4.6 <[email protected]>
The CJS and MJS entrypoints were ~95% identical, differing only in
import/export syntax and config loading (require vs await import).
This extracts the shared merge logic into sauce-config-shared.cjs
so changes only need to be made once.

The shared module is CJS so both entrypoints can consume it
(ESM can import CJS). This loses tree-shaking, but it's irrelevant
since these are small config files running in Node.js at build time.
@anupam-sl anupam-sl requested a review from a team as a code owner February 18, 2026 16:18
@mayank-at-sauce mayank-at-sauce force-pushed the fix/merge-project-level-context-options branch from 77f6bbf to a2acba2 Compare March 2, 2026 16:18
Base automatically changed from fix/merge-project-level-context-options to main March 2, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant