diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts
index 69ad855b626..3f515944a07 100644
--- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts
+++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts
@@ -262,5 +262,49 @@ a;b;
verifyDirSymlink("when import matches disk but directory symlink target does not", `${projectRoot}/XY`, `${projectRoot}/XY`, `./Xy`);
verifyDirSymlink("when import and directory symlink target agree but do not match disk", `${projectRoot}/XY`, `${projectRoot}/Xy`, `./Xy`);
verifyDirSymlink("when import, directory symlink target, and disk are all different", `${projectRoot}/XY`, `${projectRoot}/Xy`, `./yX`);
+
+ verifyTscWatch({
+ scenario: "forceConsistentCasingInFileNames",
+ subScenario: "with nodeNext resolution",
+ commandLineArgs: ["--w", "--explainFiles"],
+ sys: () => createWatchedSystem({
+ "/Users/name/projects/web/src/bin.ts": `import { foo } from "yargs";`,
+ "/Users/name/projects/web/node_modules/@types/yargs/index.d.ts": "export function foo(): void;",
+ "/Users/name/projects/web/node_modules/@types/yargs/index.d.mts": "export function foo(): void;",
+ "/Users/name/projects/web/node_modules/@types/yargs/package.json": JSON.stringify({
+ name: "yargs",
+ version: "17.0.12",
+ exports: {
+ ".": {
+ types: {
+ import: "./index.d.mts",
+ default: "./index.d.ts"
+ }
+ },
+ // "./helpers": {
+ // types: {
+ // "import": "./helpers.d.mts",
+ // "default": "./helpers.d.ts"
+ // }
+ // },
+ // "./yargs": {
+ // "types": {
+ // "default": "./yargs.d.ts"
+ // }
+ // },
+ // "./package.json": "./package.json"
+ }
+ }),
+ "/Users/name/projects/web/tsconfig.json": JSON.stringify({
+ compilerOptions: {
+ moduleResolution: "nodenext",
+ forceConsistentCasingInFileNames: true,
+ traceResolution: true,
+ }
+ }),
+ [libFile.path]: libFile.content,
+ }, { currentDirectory: "/Users/name/projects/web" }),
+ changes: emptyArray,
+ });
});
}
diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/with-nodeNext-resolution.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/with-nodeNext-resolution.js
new file mode 100644
index 00000000000..2e965971da3
--- /dev/null
+++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/with-nodeNext-resolution.js
@@ -0,0 +1,150 @@
+Input::
+//// [/Users/name/projects/web/src/bin.ts]
+import { foo } from "yargs";
+
+//// [/Users/name/projects/web/node_modules/@types/yargs/index.d.ts]
+export function foo(): void;
+
+//// [/Users/name/projects/web/node_modules/@types/yargs/index.d.mts]
+export function foo(): void;
+
+//// [/Users/name/projects/web/node_modules/@types/yargs/package.json]
+{"name":"yargs","version":"17.0.12","exports":{".":{"types":{"import":"./index.d.mts","default":"./index.d.ts"}}}}
+
+//// [/Users/name/projects/web/tsconfig.json]
+{"compilerOptions":{"moduleResolution":"nodenext","forceConsistentCasingInFileNames":true,"traceResolution":true}}
+
+//// [/a/lib/lib.d.ts]
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+
+
+/a/lib/tsc.js --w --explainFiles
+Output::
+>> Screen clear
+[[90m12:00:35 AM[0m] Starting compilation in watch mode...
+
+File '/users/name/projects/web/src/package.json' does not exist.
+File '/users/name/projects/web/package.json' does not exist.
+File '/users/name/projects/package.json' does not exist.
+File '/users/name/package.json' does not exist.
+File '/users/package.json' does not exist.
+File '/package.json' does not exist.
+======== Resolving module 'yargs' from '/Users/name/projects/web/src/bin.ts'. ========
+Explicitly specified module resolution kind: 'NodeNext'.
+File '/users/name/projects/web/src/package.json' does not exist according to earlier cached lookups.
+File '/users/name/projects/web/package.json' does not exist according to earlier cached lookups.
+File '/users/name/projects/package.json' does not exist according to earlier cached lookups.
+File '/users/name/package.json' does not exist according to earlier cached lookups.
+File '/users/package.json' does not exist according to earlier cached lookups.
+File '/package.json' does not exist according to earlier cached lookups.
+Loading module 'yargs' from 'node_modules' folder, target file type 'TypeScript'.
+Directory '/Users/name/projects/web/src/node_modules' does not exist, skipping all lookups in it.
+File '/Users/name/projects/web/node_modules/yargs.ts' does not exist.
+File '/Users/name/projects/web/node_modules/yargs.tsx' does not exist.
+File '/Users/name/projects/web/node_modules/yargs.d.ts' does not exist.
+Found 'package.json' at '/Users/name/projects/web/node_modules/@types/yargs/package.json'.
+'package.json' does not have a 'typesVersions' field.
+File '/users/name/projects/web/node_modules/@types/yargs/index.d.ts' exist - use it as a name resolution result.
+Resolving real path for '/users/name/projects/web/node_modules/@types/yargs/index.d.ts', result '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts'.
+======== Module name 'yargs' was successfully resolved to '/users/name/projects/web/node_modules/@types/yargs/index.d.ts' with Package ID 'yargs/index.d.ts@17.0.12'. ========
+File '/users/name/projects/web/node_modules/@types/yargs/package.json' exists according to earlier cached lookups.
+======== Resolving type reference directive 'yargs', containing file '/Users/name/projects/web/__inferred type names__.ts', root directory '/Users/name/projects/web/node_modules/@types'. ========
+Resolving with primary search path '/Users/name/projects/web/node_modules/@types'.
+File '/Users/name/projects/web/node_modules/@types/yargs/package.json' exists according to earlier cached lookups.
+'package.json' does not have a 'typings' field.
+'package.json' does not have a 'types' field.
+File '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts' exist - use it as a name resolution result.
+Resolving real path for '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts', result '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts'.
+======== Type reference directive 'yargs' was successfully resolved to '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts' with Package ID 'yargs/index.d.ts@17.0.12', primary: true. ========
+File '/a/lib/package.json' does not exist.
+File '/a/package.json' does not exist.
+File '/package.json' does not exist according to earlier cached lookups.
+[96msrc/bin.ts[0m:[93m1[0m:[93m21[0m - [91merror[0m[90m TS1261: [0mAlready included file name '/users/name/projects/web/node_modules/@types/yargs/index.d.ts' differs from file name '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts' only in casing.
+ The file is in the program because:
+ Imported via "yargs" from file '/Users/name/projects/web/src/bin.ts' with packageId 'yargs/index.d.ts@17.0.12'
+ Entry point for implicit type library 'yargs' with packageId 'yargs/index.d.ts@17.0.12'
+ File is CommonJS module because '/users/name/projects/web/node_modules/@types/yargs/package.json' does not have field "type"
+
+[7m1[0m import { foo } from "yargs";
+[7m [0m [91m ~~~~~~~[0m
+
+../../../../a/lib/lib.d.ts
+ Default library for target 'es3'
+node_modules/@types/yargs/index.d.ts
+ Imported via "yargs" from file 'src/bin.ts' with packageId 'yargs/index.d.ts@17.0.12'
+ Entry point for implicit type library 'yargs' with packageId 'yargs/index.d.ts@17.0.12'
+ File is CommonJS module because 'node_modules/@types/yargs/package.json' does not have field "type"
+src/bin.ts
+ Matched by default include pattern '**/*'
+ File is CommonJS module because 'package.json' was not found
+[[90m12:00:38 AM[0m] Found 1 error. Watching for file changes.
+
+
+
+Program root files: ["/Users/name/projects/web/src/bin.ts"]
+Program options: {"moduleResolution":99,"forceConsistentCasingInFileNames":true,"traceResolution":true,"watch":true,"explainFiles":true,"configFilePath":"/Users/name/projects/web/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.d.ts
+/users/name/projects/web/node_modules/@types/yargs/index.d.ts
+/Users/name/projects/web/src/bin.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.d.ts
+/users/name/projects/web/node_modules/@types/yargs/index.d.ts
+/Users/name/projects/web/src/bin.ts
+
+Shape signatures in builder refreshed for::
+/a/lib/lib.d.ts (used version)
+/users/name/projects/web/node_modules/@types/yargs/index.d.ts (used version)
+/users/name/projects/web/src/bin.ts (used version)
+
+WatchedFiles::
+/users/name/projects/web/tsconfig.json:
+ {"fileName":"/Users/name/projects/web/tsconfig.json","pollingInterval":250}
+/users/name/projects/web/src/bin.ts:
+ {"fileName":"/Users/name/projects/web/src/bin.ts","pollingInterval":250}
+/users/name/projects/web/node_modules/@types/yargs/index.d.ts:
+ {"fileName":"/users/name/projects/web/node_modules/@types/yargs/index.d.ts","pollingInterval":250}
+/a/lib/lib.d.ts:
+ {"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
+/users/name/projects/web/node_modules/@types/yargs/package.json:
+ {"fileName":"/Users/name/projects/web/node_modules/@types/yargs/package.json","pollingInterval":250}
+/users/name/projects/web/src/package.json:
+ {"fileName":"/Users/name/projects/web/src/package.json","pollingInterval":250}
+/users/name/projects/web/package.json:
+ {"fileName":"/Users/name/projects/web/package.json","pollingInterval":250}
+/users/name/projects/package.json:
+ {"fileName":"/Users/name/projects/package.json","pollingInterval":250}
+
+FsWatches::
+/users/name/projects/web:
+ {"directoryName":"/Users/name/projects/web"}
+
+FsWatchesRecursive::
+/users/name/projects/web/src:
+ {"directoryName":"/users/name/projects/web/src"}
+/users/name/projects/web/node_modules:
+ {"directoryName":"/Users/name/projects/web/node_modules"}
+/users/name/projects/web/node_modules/@types:
+ {"directoryName":"/Users/name/projects/web/node_modules/@types"}
+/users/name/projects/web:
+ {"directoryName":"/users/name/projects/web"}
+
+exitCode:: ExitStatus.undefined
+
+//// [/Users/name/projects/web/src/bin.js]
+"use strict";
+exports.__esModule = true;
+
+