mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-16 15:51:35 -05:00
When there is no change in file text for program, no need to update program (#51626)
* When fsEvent for change is repeated * When trying to check if program is uptodate, read the files from disk to determine the version instead of delaying so that new program is not created if file contents have not changed
This commit is contained in:
@@ -702,4 +702,26 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "fsEvent for change is repeated",
|
||||
commandLineArgs: ["-w", "main.ts", "--extendedDiagnostics"],
|
||||
sys: () => createWatchedSystem({
|
||||
"/user/username/projects/project/main.ts": `let a: string = "Hello"`,
|
||||
[libFile.path]: libFile.content,
|
||||
}, { currentDirectory: "/user/username/projects/project" }),
|
||||
changes: [
|
||||
{
|
||||
caption: "change main.ts",
|
||||
change: sys => sys.replaceFileText("/user/username/projects/project/main.ts", "Hello", "Hello World"),
|
||||
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
|
||||
},
|
||||
{
|
||||
caption: "receive another change event without modifying the file",
|
||||
change: sys => sys.invokeFsWatches("/user/username/projects/project/main.ts", "change", /*modifiedTime*/ undefined, /*useTildeSuffix*/ undefined),
|
||||
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -686,7 +686,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost,
|
||||
}
|
||||
}
|
||||
|
||||
private invokeFsWatches(fullPath: string, eventName: "rename" | "change", modifiedTime: Date | undefined, useTildeSuffix: boolean | undefined) {
|
||||
invokeFsWatches(fullPath: string, eventName: "rename" | "change", modifiedTime: Date | undefined, useTildeSuffix: boolean | undefined) {
|
||||
this.invokeFsWatchesCallbacks(fullPath, eventName, modifiedTime, fullPath, useTildeSuffix);
|
||||
this.invokeFsWatchesCallbacks(getDirectoryPath(fullPath), eventName, modifiedTime, fullPath, useTildeSuffix);
|
||||
this.invokeRecursiveFsWatches(fullPath, eventName, modifiedTime, /*entryFullPath*/ undefined, useTildeSuffix);
|
||||
|
||||
Reference in New Issue
Block a user