mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix casing for wild card keys for implicit globs to get wild card directories to watch (#39049)
* Test showing how wild card directory is not watched because of mismatch in key case * Fix casing for wild card keys for implicit globs Fixes #36532
This commit is contained in:
@@ -3120,7 +3120,10 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
if (isImplicitGlob(spec)) {
|
||||
return { key: spec, flags: WatchDirectoryFlags.Recursive };
|
||||
return {
|
||||
key: useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec),
|
||||
flags: WatchDirectoryFlags.Recursive
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -556,6 +556,30 @@ export class A {
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "can correctly update configured project when set of root files has changed through include",
|
||||
commandLineArgs: ["-w", "-p", "."],
|
||||
sys: () => {
|
||||
const file1 = {
|
||||
path: `${projectRoot}/Project/file1.ts`,
|
||||
content: "export const x = 10;"
|
||||
};
|
||||
const configFile = {
|
||||
path: `${projectRoot}/Project/tsconfig.json`,
|
||||
content: JSON.stringify({ include: [".", "./**/*.json"] })
|
||||
};
|
||||
return createWatchedSystem([file1, libFile, configFile], { currentDirectory: `${projectRoot}/Project` });
|
||||
},
|
||||
changes: [
|
||||
{
|
||||
caption: "Write file2",
|
||||
change: sys => sys.writeFile(`${projectRoot}/Project/file2.ts`, "export const y = 10;"),
|
||||
timeouts: checkSingleTimeoutQueueLengthAndRun
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "can update configured project when set of root files was not changed",
|
||||
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
Input::
|
||||
//// [/user/username/projects/myproject/Project/file1.ts]
|
||||
export const x = 10;
|
||||
|
||||
//// [/a/lib/lib.d.ts]
|
||||
/// <reference no-default-lib="true"/>
|
||||
interface Boolean {}
|
||||
interface Function {}
|
||||
interface CallableFunction {}
|
||||
interface NewableFunction {}
|
||||
interface IArguments {}
|
||||
interface Number { toExponential: any; }
|
||||
interface Object {}
|
||||
interface RegExp {}
|
||||
interface String { charAt: any; }
|
||||
interface Array<T> { length: number; [n: number]: T; }
|
||||
|
||||
//// [/user/username/projects/myproject/Project/tsconfig.json]
|
||||
{"include":[".","./**/*.json"]}
|
||||
|
||||
|
||||
/a/lib/tsc.js -w -p .
|
||||
Output::
|
||||
>> Screen clear
|
||||
[[90m12:00:23 AM[0m] Starting compilation in watch mode...
|
||||
|
||||
|
||||
[[90m12:00:26 AM[0m] Found 0 errors. Watching for file changes.
|
||||
|
||||
|
||||
|
||||
Program root files: ["/user/username/projects/myproject/Project/file1.ts"]
|
||||
Program options: {"watch":true,"project":"/user/username/projects/myproject/Project","configFilePath":"/user/username/projects/myproject/Project/tsconfig.json"}
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/Project/file1.ts
|
||||
|
||||
Semantic diagnostics in builder refreshed for::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/Project/file1.ts
|
||||
|
||||
WatchedFiles::
|
||||
/user/username/projects/myproject/project/tsconfig.json:
|
||||
{"fileName":"/user/username/projects/myproject/Project/tsconfig.json","pollingInterval":250}
|
||||
/user/username/projects/myproject/project/file1.ts:
|
||||
{"fileName":"/user/username/projects/myproject/Project/file1.ts","pollingInterval":250}
|
||||
/a/lib/lib.d.ts:
|
||||
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/user/username/projects/myproject/project/node_modules/@types:
|
||||
{"directoryName":"/user/username/projects/myproject/Project/node_modules/@types","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/project:
|
||||
{"directoryName":"/user/username/projects/myproject/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
|
||||
//// [/user/username/projects/myproject/Project/file1.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
exports.x = 10;
|
||||
|
||||
|
||||
|
||||
Change:: Write file2
|
||||
|
||||
Input::
|
||||
//// [/user/username/projects/myproject/Project/file2.ts]
|
||||
export const y = 10;
|
||||
|
||||
|
||||
Output::
|
||||
>> Screen clear
|
||||
[[90m12:00:29 AM[0m] File change detected. Starting incremental compilation...
|
||||
|
||||
|
||||
[[90m12:00:32 AM[0m] Found 0 errors. Watching for file changes.
|
||||
|
||||
|
||||
|
||||
Program root files: ["/user/username/projects/myproject/Project/file1.ts","/user/username/projects/myproject/Project/file2.ts"]
|
||||
Program options: {"watch":true,"project":"/user/username/projects/myproject/Project","configFilePath":"/user/username/projects/myproject/Project/tsconfig.json"}
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/Project/file1.ts
|
||||
/user/username/projects/myproject/Project/file2.ts
|
||||
|
||||
Semantic diagnostics in builder refreshed for::
|
||||
/user/username/projects/myproject/Project/file2.ts
|
||||
|
||||
WatchedFiles::
|
||||
/user/username/projects/myproject/project/tsconfig.json:
|
||||
{"fileName":"/user/username/projects/myproject/Project/tsconfig.json","pollingInterval":250}
|
||||
/user/username/projects/myproject/project/file1.ts:
|
||||
{"fileName":"/user/username/projects/myproject/Project/file1.ts","pollingInterval":250}
|
||||
/a/lib/lib.d.ts:
|
||||
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
|
||||
/user/username/projects/myproject/project/file2.ts:
|
||||
{"fileName":"/user/username/projects/myproject/Project/file2.ts","pollingInterval":250}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/user/username/projects/myproject/project/node_modules/@types:
|
||||
{"directoryName":"/user/username/projects/myproject/Project/node_modules/@types","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/project:
|
||||
{"directoryName":"/user/username/projects/myproject/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
|
||||
//// [/user/username/projects/myproject/Project/file2.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.y = void 0;
|
||||
exports.y = 10;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user