From 4c44730157ec2331e9fe2d376591ccab29c23a9c Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 16 Dec 2020 09:35:15 -0800 Subject: [PATCH 1/8] Test that forceConsistentCasingInFileNames does not apply to Windows drive roots --- .../forceConsistentCasingInFileNames.ts | 42 +++++ ...n-Windows-style-drive-root-is-lowercase.js | 167 ++++++++++++++++++ ...n-Windows-style-drive-root-is-uppercase.js | 167 ++++++++++++++++++ 3 files changed, 376 insertions(+) create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-lowercase.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-uppercase.js diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 529c39dce6044..5e952bb535325 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -119,5 +119,47 @@ export const Fragment: unique symbol; ], { currentDirectory: projectRoot }), changes: emptyArray, }); + + function verifyWindowsStyleRoot(subScenario: string, windowsStyleRoot: string, projectRootRelative: string) { + verifyTscWatch({ + scenario: "forceConsistentCasingInFileNames", + subScenario, + commandLineArgs: ["--w", "--p", `${windowsStyleRoot}/${projectRootRelative}`, "--explainFiles"], + sys: () => { + const moduleA: File = { + path: `${windowsStyleRoot}/${projectRootRelative}/a.ts`, + content: ` +export const a = 1; +export const b = 2; +` + }; + const moduleB: File = { + path: `${windowsStyleRoot}/${projectRootRelative}/b.ts`, + content: ` +import { a } from "${windowsStyleRoot.toLocaleUpperCase()}/${projectRootRelative}/a" +import { b } from "${windowsStyleRoot.toLocaleLowerCase()}/${projectRootRelative}/a" + +a;b; +` + }; + const tsconfig: File = { + path: `${windowsStyleRoot}/${projectRootRelative}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }) + }; + return createWatchedSystem([moduleA, moduleB, libFile, tsconfig], { windowsStyleRoot, useCaseSensitiveFileNames: false }); + }, + changes: [ + { + caption: "Prepend a line to moduleA", + change: sys => sys.prependFile(`${windowsStyleRoot}/${projectRootRelative}/a.ts`, `// some comment + `), + timeouts: runQueuedTimeoutCallbacks, + } + ], + }); + } + + verifyWindowsStyleRoot("when Windows-style drive root is lowercase", "c:/", "project"); + verifyWindowsStyleRoot("when Windows-style drive root is uppercase", "C:/", "project"); }); } diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-lowercase.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-lowercase.js new file mode 100644 index 0000000000000..be8c628ae9556 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-lowercase.js @@ -0,0 +1,167 @@ +Input:: +//// [c:/project/a.ts] + +export const a = 1; +export const b = 2; + + +//// [c:/project/b.ts] + +import { a } from "C://project/a" +import { b } from "c://project/a" + +a;b; + + +//// [c:/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; } + +//// [c:/project/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + + +c:/a/lib/tsc.js --w --p c://project --explainFiles +Output:: +>> Screen clear +[12:00:17 AM] Starting compilation in watch mode... + +a/lib/lib.d.ts + Default library +project/a.ts + Matched by include pattern '**/*' in 'project/tsconfig.json' + Imported via "C://project/a" from file 'project/b.ts' + Imported via "c://project/a" from file 'project/b.ts' +project/b.ts + Matched by include pattern '**/*' in 'project/tsconfig.json' +[12:00:22 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["c:/project/a.ts","c:/project/b.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"c:/project","explainFiles":true,"configFilePath":"c:/project/tsconfig.json"} +Program structureReused: Not +Program files:: +c:/a/lib/lib.d.ts +c:/project/a.ts +c:/project/b.ts + +Semantic diagnostics in builder refreshed for:: +c:/a/lib/lib.d.ts +c:/project/a.ts +c:/project/b.ts + +WatchedFiles:: +c:/project/tsconfig.json: + {"fileName":"c:/project/tsconfig.json","pollingInterval":250} +c:/project/a.ts: + {"fileName":"c:/project/a.ts","pollingInterval":250} +c:/project/b.ts: + {"fileName":"c:/project/b.ts","pollingInterval":250} +c:/a/lib/lib.d.ts: + {"fileName":"c:/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +c:/project/node_modules/@types: + {"directoryName":"c:/project/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +c:/project: + {"directoryName":"c:/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [c:/project/a.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [c:/project/b.js] +"use strict"; +exports.__esModule = true; +var a_1 = require("C://project/a"); +var a_2 = require("c://project/a"); +a_1.a; +a_2.b; + + + +Change:: Prepend a line to moduleA + +Input:: +//// [c:/project/a.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:25 AM] File change detected. Starting incremental compilation... + +a/lib/lib.d.ts + Default library +project/a.ts + Matched by include pattern '**/*' in 'project/tsconfig.json' + Imported via "C://project/a" from file 'project/b.ts' + Imported via "c://project/a" from file 'project/b.ts' +project/b.ts + Matched by include pattern '**/*' in 'project/tsconfig.json' +[12:00:29 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["c:/project/a.ts","c:/project/b.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"c:/project","explainFiles":true,"configFilePath":"c:/project/tsconfig.json"} +Program structureReused: Completely +Program files:: +c:/a/lib/lib.d.ts +c:/project/a.ts +c:/project/b.ts + +Semantic diagnostics in builder refreshed for:: +c:/project/a.ts + +WatchedFiles:: +c:/project/tsconfig.json: + {"fileName":"c:/project/tsconfig.json","pollingInterval":250} +c:/project/a.ts: + {"fileName":"c:/project/a.ts","pollingInterval":250} +c:/project/b.ts: + {"fileName":"c:/project/b.ts","pollingInterval":250} +c:/a/lib/lib.d.ts: + {"fileName":"c:/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +c:/project/node_modules/@types: + {"directoryName":"c:/project/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +c:/project: + {"directoryName":"c:/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [c:/project/a.js] +"use strict"; +// some comment +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-uppercase.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-uppercase.js new file mode 100644 index 0000000000000..be614e1be69fc --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-uppercase.js @@ -0,0 +1,167 @@ +Input:: +//// [C:/project/a.ts] + +export const a = 1; +export const b = 2; + + +//// [C:/project/b.ts] + +import { a } from "C://project/a" +import { b } from "c://project/a" + +a;b; + + +//// [C:/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; } + +//// [C:/project/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + + +C:/a/lib/tsc.js --w --p C://project --explainFiles +Output:: +>> Screen clear +[12:00:17 AM] Starting compilation in watch mode... + +a/lib/lib.d.ts + Default library +project/a.ts + Matched by include pattern '**/*' in 'project/tsconfig.json' + Imported via "C://project/a" from file 'project/b.ts' + Imported via "c://project/a" from file 'project/b.ts' +project/b.ts + Matched by include pattern '**/*' in 'project/tsconfig.json' +[12:00:22 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["C:/project/a.ts","C:/project/b.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"C:/project","explainFiles":true,"configFilePath":"C:/project/tsconfig.json"} +Program structureReused: Not +Program files:: +C:/a/lib/lib.d.ts +C:/project/a.ts +C:/project/b.ts + +Semantic diagnostics in builder refreshed for:: +C:/a/lib/lib.d.ts +C:/project/a.ts +C:/project/b.ts + +WatchedFiles:: +c:/project/tsconfig.json: + {"fileName":"C:/project/tsconfig.json","pollingInterval":250} +c:/project/a.ts: + {"fileName":"C:/project/a.ts","pollingInterval":250} +c:/project/b.ts: + {"fileName":"C:/project/b.ts","pollingInterval":250} +c:/a/lib/lib.d.ts: + {"fileName":"C:/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +c:/project/node_modules/@types: + {"directoryName":"C:/project/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +c:/project: + {"directoryName":"c:/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [C:/project/a.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [C:/project/b.js] +"use strict"; +exports.__esModule = true; +var a_1 = require("C://project/a"); +var a_2 = require("c://project/a"); +a_1.a; +a_2.b; + + + +Change:: Prepend a line to moduleA + +Input:: +//// [C:/project/a.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:25 AM] File change detected. Starting incremental compilation... + +a/lib/lib.d.ts + Default library +project/a.ts + Matched by include pattern '**/*' in 'project/tsconfig.json' + Imported via "C://project/a" from file 'project/b.ts' + Imported via "c://project/a" from file 'project/b.ts' +project/b.ts + Matched by include pattern '**/*' in 'project/tsconfig.json' +[12:00:29 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["C:/project/a.ts","C:/project/b.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"C:/project","explainFiles":true,"configFilePath":"C:/project/tsconfig.json"} +Program structureReused: Completely +Program files:: +C:/a/lib/lib.d.ts +C:/project/a.ts +C:/project/b.ts + +Semantic diagnostics in builder refreshed for:: +C:/project/a.ts + +WatchedFiles:: +c:/project/tsconfig.json: + {"fileName":"C:/project/tsconfig.json","pollingInterval":250} +c:/project/a.ts: + {"fileName":"C:/project/a.ts","pollingInterval":250} +c:/project/b.ts: + {"fileName":"C:/project/b.ts","pollingInterval":250} +c:/a/lib/lib.d.ts: + {"fileName":"C:/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +c:/project/node_modules/@types: + {"directoryName":"C:/project/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +c:/project: + {"directoryName":"c:/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [C:/project/a.js] +"use strict"; +// some comment +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + From b5ef1974474090bd16a45823510b62f64648b552 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 16 Dec 2020 10:02:53 -0800 Subject: [PATCH 2/8] Add file symlink baselines --- .../forceConsistentCasingInFileNames.ts | 50 +++++ ...le-symlink-target-and-import-match-disk.js | 187 ++++++++++++++++ ...target-matches-disk-but-import-does-not.js | 187 ++++++++++++++++ ...link-target,-and-disk-are-all-different.js | 203 ++++++++++++++++++ ...link-target-agree-but-do-not-match-disk.js | 203 ++++++++++++++++++ ...s-disk-but-file-symlink-target-does-not.js | 203 ++++++++++++++++++ 6 files changed, 1033 insertions(+) create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 5e952bb535325..6f46b29a3f451 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -161,5 +161,55 @@ a;b; verifyWindowsStyleRoot("when Windows-style drive root is lowercase", "c:/", "project"); verifyWindowsStyleRoot("when Windows-style drive root is uppercase", "C:/", "project"); + + function verifyFileSymlink(subScenario: string, diskPath: string, targetPath: string, importedPath: string) { + verifyTscWatch({ + scenario: "forceConsistentCasingInFileNames", + subScenario, + commandLineArgs: ["--w", "--p", ".", "--explainFiles"], + sys: () => { + const moduleA: File = { + + path: diskPath, + content: ` +export const a = 1; +export const b = 2; +` + }; + const symlinkA: SymLink = { + path: `${projectRoot}/link.ts`, + symLink: targetPath, + }; + const moduleB: File = { + path: `${projectRoot}/b.ts`, + content: ` +import { a } from "${importedPath}"; +import { b } from "./link"; + +a;b; +` + }; + const tsconfig: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true } }) + }; + return createWatchedSystem([moduleA, symlinkA, moduleB, libFile, tsconfig], { currentDirectory: projectRoot }); + }, + changes: [ + { + caption: "Prepend a line to moduleA", + change: sys => sys.prependFile(diskPath, `// some comment + `), + timeouts: runQueuedTimeoutCallbacks, + } + ], + }); + } + + verifyFileSymlink("when both file symlink target and import match disk", `${projectRoot}/XY.ts`, `${projectRoot}/XY.ts`, `./XY`); + verifyFileSymlink("when file symlink target matches disk but import does not", `${projectRoot}/XY.ts`, `${projectRoot}/Xy.ts`, `./XY`); + verifyFileSymlink("when import matches disk but file symlink target does not", `${projectRoot}/XY.ts`, `${projectRoot}/XY.ts`, `./Xy`); + verifyFileSymlink("when import and file symlink target agree but do not match disk", `${projectRoot}/XY.ts`, `${projectRoot}/Xy.ts`, `./Xy`); + verifyFileSymlink("when import, file symlink target, and disk are all different", `${projectRoot}/XY.ts`, `${projectRoot}/Xy.ts`, `./yX`); }); } diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js new file mode 100644 index 0000000000000..aa3710e0b14ad --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js @@ -0,0 +1,187 @@ +Input:: +//// [/user/username/projects/myproject/XY.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link.ts] symlink(/user/username/projects/myproject/XY.ts) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./XY"; +import { b } from "./link"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:25 AM] Starting compilation in watch mode... + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./XY" from file 'b.ts' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:32 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/link.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var XY_1 = require("./XY"); +var link_1 = require("./link"); +XY_1.a; +link_1.b; + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:35 AM] File change detected. Starting incremental compilation... + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./XY" from file 'b.ts' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:39 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/XY.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +// some comment +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js new file mode 100644 index 0000000000000..5db86671fcff3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js @@ -0,0 +1,187 @@ +Input:: +//// [/user/username/projects/myproject/XY.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link.ts] symlink(/user/username/projects/myproject/Xy.ts) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./XY"; +import { b } from "./link"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:25 AM] Starting compilation in watch mode... + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./XY" from file 'b.ts' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:32 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/link.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var XY_1 = require("./XY"); +var link_1 = require("./link"); +XY_1.a; +link_1.b; + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:35 AM] File change detected. Starting incremental compilation... + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./XY" from file 'b.ts' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:39 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/XY.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +// some comment +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js new file mode 100644 index 0000000000000..9d53e28a9f3a9 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js @@ -0,0 +1,203 @@ +Input:: +//// [/user/username/projects/myproject/XY.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link.ts] symlink(/user/username/projects/myproject/Xy.ts) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./yX"; +import { b } from "./link"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:25 AM] Starting compilation in watch mode... + +b.ts:2:19 - error TS2307: Cannot find module './yX' or its corresponding type declarations. + +2 import { a } from "./yX"; +   ~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:32 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/yx: + {"directoryName":"/user/username/projects/myproject/yX","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/link.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var yX_1 = require("./yX"); +var link_1 = require("./link"); +yX_1.a; +link_1.b; + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:35 AM] File change detected. Starting incremental compilation... + +b.ts:2:19 - error TS2307: Cannot find module './yX' or its corresponding type declarations. + +2 import { a } from "./yX"; +   ~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:39 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/XY.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/yx: + {"directoryName":"/user/username/projects/myproject/yX","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +// some comment +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js new file mode 100644 index 0000000000000..22c56569ca66a --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js @@ -0,0 +1,203 @@ +Input:: +//// [/user/username/projects/myproject/XY.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link.ts] symlink(/user/username/projects/myproject/Xy.ts) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./Xy"; +import { b } from "./link"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:25 AM] Starting compilation in watch mode... + +b.ts:2:19 - error TS1149: File name '/user/username/projects/myproject/Xy.ts' differs from already included file name '/user/username/projects/myproject/XY.ts' only in casing. + The file is in the program because: + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./Xy" from file '/user/username/projects/myproject/b.ts' + +2 import { a } from "./Xy"; +   ~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./Xy" from file 'b.ts' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:32 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/link.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var Xy_1 = require("./Xy"); +var link_1 = require("./link"); +Xy_1.a; +link_1.b; + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:35 AM] File change detected. Starting incremental compilation... + +b.ts:2:19 - error TS1149: File name '/user/username/projects/myproject/Xy.ts' differs from already included file name '/user/username/projects/myproject/XY.ts' only in casing. + The file is in the program because: + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./Xy" from file '/user/username/projects/myproject/b.ts' + +2 import { a } from "./Xy"; +   ~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./Xy" from file 'b.ts' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:39 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/XY.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +// some comment +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js new file mode 100644 index 0000000000000..5bc74f65d8df3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js @@ -0,0 +1,203 @@ +Input:: +//// [/user/username/projects/myproject/XY.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link.ts] symlink(/user/username/projects/myproject/XY.ts) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./Xy"; +import { b } from "./link"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:25 AM] Starting compilation in watch mode... + +b.ts:2:19 - error TS1149: File name '/user/username/projects/myproject/Xy.ts' differs from already included file name '/user/username/projects/myproject/XY.ts' only in casing. + The file is in the program because: + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./Xy" from file '/user/username/projects/myproject/b.ts' + +2 import { a } from "./Xy"; +   ~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./Xy" from file 'b.ts' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:32 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/link.js] +"use strict"; +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var Xy_1 = require("./Xy"); +var link_1 = require("./link"); +Xy_1.a; +link_1.b; + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:35 AM] File change detected. Starting incremental compilation... + +b.ts:2:19 - error TS1149: File name '/user/username/projects/myproject/Xy.ts' differs from already included file name '/user/username/projects/myproject/XY.ts' only in casing. + The file is in the program because: + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./Xy" from file '/user/username/projects/myproject/b.ts' + +2 import { a } from "./Xy"; +   ~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +XY.ts + Matched by include pattern '**/*' in 'tsconfig.json' + Imported via "./Xy" from file 'b.ts' +link.ts + Imported via "./link" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:39 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/XY.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/link.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY.ts +/user/username/projects/myproject/link.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/XY.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/xy.ts: + {"fileName":"/user/username/projects/myproject/XY.ts","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link.ts: + {"fileName":"/user/username/projects/myproject/link.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/XY.js] +"use strict"; +// some comment +exports.__esModule = true; +exports.b = exports.a = void 0; +exports.a = 1; +exports.b = 2; + + From 41e9014c26894ad1fff991470733d2c148e2fb6d Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 16 Dec 2020 10:17:55 -0800 Subject: [PATCH 3/8] Add directory symlink baselines --- .../forceConsistentCasingInFileNames.ts | 51 ++++ ...ry-symlink-target-and-import-match-disk.js | 239 ++++++++++++++++ ...target-matches-disk-but-import-does-not.js | 239 ++++++++++++++++ ...link-target,-and-disk-are-all-different.js | 251 +++++++++++++++++ ...link-target-agree-but-do-not-match-disk.js | 255 ++++++++++++++++++ ...k-but-directory-symlink-target-does-not.js | 255 ++++++++++++++++++ 6 files changed, 1290 insertions(+) create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 6f46b29a3f451..13bce7cc839a2 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -211,5 +211,56 @@ a;b; verifyFileSymlink("when import matches disk but file symlink target does not", `${projectRoot}/XY.ts`, `${projectRoot}/XY.ts`, `./Xy`); verifyFileSymlink("when import and file symlink target agree but do not match disk", `${projectRoot}/XY.ts`, `${projectRoot}/Xy.ts`, `./Xy`); verifyFileSymlink("when import, file symlink target, and disk are all different", `${projectRoot}/XY.ts`, `${projectRoot}/Xy.ts`, `./yX`); + + function verifyDirSymlink(subScenario: string, diskPath: string, targetPath: string, importedPath: string) { + verifyTscWatch({ + scenario: "forceConsistentCasingInFileNames", + subScenario, + commandLineArgs: ["--w", "--p", ".", "--explainFiles"], + sys: () => { + const moduleA: File = { + + path: `${diskPath}/a.ts`, + content: ` +export const a = 1; +export const b = 2; +` + }; + const symlinkA: SymLink = { + path: `${projectRoot}/link`, + symLink: targetPath, + }; + const moduleB: File = { + path: `${projectRoot}/b.ts`, + content: ` +import { a } from "${importedPath}/a"; +import { b } from "./link/a"; + +a;b; +` + }; + const tsconfig: File = { + path: `${projectRoot}/tsconfig.json`, + // Use outFile because otherwise the real and linked files will have the same output path + content: JSON.stringify({ compilerOptions: { forceConsistentCasingInFileNames: true, outFile: "out.js", module: "system" } }) + }; + return createWatchedSystem([moduleA, symlinkA, moduleB, libFile, tsconfig], { currentDirectory: projectRoot }); + }, + changes: [ + { + caption: "Prepend a line to moduleA", + change: sys => sys.prependFile(`${diskPath}/a.ts`, `// some comment + `), + timeouts: runQueuedTimeoutCallbacks, + } + ], + }); + } + + verifyDirSymlink("when both directory symlink target and import match disk", `${projectRoot}/XY`, `${projectRoot}/XY`, `./XY`); + verifyDirSymlink("when directory symlink target matches disk but import does not", `${projectRoot}/XY`, `${projectRoot}/Xy`, `./XY`); + 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`); }); } diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js new file mode 100644 index 0000000000000..181eee57a71c5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js @@ -0,0 +1,239 @@ +Input:: +//// [/user/username/projects/myproject/XY/a.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link] symlink(/user/username/projects/myproject/XY) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./XY/a"; +import { b } from "./link/a"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true,"outFile":"out.js","module":"system"}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:27 AM] Starting compilation in watch mode... + +../../../../a/lib/lib.d.ts + Default library +XY/a.ts + Imported via "./XY/a" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:30 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY/a.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/XY/a.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +System.register("XY/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () { + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("link/a", [], function (exports_2, context_2) { + "use strict"; + var a, b; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("a", a = 1); + exports_2("b", b = 2); + } + }; +}); +System.register("b", ["XY/a", "link/a"], function (exports_3, context_3) { + "use strict"; + var a_1, a_2; + var __moduleName = context_3 && context_3.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY/a.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:33 AM] File change detected. Starting incremental compilation... + +../../../../a/lib/lib.d.ts + Default library +XY/a.ts + Imported via "./XY/a" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:37 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY/a.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/XY/a.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +// some comment +System.register("XY/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () {// some comment + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("link/a", [], function (exports_2, context_2) { + "use strict"; + var a, b; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("a", a = 1); + exports_2("b", b = 2); + } + }; +}); +System.register("b", ["XY/a", "link/a"], function (exports_3, context_3) { + "use strict"; + var a_1, a_2; + var __moduleName = context_3 && context_3.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js new file mode 100644 index 0000000000000..dea0a4fec861c --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js @@ -0,0 +1,239 @@ +Input:: +//// [/user/username/projects/myproject/XY/a.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link] symlink(/user/username/projects/myproject/Xy) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./XY/a"; +import { b } from "./link/a"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true,"outFile":"out.js","module":"system"}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:27 AM] Starting compilation in watch mode... + +../../../../a/lib/lib.d.ts + Default library +XY/a.ts + Imported via "./XY/a" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:30 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY/a.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/XY/a.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +System.register("XY/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () { + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("link/a", [], function (exports_2, context_2) { + "use strict"; + var a, b; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("a", a = 1); + exports_2("b", b = 2); + } + }; +}); +System.register("b", ["XY/a", "link/a"], function (exports_3, context_3) { + "use strict"; + var a_1, a_2; + var __moduleName = context_3 && context_3.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY/a.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:33 AM] File change detected. Starting incremental compilation... + +../../../../a/lib/lib.d.ts + Default library +XY/a.ts + Imported via "./XY/a" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:37 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/XY/a.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/XY/a.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +// some comment +System.register("XY/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () {// some comment + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("link/a", [], function (exports_2, context_2) { + "use strict"; + var a, b; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("a", a = 1); + exports_2("b", b = 2); + } + }; +}); +System.register("b", ["XY/a", "link/a"], function (exports_3, context_3) { + "use strict"; + var a_1, a_2; + var __moduleName = context_3 && context_3.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js new file mode 100644 index 0000000000000..430cef763a643 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js @@ -0,0 +1,251 @@ +Input:: +//// [/user/username/projects/myproject/XY/a.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link] symlink(/user/username/projects/myproject/Xy) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./yX/a"; +import { b } from "./link/a"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true,"outFile":"out.js","module":"system"}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:27 AM] Starting compilation in watch mode... + +b.ts:2:19 - error TS2792: Cannot find module './yX/a'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { a } from "./yX/a"; +   ~~~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +XY/a.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:30 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/XY/a.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/XY/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/yx: + {"directoryName":"/user/username/projects/myproject/yX","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +System.register("link/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () { + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("b", ["./yX/a", "link/a"], function (exports_2, context_2) { + "use strict"; + var a_1, a_2; + var __moduleName = context_2 && context_2.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); +System.register("XY/a", [], function (exports_3, context_3) { + "use strict"; + var a, b; + var __moduleName = context_3 && context_3.id; + return { + setters: [], + execute: function () { + exports_3("a", a = 1); + exports_3("b", b = 2); + } + }; +}); + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY/a.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:33 AM] File change detected. Starting incremental compilation... + +b.ts:2:19 - error TS2792: Cannot find module './yX/a'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? + +2 import { a } from "./yX/a"; +   ~~~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +XY/a.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:37 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/XY/a.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/XY/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/yx: + {"directoryName":"/user/username/projects/myproject/yX","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +System.register("link/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () { + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("b", ["./yX/a", "link/a"], function (exports_2, context_2) { + "use strict"; + var a_1, a_2; + var __moduleName = context_2 && context_2.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); +// some comment +System.register("XY/a", [], function (exports_3, context_3) { + "use strict"; + var a, b; + var __moduleName = context_3 && context_3.id; + return { + setters: [], + execute: function () {// some comment + exports_3("a", a = 1); + exports_3("b", b = 2); + } + }; +}); + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js new file mode 100644 index 0000000000000..6f50b59b2ae9a --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js @@ -0,0 +1,255 @@ +Input:: +//// [/user/username/projects/myproject/XY/a.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link] symlink(/user/username/projects/myproject/Xy) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./Xy/a"; +import { b } from "./link/a"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true,"outFile":"out.js","module":"system"}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:27 AM] Starting compilation in watch mode... + +b.ts:2:19 - error TS1261: Already included file name '/user/username/projects/myproject/Xy/a.ts' differs from file name '/user/username/projects/myproject/XY/a.ts' only in casing. + The file is in the program because: + Imported via "./Xy/a" from file '/user/username/projects/myproject/b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' + +2 import { a } from "./Xy/a"; +   ~~~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +Xy/a.ts + Imported via "./Xy/a" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:30 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/Xy/a.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/Xy/a.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +System.register("Xy/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () { + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("link/a", [], function (exports_2, context_2) { + "use strict"; + var a, b; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("a", a = 1); + exports_2("b", b = 2); + } + }; +}); +System.register("b", ["Xy/a", "link/a"], function (exports_3, context_3) { + "use strict"; + var a_1, a_2; + var __moduleName = context_3 && context_3.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY/a.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:33 AM] File change detected. Starting incremental compilation... + +b.ts:2:19 - error TS1261: Already included file name '/user/username/projects/myproject/Xy/a.ts' differs from file name '/user/username/projects/myproject/XY/a.ts' only in casing. + The file is in the program because: + Imported via "./Xy/a" from file '/user/username/projects/myproject/b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' + +2 import { a } from "./Xy/a"; +   ~~~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +Xy/a.ts + Imported via "./Xy/a" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:37 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/Xy/a.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/Xy/a.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +// some comment +System.register("Xy/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () {// some comment + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("link/a", [], function (exports_2, context_2) { + "use strict"; + var a, b; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("a", a = 1); + exports_2("b", b = 2); + } + }; +}); +System.register("b", ["Xy/a", "link/a"], function (exports_3, context_3) { + "use strict"; + var a_1, a_2; + var __moduleName = context_3 && context_3.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); + + diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js new file mode 100644 index 0000000000000..67d0909b607e3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js @@ -0,0 +1,255 @@ +Input:: +//// [/user/username/projects/myproject/XY/a.ts] + +export const a = 1; +export const b = 2; + + +//// [/user/username/projects/myproject/link] symlink(/user/username/projects/myproject/XY) +//// [/user/username/projects/myproject/b.ts] + +import { a } from "./Xy/a"; +import { b } from "./link/a"; + +a;b; + + +//// [/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; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true,"outFile":"out.js","module":"system"}} + + +/a/lib/tsc.js --w --p . --explainFiles +Output:: +>> Screen clear +[12:00:27 AM] Starting compilation in watch mode... + +b.ts:2:19 - error TS1261: Already included file name '/user/username/projects/myproject/Xy/a.ts' differs from file name '/user/username/projects/myproject/XY/a.ts' only in casing. + The file is in the program because: + Imported via "./Xy/a" from file '/user/username/projects/myproject/b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' + +2 import { a } from "./Xy/a"; +   ~~~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +Xy/a.ts + Imported via "./Xy/a" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:30 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/Xy/a.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/Xy/a.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +System.register("Xy/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () { + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("link/a", [], function (exports_2, context_2) { + "use strict"; + var a, b; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("a", a = 1); + exports_2("b", b = 2); + } + }; +}); +System.register("b", ["Xy/a", "link/a"], function (exports_3, context_3) { + "use strict"; + var a_1, a_2; + var __moduleName = context_3 && context_3.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); + + + +Change:: Prepend a line to moduleA + +Input:: +//// [/user/username/projects/myproject/XY/a.ts] +// some comment + +export const a = 1; +export const b = 2; + + + +Output:: +>> Screen clear +[12:00:33 AM] File change detected. Starting incremental compilation... + +b.ts:2:19 - error TS1261: Already included file name '/user/username/projects/myproject/Xy/a.ts' differs from file name '/user/username/projects/myproject/XY/a.ts' only in casing. + The file is in the program because: + Imported via "./Xy/a" from file '/user/username/projects/myproject/b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' + +2 import { a } from "./Xy/a"; +   ~~~~~~~~ + +../../../../a/lib/lib.d.ts + Default library +Xy/a.ts + Imported via "./Xy/a" from file 'b.ts' + Matched by include pattern '**/*' in 'tsconfig.json' +link/a.ts + Imported via "./link/a" from file 'b.ts' +b.ts + Matched by include pattern '**/*' in 'tsconfig.json' +[12:00:37 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/b.ts","/user/username/projects/myproject/XY/a.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"outFile":"/user/username/projects/myproject/out.js","module":4,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/Xy/a.ts +/user/username/projects/myproject/link/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"fileName":"/user/username/projects/myproject/b.ts","pollingInterval":250} +/user/username/projects/myproject/xy/a.ts: + {"fileName":"/user/username/projects/myproject/Xy/a.ts","pollingInterval":250} +/user/username/projects/myproject/link/a.ts: + {"fileName":"/user/username/projects/myproject/link/a.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/out.js] +// some comment +System.register("Xy/a", [], function (exports_1, context_1) { + "use strict"; + var a, b; + var __moduleName = context_1 && context_1.id; + return { + setters: [], + execute: function () {// some comment + exports_1("a", a = 1); + exports_1("b", b = 2); + } + }; +}); +System.register("link/a", [], function (exports_2, context_2) { + "use strict"; + var a, b; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("a", a = 1); + exports_2("b", b = 2); + } + }; +}); +System.register("b", ["Xy/a", "link/a"], function (exports_3, context_3) { + "use strict"; + var a_1, a_2; + var __moduleName = context_3 && context_3.id; + return { + setters: [ + function (a_1_1) { + a_1 = a_1_1; + }, + function (a_2_1) { + a_2 = a_2_1; + } + ], + execute: function () { + a_1.a; + a_2.b; + } + }; +}); + + From 70e99f92803db1960552ed5610b9476129234559 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 15 Dec 2020 15:47:18 -0800 Subject: [PATCH 4/8] Update test to retain its meaning Its purpose is (apparently) to demonstrate that forceConsistenCasingInFileNames can interact badly with synthesized react imports. Since the casing of the synthesized import has changed, also modify the casing of the explicit reference to still conflict. --- .../tscWatch/forceConsistentCasingInFileNames.ts | 2 +- .../jsxImportSource-option-changed.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 13bce7cc839a2..5199b780b06e3 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -113,7 +113,7 @@ export const Fragment: unique symbol; path: `${projectRoot}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { jsx: "react-jsx", jsxImportSource: "react", forceConsistentCasingInFileNames: true }, - files: ["node_modules/react/Jsx-runtime/index.d.ts", "index.tsx"] + files: ["node_modules/react/jsx-Runtime/index.d.ts", "index.tsx"] // NB: casing does not match disk }) } ], { currentDirectory: projectRoot }), diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js index 87e836285298e..87cfcd2ce0d08 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js @@ -33,7 +33,7 @@ export const Fragment: unique symbol; export const App = () =>
; //// [/user/username/projects/myproject/tsconfig.json] -{"compilerOptions":{"jsx":"react-jsx","jsxImportSource":"react","forceConsistentCasingInFileNames":true},"files":["node_modules/react/Jsx-runtime/index.d.ts","index.tsx"]} +{"compilerOptions":{"jsx":"react-jsx","jsxImportSource":"react","forceConsistentCasingInFileNames":true},"files":["node_modules/react/jsx-Runtime/index.d.ts","index.tsx"]} /a/lib/tsc.js --w --p . --explainFiles @@ -41,19 +41,19 @@ Output:: >> Screen clear [12:00:31 AM] Starting compilation in watch mode... -error TS1149: File name '/user/username/projects/myproject/node_modules/react/jsx-runtime/index.d.ts' differs from already included file name '/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts' only in casing. +error TS1149: File name '/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts' differs from already included file name '/user/username/projects/myproject/node_modules/react/jsx-Runtime/index.d.ts' only in casing. The file is in the program because: Part of 'files' list in tsconfig.json Imported via "react/jsx-runtime" from file '/user/username/projects/myproject/index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions tsconfig.json:1:115 - 1 {"compilerOptions":{"jsx":"react-jsx","jsxImportSource":"react","forceConsistentCasingInFileNames":true},"files":["node_modules/react/Jsx-runtime/index.d.ts","index.tsx"]} + 1 {"compilerOptions":{"jsx":"react-jsx","jsxImportSource":"react","forceConsistentCasingInFileNames":true},"files":["node_modules/react/jsx-Runtime/index.d.ts","index.tsx"]}    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ File is matched by 'files' list specified here. ../../../../a/lib/lib.d.ts Default library -node_modules/react/Jsx-runtime/index.d.ts +node_modules/react/jsx-Runtime/index.d.ts Part of 'files' list in tsconfig.json Imported via "react/jsx-runtime" from file 'index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions index.tsx @@ -62,12 +62,12 @@ index.tsx -Program root files: ["/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts","/user/username/projects/myproject/index.tsx"] +Program root files: ["/user/username/projects/myproject/node_modules/react/jsx-Runtime/index.d.ts","/user/username/projects/myproject/index.tsx"] Program options: {"jsx":4,"jsxImportSource":"react","forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject","explainFiles":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts +/user/username/projects/myproject/node_modules/react/jsx-Runtime/index.d.ts /user/username/projects/myproject/index.tsx No cached semantic diagnostics in the builder:: @@ -76,7 +76,7 @@ WatchedFiles:: /user/username/projects/myproject/tsconfig.json: {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} /user/username/projects/myproject/node_modules/react/jsx-runtime/index.d.ts: - {"fileName":"/user/username/projects/myproject/node_modules/react/Jsx-runtime/index.d.ts","pollingInterval":250} + {"fileName":"/user/username/projects/myproject/node_modules/react/jsx-Runtime/index.d.ts","pollingInterval":250} /user/username/projects/myproject/index.tsx: {"fileName":"/user/username/projects/myproject/index.tsx","pollingInterval":250} /a/lib/lib.d.ts: From f57ae3998608997078df87f146b1cc8902dd7f2c Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 15 Dec 2020 15:15:28 -0800 Subject: [PATCH 5/8] Make VFSWithWatch.realpath use the path on disk --- src/harness/virtualFileSystemWithWatch.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index e01f52c11868d..e17136d67e385 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -828,9 +828,9 @@ interface Array { length: number; [n: number]: T; }` return undefined; } - const realpath = this.realpath(path); + const realpath = this.toPath(this.realpath(path)); if (path !== realpath) { - return this.getRealFsEntry(isFsEntry, this.toPath(realpath)); + return this.getRealFsEntry(isFsEntry, realpath); } return undefined; @@ -1097,7 +1097,8 @@ interface Array { length: number; [n: number]: T; }` return this.realpath(fsEntry.symLink); } - return realFullPath; + // realpath supports non-existent files, so there may not be an fsEntry + return fsEntry?.fullPath || realFullPath; } readonly exitMessage = "System Exit"; From 2bccda798a73ebdc8bbb479c8a26c62246a32237 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 15 Dec 2020 17:25:40 -0800 Subject: [PATCH 6/8] Update VFS realpathSync to behave like realpathSync.native --- src/harness/collectionsImpl.ts | 5 +++++ src/harness/vfsUtil.ts | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/harness/collectionsImpl.ts b/src/harness/collectionsImpl.ts index e149960b5e9f6..3d6a53a80cf4b 100644 --- a/src/harness/collectionsImpl.ts +++ b/src/harness/collectionsImpl.ts @@ -50,6 +50,11 @@ namespace collections { return index >= 0 ? this._values[index] : undefined; } + public getKeyAndValue(key: K): [ K, V ] | [ undefined, undefined ] { + const index = ts.binarySearch(this._keys, key, ts.identity, this._comparer); + return index >= 0 ? [ this._keys[index], this._values[index] ] : [ undefined, undefined ]; + } + public set(key: K, value: V) { const index = ts.binarySearch(this._keys, key, ts.identity, this._comparer); if (index >= 0) { diff --git a/src/harness/vfsUtil.ts b/src/harness/vfsUtil.ts index 974c164976c2a..bf16c08a6e921 100644 --- a/src/harness/vfsUtil.ts +++ b/src/harness/vfsUtil.ts @@ -1036,8 +1036,11 @@ namespace vfs { while (true) { if (depth >= 40) throw createIOError("ELOOP"); const lastStep = step === components.length - 1; - const basename = components[step]; - const node = links.get(basename); + let basename = components[step]; + const [key, node] = links.getKeyAndValue(basename); + if (key) { + components[step] = basename = key; + } if (lastStep && (noFollow || !isSymlink(node))) { return { realpath: vpath.format(components), basename, parent, links, node }; } From b325dba31575eeb7d428f5886c08154e55ddf87a Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 27 Oct 2020 17:50:56 -0700 Subject: [PATCH 7/8] Use fs.realpathSync.native when available In local measurements of an Office project, we saw initial project loading get 5% faster on Windows and 13% faster on Linux. The only identified behavioral change is that it restores the case used on disk, whereas realpathSync retains the input lowercase. --- src/compiler/sys.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 0b3080138d6b8..d6990c3462df4 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1185,6 +1185,8 @@ namespace ts { let activeSession: import("inspector").Session | "stopping" | undefined; let profilePath = "./profile.cpuprofile"; + const realpathSync = _fs.realpathSync.native ?? _fs.realpathSync; + const Buffer: { new (input: string, encoding?: string): any; from?(input: string, encoding?: string): any; @@ -1749,7 +1751,7 @@ namespace ts { function realpath(path: string): string { try { - return _fs.realpathSync(path); + return realpathSync(path); } catch { return path; From fca073b1dcc352ddc6cd738a7f1bac1b8d4f79c7 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Fri, 18 Dec 2020 07:32:24 -0800 Subject: [PATCH 8/8] Rename SortedMap.getKeyAndValue to getEntry --- src/harness/collectionsImpl.ts | 4 ++-- src/harness/vfsUtil.ts | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/harness/collectionsImpl.ts b/src/harness/collectionsImpl.ts index 3d6a53a80cf4b..3d617901ddb77 100644 --- a/src/harness/collectionsImpl.ts +++ b/src/harness/collectionsImpl.ts @@ -50,9 +50,9 @@ namespace collections { return index >= 0 ? this._values[index] : undefined; } - public getKeyAndValue(key: K): [ K, V ] | [ undefined, undefined ] { + public getEntry(key: K): [ K, V ] | undefined { const index = ts.binarySearch(this._keys, key, ts.identity, this._comparer); - return index >= 0 ? [ this._keys[index], this._values[index] ] : [ undefined, undefined ]; + return index >= 0 ? [ this._keys[index], this._values[index] ] : undefined; } public set(key: K, value: V) { diff --git a/src/harness/vfsUtil.ts b/src/harness/vfsUtil.ts index bf16c08a6e921..c1fb99326bc36 100644 --- a/src/harness/vfsUtil.ts +++ b/src/harness/vfsUtil.ts @@ -1037,10 +1037,11 @@ namespace vfs { if (depth >= 40) throw createIOError("ELOOP"); const lastStep = step === components.length - 1; let basename = components[step]; - const [key, node] = links.getKeyAndValue(basename); - if (key) { - components[step] = basename = key; + const linkEntry = links.getEntry(basename); + if (linkEntry) { + components[step] = basename = linkEntry[0]; } + const node = linkEntry?.[1]; if (lastStep && (noFollow || !isSymlink(node))) { return { realpath: vpath.format(components), basename, parent, links, node }; }