Skip to content

fix(test): resolve tsconfig extends via Node resolution - #41997

Closed
pravinireri wants to merge 1 commit into
microsoft:mainfrom
pravinireri:fix/tsconfig-extends-package-resolution-41989
Closed

fix(test): resolve tsconfig extends via Node resolution#41997
pravinireri wants to merge 1 commit into
microsoft:mainfrom
pravinireri:fix/tsconfig-extends-package-resolution-41989

Conversation

@pravinireri

Copy link
Copy Markdown
Contributor

Summary

Resolves bare specifiers in tsconfig.json extends using Node module resolution.

Why

Playwright 1.62 started failing loudly when a tsconfig extends path cannot be resolved. That exposed a regression where Playwright could not resolve package-based tsconfig extends that TypeScript resolves successfully.

This affected cases such as:

  • hoisted config packages, for example foo/tsconfig.json
  • package exports subpaths, for example @repo/tsconfig/next
  • root package exports, for example typescript-config-silverwind

Change

Falls back to Node resolution for bare extends specifiers when the existing relative and immediate node_modules probes do not resolve the config.

Relative and absolute extends behavior is unchanged, and genuinely unresolvable extends paths still fail loudly.

Tests

  • npm run ttest -- resolver.spec.ts --grep "extends"

Fixes #41989

…olution

Bare specifiers are now resolved like tsc does - walking up node_modules
directories and honoring package.json "exports"/"main" - via require.resolve.
Relative and absolute "extends" paths, and the loud failure for unresolvable
paths, are unchanged.

Fixes: microsoft#41989
Copilot AI review requested due to automatic review settings July 27, 2026 10:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes Playwright’s tsconfig loader to resolve bare extends specifiers using Node-style module resolution (matching tsc behavior), addressing a 1.62 regression where previously-unresolved package-based extends paths now fail loudly.

Changes:

  • Add a fallback in resolveConfigFile() to require.resolve() bare extends specifiers (walk-up node_modules, honoring package.json exports/main) before throwing.
  • Add resolver tests covering hoisted config packages, exports subpaths, root export resolution, and the still-failing unresolvable bare specifier case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/playwright/src/transform/tsconfig-loader.ts Adds Node module-resolution fallback for bare extends specifiers when existing probes fail.
tests/playwright-test/resolver.spec.ts Adds regression tests for hoisted packages and package.json exports-based tsconfig resolution.

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.

[Regression]: tsconfig "extends" bare specifier isn't resolved via node_modules walk-up like tsc (fatal since 1.62)

3 participants