fix(test): resolve tsconfig extends via Node resolution - #41997
Closed
pravinireri wants to merge 1 commit into
Closed
fix(test): resolve tsconfig extends via Node resolution#41997pravinireri wants to merge 1 commit into
pravinireri wants to merge 1 commit into
Conversation
…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
Contributor
There was a problem hiding this comment.
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()torequire.resolve()bareextendsspecifiers (walk-upnode_modules, honoringpackage.jsonexports/main) before throwing. - Add resolver tests covering hoisted config packages,
exportssubpaths, 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. |
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
Resolves bare specifiers in
tsconfig.jsonextendsusing Node module resolution.Why
Playwright 1.62 started failing loudly when a tsconfig
extendspath 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:
foo/tsconfig.json@repo/tsconfig/nexttypescript-config-silverwindChange
Falls back to Node resolution for bare
extendsspecifiers when the existing relative and immediatenode_modulesprobes do not resolve the config.Relative and absolute
extendsbehavior is unchanged, and genuinely unresolvableextendspaths still fail loudly.Tests
npm run ttest -- resolver.spec.ts --grep "extends"Fixes #41989