Repository navigation
Add tests for path edge cases in resolution, emit, and builds - #65667
Open
YT (magurotuna) wants to merge 2 commits into
Open
YT (magurotuna) wants to merge 2 commits into
YT (magurotuna) wants to merge 2 commits into
Conversation
Each test passes on main and fails when the matching tsrs bug is added to the Go code.
…the API Each test passes on main and fails when the matching tsrs bug is added to the Go code. This commit also updates compiler tests from the first commit after a review: decoy files for the trailing slash guards, a different base directory in two tests, and comment fixes.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the path-handling regression coverage.
No open issues 🎉
2 files not reviewed
tsc/testdata/baselines/reference/compiler/mapRootRelativeCaret.js: Generated filetsc/testdata/baselines/reference/compiler/mapRootUrlWithDotDotSegment.js: Generated file
What changed in this PR
Adds regression coverage for path handling across the TypeScript compiler, build pipeline, language service, and API. This follows #65656 and addresses #65657 without changing production behavior.
Changes:
- Adds compiler tests for resolution, references, declaration emit, source maps, and config path edge cases.
- Extends Go tests for URI normalization, rename destinations, output paths, and build recovery.
- Adds expected baselines and a test helper that rejects text replacements when the target text is missing.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/typeReferenceDirectiveTrailingSlashRelativeName.ts |
Tests directory-only relative type references. |
tsc/testdata/tests/cases/compiler/typeReferenceDirectiveDriveRoot.ts |
Tests drive-root type references. |
tsc/testdata/tests/cases/compiler/tsconfigIncludeAbsolutePathWithDotDot.ts |
Tests absolute include-path normalization. |
tsc/testdata/tests/cases/compiler/tripleSlashReferenceDriveRoot.ts |
Tests drive-root file references. |
tsc/testdata/tests/cases/compiler/selfReferencingFileWithoutExtension.ts |
Tests extensionless self-reference detection. |
tsc/testdata/tests/cases/compiler/rootDirWithCaseSensitiveFileNames.ts |
Tests case-sensitive root-directory boundaries. |
tsc/testdata/tests/cases/compiler/packageJsonImportsDirectoryOnlyTarget.ts |
Tests slash-terminated package imports targets. |
tsc/testdata/tests/cases/compiler/nodeNextPackageSelfNameWithOutDirRootDirCaretDirectory.ts |
Tests self-name mapping through caret directories. |
tsc/testdata/tests/cases/compiler/nodeNextPackageSelfNameWithOutDirRootDirAtRoot.ts |
Tests self-name mapping at filesystem root. |
tsc/testdata/tests/cases/compiler/moduleResolutionAsTypeReferenceDirectiveTrailingSlash.ts |
Tests directory-only type-root fallback. |
tsc/testdata/tests/cases/compiler/mapRootUrlWithDotDotSegment.ts |
Tests source-map URL normalization. |
tsc/testdata/tests/cases/compiler/mapRootRelativeCaret.ts |
Tests relative caret map directories. |
tsc/testdata/tests/cases/compiler/declarationEmitIndexDirectoryOutsideImportingDirectory.ts |
Tests preservation of unambiguous /index specifiers. |
tsc/testdata/tests/cases/compiler/declarationEmitExportsTargetTrailingSlash.ts |
Tests directory-only exports during declaration emit. |
tsc/testdata/tests/cases/compiler/declarationEmitExportsPatternTargetTrailingSlash.ts |
Tests directory-only exports patterns during declaration emit. |
tsc/testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-tuple-of-wrong-length.js |
Records recovery from malformed build-info tuples. |
tsc/testdata/baselines/reference/tsc/commandLine/rooted-file-names-in-tsconfig-do-not-exist.js |
Records missing rooted-file diagnostics. |
tsc/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-subfolder-that-has-only-declaration-files-and-outDir.js |
Records subfolder compilation and build outputs. |
tsc/testdata/baselines/reference/tsbuild/configFileErrors/reports-no-inputs-found.js |
Records empty-input build diagnostics. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveTrailingSlashRelativeName.types |
Records directory-resolved global types. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveTrailingSlashRelativeName.trace.json |
Records directory-only reference lookup. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveTrailingSlashRelativeName.symbols |
Records directory-resolved symbols. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveTrailingSlashRelativeName.js |
Records reference fixture emit. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveTrailingSlashRelativeName.errors.txt |
Records exclusion of sibling-file globals. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveDriveRoot.types |
Records drive-root reference type output. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveDriveRoot.trace.json |
Records unresolved drive-root lookup. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveDriveRoot.symbols |
Records drive-root reference symbol output. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveDriveRoot.js |
Records drive-root reference emit. |
tsc/testdata/baselines/reference/compiler/typeReferenceDirectiveDriveRoot.errors.txt |
Records missing drive-root type definitions. |
tsc/testdata/baselines/reference/compiler/tsconfigIncludeAbsolutePathWithDotDot.types |
Records types from both included directories. |
tsc/testdata/baselines/reference/compiler/tsconfigIncludeAbsolutePathWithDotDot.symbols |
Records symbols from both included directories. |
tsc/testdata/baselines/reference/compiler/tsconfigIncludeAbsolutePathWithDotDot.errors.txt |
Records diagnostics proving both files are included. |
tsc/testdata/baselines/reference/compiler/tripleSlashReferenceDriveRoot.types |
Records drive-root file-reference type output. |
tsc/testdata/baselines/reference/compiler/tripleSlashReferenceDriveRoot.symbols |
Records drive-root file-reference symbol output. |
tsc/testdata/baselines/reference/compiler/tripleSlashReferenceDriveRoot.js |
Records drive-root file-reference emit. |
tsc/testdata/baselines/reference/compiler/tripleSlashReferenceDriveRoot.errors.txt |
Records unresolved drive-root file diagnostics. |
tsc/testdata/baselines/reference/compiler/selfReferencingFileWithoutExtension.types |
Records self-referencing file types. |
tsc/testdata/baselines/reference/compiler/selfReferencingFileWithoutExtension.symbols |
Records self-referencing file symbols. |
tsc/testdata/baselines/reference/compiler/selfReferencingFileWithoutExtension.js |
Records self-referencing file emit. |
tsc/testdata/baselines/reference/compiler/selfReferencingFileWithoutExtension.errors.txt |
Records extensionless self-reference diagnostic. |
tsc/testdata/baselines/reference/compiler/rootDirWithCaseSensitiveFileNames.types |
Records case-distinct source types. |
tsc/testdata/baselines/reference/compiler/rootDirWithCaseSensitiveFileNames.symbols |
Records case-distinct source symbols. |
tsc/testdata/baselines/reference/compiler/rootDirWithCaseSensitiveFileNames.js |
Records case-sensitive root-directory emit. |
tsc/testdata/baselines/reference/compiler/rootDirWithCaseSensitiveFileNames.errors.txt |
Records out-of-root diagnostic. |
tsc/testdata/baselines/reference/compiler/packageJsonImportsDirectoryOnlyTarget.types |
Records unresolved imports target types. |
tsc/testdata/baselines/reference/compiler/packageJsonImportsDirectoryOnlyTarget.trace.json |
Records directory-only imports lookup. |
tsc/testdata/baselines/reference/compiler/packageJsonImportsDirectoryOnlyTarget.symbols |
Records unresolved import symbols. |
tsc/testdata/baselines/reference/compiler/packageJsonImportsDirectoryOnlyTarget.errors.txt |
Records directory-target resolution failure. |
tsc/testdata/baselines/reference/compiler/nodeNextPackageSelfNameWithOutDirRootDirCaretDirectory.types |
Records types resolved through a caret directory. |
tsc/testdata/baselines/reference/compiler/nodeNextPackageSelfNameWithOutDirRootDirCaretDirectory.symbols |
Records caret-directory self-name symbols. |
tsc/testdata/baselines/reference/compiler/nodeNextPackageSelfNameWithOutDirRootDirCaretDirectory.errors.txt |
Records type mismatch confirming successful resolution. |
tsc/testdata/baselines/reference/compiler/nodeNextPackageSelfNameWithOutDirRootDirAtRoot.types |
Records filesystem-root self-name types. |
tsc/testdata/baselines/reference/compiler/nodeNextPackageSelfNameWithOutDirRootDirAtRoot.symbols |
Records filesystem-root self-name symbols. |
tsc/testdata/baselines/reference/compiler/moduleResolutionAsTypeReferenceDirectiveTrailingSlash.types |
Records directory-based fallback types. |
tsc/testdata/baselines/reference/compiler/moduleResolutionAsTypeReferenceDirectiveTrailingSlash.trace.json |
Records type-root fallback lookup. |
tsc/testdata/baselines/reference/compiler/moduleResolutionAsTypeReferenceDirectiveTrailingSlash.symbols |
Records type-root fallback symbols. |
tsc/testdata/baselines/reference/compiler/moduleResolutionAsTypeReferenceDirectiveTrailingSlash.js |
Records fallback fixture emit. |
tsc/testdata/baselines/reference/compiler/moduleResolutionAsTypeReferenceDirectiveTrailingSlash.errors.txt |
Records exclusion of sibling-file exports. |
tsc/testdata/baselines/reference/compiler/mapRootUrlWithDotDotSegment.types |
Records URL map-root fixture types. |
tsc/testdata/baselines/reference/compiler/mapRootUrlWithDotDotSegment.symbols |
Records URL map-root fixture symbols. |
tsc/testdata/baselines/reference/compiler/mapRootUrlWithDotDotSegment.sourcemap.txt |
Records normalized map URL and mappings. |
tsc/testdata/baselines/reference/compiler/mapRootUrlWithDotDotSegment.js.map |
Records source-map JSON. |
tsc/testdata/baselines/reference/compiler/mapRootUrlWithDotDotSegment.js |
Records normalized source-map URL comment. |
tsc/testdata/baselines/reference/compiler/mapRootRelativeCaret.types |
Records caret map-root fixture types. |
tsc/testdata/baselines/reference/compiler/mapRootRelativeCaret.symbols |
Records caret map-root fixture symbols. |
tsc/testdata/baselines/reference/compiler/mapRootRelativeCaret.sourcemap.txt |
Records escaped caret URL and relative source. |
tsc/testdata/baselines/reference/compiler/mapRootRelativeCaret.js.map |
Records relative source-map path. |
tsc/testdata/baselines/reference/compiler/mapRootRelativeCaret.js |
Records escaped caret source-map URL. |
tsc/testdata/baselines/reference/compiler/declarationEmitIndexDirectoryOutsideImportingDirectory.types |
Records types using unambiguous index paths. |
tsc/testdata/baselines/reference/compiler/declarationEmitIndexDirectoryOutsideImportingDirectory.symbols |
Records index-directory symbol resolution. |
tsc/testdata/baselines/reference/compiler/declarationEmitIndexDirectoryOutsideImportingDirectory.js |
Records declarations retaining /index. |
tsc/testdata/baselines/reference/compiler/declarationEmitExportsTargetTrailingSlash.types |
Records types unavailable through directory exports. |
tsc/testdata/baselines/reference/compiler/declarationEmitExportsTargetTrailingSlash.symbols |
Records directory-export fixture symbols. |
tsc/testdata/baselines/reference/compiler/declarationEmitExportsTargetTrailingSlash.js |
Records JavaScript emit without declarations. |
tsc/testdata/baselines/reference/compiler/declarationEmitExportsTargetTrailingSlash.errors.txt |
Records declaration portability diagnostic. |
tsc/testdata/baselines/reference/compiler/declarationEmitExportsPatternTargetTrailingSlash.types |
Records types unavailable through directory patterns. |
tsc/testdata/baselines/reference/compiler/declarationEmitExportsPatternTargetTrailingSlash.symbols |
Records directory-pattern fixture symbols. |
tsc/testdata/baselines/reference/compiler/declarationEmitExportsPatternTargetTrailingSlash.js |
Records JavaScript emit without declarations. |
tsc/testdata/baselines/reference/compiler/declarationEmitExportsPatternTargetTrailingSlash.errors.txt |
Records pattern-related declaration portability diagnostic. |
tsc/internal/tsoptions/extensionsiblings_test.go |
Tests literal-source precedence over declaration siblings. |
tsc/internal/outputpaths/outputpaths_test.go |
Tests drive-like config filename stems. |
tsc/internal/module/resolver_test.go |
Tests file and directory encoding under dynamic type roots. |
tsc/internal/ls/lsconv/converters_test.go |
Tests encoded drive-root URI conversion. |
tsc/internal/fourslash/tests/renameFilePackageJson_test.go |
Tests normalized rename destination URIs. |
tsc/internal/execute/tsctests/tscbuild_test.go |
Tests builds with no matching inputs. |
tsc/internal/execute/tsctests/tsc_test.go |
Tests subfolder projects, rooted files, and malformed build info. |
tsc/internal/execute/tsctests/sys.go |
Adds text replacement that fails on missing targets. |
tsc/internal/api/session_program_test.go |
Tests trailing-slash filenames across API queries. |
Review effort: Balanced
This was referenced Nov 25, 2026
This branch has not been deployed
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.
Fixes #65657
Follow-up to #65656.
This PR adds 15 compiler tests and 10 Go tests. It changes only tests and one test helper. Each test would have caught a tsrs bug that the existing tests missed. The test also fails if you add the same bug to the Go code.
/, drive roots (C:), type roots under^/URIs,importstargets that are directories, and package self-names withoutDirandrootDir(tsrs#1007, tsrs#1008, tsrs#1009, tsrs#1049, tsrs#1079).exportstargets that end with/, and an/indexspecifier next to a file with the same name (tsrs#1024, tsrs#1077).mapRootwith..and^, and the build info name of ac:.jsonconfig (tsrs#1040, tsrs#1063).includepaths with..,rootDirwith case-sensitive names, andfilesentries that are rooted or have a.d.tssibling (tsrs#1021, tsrs#1052, tsrs#1053, tsrs#1064).tscandtsc -b:-pwith a subfolder, a build with no inputs, and build info tuples of the wrong length (tsrs#1022, tsrs#1025, tsrs#1050). The build info edits use a new helper,replaceFileTextNoMiss, that panics when the text to replace is missing.file:///d%3AURI, and API file names that end with/(tsrs#1039, tsrs#1061, tsrs#1065).One test differs from TypeScript 6:
selfReferencingFileWithoutExtensionexpects TS1006 for/// <reference path="a" />ina.ts. TypeScript 6 reports TS1006 only forpath="a.ts".