From 590166ad42d09e6c44c31ac450b09740f828a55b Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Thu, 13 Jan 2022 11:23:16 -0800
Subject: [PATCH 01/10] Add test based on issue
---
.../unittests/tscWatch/programUpdates.ts | 24 ++++
.../when-creating-extensionless-file.js | 113 ++++++++++++++++++
2 files changed, 137 insertions(+)
create mode 100644 tests/baselines/reference/tscWatch/programUpdates/when-creating-extensionless-file.js
diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts
index c7d2e1dec26f7..a4a2d0ffb8269 100644
--- a/src/testRunner/unittests/tscWatch/programUpdates.ts
+++ b/src/testRunner/unittests/tscWatch/programUpdates.ts
@@ -1815,5 +1815,29 @@ import { x } from "../b";`),
},
]
});
+
+ verifyTscWatch({
+ scenario,
+ subScenario: "when creating extensionless file",
+ commandLineArgs: ["-w", "-p", ".", "--extendedDiagnostics"],
+ sys: () => {
+ const module1: File = {
+ path: `${projectRoot}/index.ts`,
+ content: ``
+ };
+ const config: File = {
+ path: `${projectRoot}/tsconfig.json`,
+ content: `{}`
+ };
+ return createWatchedSystem([module1, config, libFile], { currentDirectory: projectRoot });
+ },
+ changes: [
+ {
+ caption: "Create foo in project root",
+ change: sys => sys.writeFile(`${projectRoot}/foo`, ``),
+ timeouts: checkSingleTimeoutQueueLengthAndRun,
+ },
+ ]
+ });
});
}
diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-creating-extensionless-file.js b/tests/baselines/reference/tscWatch/programUpdates/when-creating-extensionless-file.js
new file mode 100644
index 0000000000000..4f549ecd87fd7
--- /dev/null
+++ b/tests/baselines/reference/tscWatch/programUpdates/when-creating-extensionless-file.js
@@ -0,0 +1,113 @@
+Input::
+//// [/user/username/projects/myproject/index.ts]
+
+
+//// [/user/username/projects/myproject/tsconfig.json]
+{}
+
+//// [/a/lib/lib.d.ts]
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+
+
+/a/lib/tsc.js -w -p . --extendedDiagnostics
+Output::
+[[90m12:00:21 AM[0m] Starting compilation in watch mode...
+
+Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false
+FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file
+Synchronizing program
+CreatingProgramWith::
+ roots: ["/user/username/projects/myproject/index.ts"]
+ options: {"watch":true,"project":"/user/username/projects/myproject","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/index.ts 250 undefined Source file
+FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file
+DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots
+Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots
+[[90m12:00:24 AM[0m] Found 0 errors. Watching for file changes.
+
+DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
+Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
+
+
+Program root files: ["/user/username/projects/myproject/index.ts"]
+Program options: {"watch":true,"project":"/user/username/projects/myproject","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/index.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/index.ts
+
+Shape signatures in builder refreshed for::
+/a/lib/lib.d.ts (used version)
+/user/username/projects/myproject/index.ts (used version)
+
+WatchedFiles::
+/user/username/projects/myproject/tsconfig.json:
+ {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/index.ts:
+ {"fileName":"/user/username/projects/myproject/index.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/index.js]
+
+
+
+Change:: Create foo in project root
+
+Input::
+//// [/user/username/projects/myproject/foo]
+
+
+
+Output::
+DirectoryWatcher:: Triggered with /user/username/projects/myproject/foo :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
+Scheduling update
+Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/foo :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
+[[90m12:00:27 AM[0m] File change detected. Starting incremental compilation...
+
+Reloading new file names and options
+Synchronizing program
+
+
+WatchedFiles::
+/user/username/projects/myproject/tsconfig.json:
+ {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250}
+/user/username/projects/myproject/index.ts:
+ {"fileName":"/user/username/projects/myproject/index.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
+
From a2c9d9cb1f01ed7becd4e14ce8d4d48d90a57c73 Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Thu, 13 Jan 2022 10:48:26 -0800
Subject: [PATCH 02/10] Delay "File change detected" reporting until
createProgram
---
src/compiler/watchPublic.ts | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts
index 33220b03d2e43..730cc453c2cfe 100644
--- a/src/compiler/watchPublic.ts
+++ b/src/compiler/watchPublic.ts
@@ -280,13 +280,22 @@ namespace ts {
const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
const currentDirectory = host.getCurrentDirectory();
- const { configFileName, optionsToExtend: optionsToExtendForConfigFile = {}, watchOptionsToExtend, extraFileExtensions, createProgram } = host;
+ const { configFileName, optionsToExtend: optionsToExtendForConfigFile = {}, watchOptionsToExtend, extraFileExtensions, createProgram: realCreateProgram } = host;
let { rootFiles: rootFileNames, options: compilerOptions, watchOptions, projectReferences } = host;
let wildcardDirectories: MapLike | undefined;
let configFileParsingDiagnostics: Diagnostic[] | undefined;
let canConfigFileJsonReportNoInputFiles = false;
let hasChangedConfigFileParsingErrors = false;
+ let reportWatchDiagnosticOnCreateProgram: DiagnosticMessage | undefined;
+ const createProgram: CreateProgram = (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
+ if (reportWatchDiagnosticOnCreateProgram) {
+ reportWatchDiagnostic(reportWatchDiagnosticOnCreateProgram);
+ reportWatchDiagnosticOnCreateProgram = undefined;
+ }
+ return realCreateProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
+ };
+
const cachedDirectoryStructureHost = configFileName === undefined ? undefined : createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames);
const directoryStructureHost: DirectoryStructureHost = cachedDirectoryStructureHost || host;
const parseConfigFileHost = parseConfigHostFromCompilerHostLike(host, directoryStructureHost);
@@ -665,7 +674,7 @@ namespace ts {
function updateProgramWithWatchStatus() {
timerToUpdateProgram = undefined;
- reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
+ reportWatchDiagnosticOnCreateProgram = Diagnostics.File_change_detected_Starting_incremental_compilation;
updateProgram();
}
From 7f5f56e2d9eb402c99792bcded54dd6d4724895e Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Thu, 13 Jan 2022 11:28:06 -0800
Subject: [PATCH 03/10] Accept new baseline for new test
---
.../tscWatch/programUpdates/when-creating-extensionless-file.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-creating-extensionless-file.js b/tests/baselines/reference/tscWatch/programUpdates/when-creating-extensionless-file.js
index 4f549ecd87fd7..fe976b5d9346a 100644
--- a/tests/baselines/reference/tscWatch/programUpdates/when-creating-extensionless-file.js
+++ b/tests/baselines/reference/tscWatch/programUpdates/when-creating-extensionless-file.js
@@ -87,8 +87,6 @@ Output::
DirectoryWatcher:: Triggered with /user/username/projects/myproject/foo :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/foo :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
-[[90m12:00:27 AM[0m] File change detected. Starting incremental compilation...
-
Reloading new file names and options
Synchronizing program
From 3c844cf7ba04e640abff566ba93c01e182627bca Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Thu, 13 Jan 2022 11:23:03 -0800
Subject: [PATCH 04/10] Update baselines for existing tests
---
.../consoleClearing/with---diagnostics.js | 4 ++--
.../with---extendedDiagnostics.js | 4 ++--
.../programUpdates/config-file-is-deleted.js | 3 ---
...n-creating-new-file-in-symlinked-folder.js | 4 ++--
...file-is-added-to-the-referenced-project.js | 16 ++++++-------
...-no-notification-from-fs-for-index-file.js | 16 ++++++-------
...ing-useSourceOfProjectReferenceRedirect.js | 24 +++++++++----------
...-host-implementing-getParsedCommandLine.js | 6 ++---
8 files changed, 37 insertions(+), 40 deletions(-)
diff --git a/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js b/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js
index 0416d37ad8b5b..71a354fd970fc 100644
--- a/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js
+++ b/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js
@@ -71,12 +71,12 @@ Output::
FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file
Scheduling update
Elapsed:: *ms FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file
-[[90m12:00:17 AM[0m] File change detected. Starting incremental compilation...
-
Synchronizing program
CreatingProgramWith::
roots: ["/f.ts"]
options: {"watch":true,"diagnostics":true}
+[[90m12:00:17 AM[0m] File change detected. Starting incremental compilation...
+
[[90m12:00:21 AM[0m] Found 0 errors. Watching for file changes.
diff --git a/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js b/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js
index 8889c3fd19377..d685d07abf23b 100644
--- a/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js
+++ b/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js
@@ -73,12 +73,12 @@ Output::
FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file
Scheduling update
Elapsed:: *ms FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file
-[[90m12:00:17 AM[0m] File change detected. Starting incremental compilation...
-
Synchronizing program
CreatingProgramWith::
roots: ["/f.ts"]
options: {"watch":true,"extendedDiagnostics":true}
+[[90m12:00:17 AM[0m] File change detected. Starting incremental compilation...
+
[[90m12:00:21 AM[0m] Found 0 errors. Watching for file changes.
diff --git a/tests/baselines/reference/tscWatch/programUpdates/config-file-is-deleted.js b/tests/baselines/reference/tscWatch/programUpdates/config-file-is-deleted.js
index f58c7de595092..1a995e90899aa 100644
--- a/tests/baselines/reference/tscWatch/programUpdates/config-file-is-deleted.js
+++ b/tests/baselines/reference/tscWatch/programUpdates/config-file-is-deleted.js
@@ -84,9 +84,6 @@ Input::
//// [/a/b/tsconfig.json] deleted
Output::
->> Screen clear
-[[90m12:00:24 AM[0m] File change detected. Starting incremental compilation...
-
[91merror[0m[90m TS5083: [0mCannot read file '/a/b/tsconfig.json'.
diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-creating-new-file-in-symlinked-folder.js b/tests/baselines/reference/tscWatch/programUpdates/when-creating-new-file-in-symlinked-folder.js
index ee6c33aa4a43a..8cb8c85f5b405 100644
--- a/tests/baselines/reference/tscWatch/programUpdates/when-creating-new-file-in-symlinked-folder.js
+++ b/tests/baselines/reference/tscWatch/programUpdates/when-creating-new-file-in-symlinked-folder.js
@@ -115,13 +115,13 @@ Output::
DirectoryWatcher:: Triggered with /user/username/projects/myproject/folder2/module3.ts :: WatchInfo: /user/username/projects/myproject/folder2 1 undefined Wild card directory
Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/folder2/module3.ts :: WatchInfo: /user/username/projects/myproject/folder2 1 undefined Wild card directory
-[[90m12:00:41 AM[0m] File change detected. Starting incremental compilation...
-
Reloading new file names and options
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/client/folder1/module1.ts","/user/username/projects/myproject/client/linktofolder2/module2.ts","/user/username/projects/myproject/client/linktofolder2/module3.ts"]
options: {"baseUrl":"/user/username/projects/myproject/client","paths":{"*":["*"]},"pathsBasePath":"/user/username/projects/myproject","watch":true,"project":"/user/username/projects/myproject","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+[[90m12:00:41 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/client/linktofolder2/module3.ts 250 undefined Source file
DirectoryWatcher:: Triggered with /user/username/projects/myproject/folder2/module3.js :: WatchInfo: /user/username/projects/myproject/folder2 1 undefined Wild card directory
Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/folder2/module3.js
diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-new-file-is-added-to-the-referenced-project.js b/tests/baselines/reference/tscWatch/programUpdates/when-new-file-is-added-to-the-referenced-project.js
index 7adf3b20ec88f..557032c8ebd3c 100644
--- a/tests/baselines/reference/tscWatch/programUpdates/when-new-file-is-added-to-the-referenced-project.js
+++ b/tests/baselines/reference/tscWatch/programUpdates/when-new-file-is-added-to-the-referenced-project.js
@@ -171,14 +171,14 @@ Output::
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-[[90m12:00:45 AM[0m] File change detected. Starting incremental compilation...
-
Synchronizing program
Reloading new file names and options
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"watch":true,"project":"/user/username/projects/myproject/projects/project2/tsconfig.json","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+[[90m12:00:45 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file
[91merror[0m[90m TS6053: [0mFile '/user/username/projects/myproject/projects/project1/class3.d.ts' not found.
The file is in the program because:
@@ -251,13 +251,13 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/pro
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-[[90m12:00:49 AM[0m] File change detected. Starting incremental compilation...
-
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"watch":true,"project":"/user/username/projects/myproject/projects/project2/tsconfig.json","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+[[90m12:00:49 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
[[90m12:00:59 AM[0m] Found 0 errors. Watching for file changes.
@@ -424,13 +424,13 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/pro
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-[[90m12:01:08 AM[0m] File change detected. Starting incremental compilation...
-
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"watch":true,"project":"/user/username/projects/myproject/projects/project2/tsconfig.json","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+[[90m12:01:08 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file
[91merror[0m[90m TS6053: [0mFile '/user/username/projects/myproject/projects/project1/class3.d.ts' not found.
@@ -550,13 +550,13 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/pro
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-[[90m12:01:24 AM[0m] File change detected. Starting incremental compilation...
-
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"watch":true,"project":"/user/username/projects/myproject/projects/project2/tsconfig.json","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+[[90m12:01:24 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
[[90m12:01:34 AM[0m] Found 0 errors. Watching for file changes.
diff --git a/tests/baselines/reference/tscWatch/resolutionCache/works-when-installing-something-in-node_modules-or-@types-when-there-is-no-notification-from-fs-for-index-file.js b/tests/baselines/reference/tscWatch/resolutionCache/works-when-installing-something-in-node_modules-or-@types-when-there-is-no-notification-from-fs-for-index-file.js
index 8541f38217fc1..de1a2b3d606d4 100644
--- a/tests/baselines/reference/tscWatch/resolutionCache/works-when-installing-something-in-node_modules-or-@types-when-there-is-no-notification-from-fs-for-index-file.js
+++ b/tests/baselines/reference/tscWatch/resolutionCache/works-when-installing-something-in-node_modules-or-@types-when-there-is-no-notification-from-fs-for-index-file.js
@@ -215,13 +215,13 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec
DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
-[[90m12:00:48 AM[0m] File change detected. Starting incremental compilation...
-
Reloading new file names and options
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/worker.ts"]
options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+[[90m12:00:48 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/globals.d.ts 250 undefined Source file
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/ts3.6/base.d.ts 250 undefined Source file
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/base.d.ts 250 undefined Source file
@@ -310,13 +310,13 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec
DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types/mocha/index.d.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types/mocha/index.d.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
-[[90m12:00:59 AM[0m] File change detected. Starting incremental compilation...
-
Reloading new file names and options
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/worker.ts"]
options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+[[90m12:00:59 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/mocha/index.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/mocha/package.json 2000 undefined package.json file
[96mworker.ts[0m:[93m1[0m:[93m1[0m - [91merror[0m[90m TS2580: [0mCannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
@@ -382,13 +382,13 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec
DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types/node :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types/node :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
-[[90m12:01:03 AM[0m] File change detected. Starting incremental compilation...
-
Reloading new file names and options
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/worker.ts"]
options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+[[90m12:01:03 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types/mocha/package.json 2000 undefined package.json file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/package.json 2000 undefined package.json file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/node/package.json 2000 undefined package.json file
@@ -481,13 +481,13 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules
Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/node_modules/@types/node/ts3.6
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types/node/ts3.6 :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Scheduling update
-[[90m12:01:15 AM[0m] File change detected. Starting incremental compilation...
-
Reloading new file names and options
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/worker.ts"]
options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+[[90m12:01:15 AM[0m] File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/index.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/base.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/ts3.6/base.d.ts 250 undefined Source file
diff --git a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js
index 7be9d571284e8..4fb035071b5cc 100644
--- a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js
+++ b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js
@@ -133,15 +133,15 @@ Output::
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-
-12:00:43 AM - File change detected. Starting incremental compilation...
-
Synchronizing program
Loading config file: /user/username/projects/myproject/projects/project1/tsconfig.json
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+
+12:00:43 AM - File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file
error TS6053: File '/user/username/projects/myproject/projects/project1/class3.d.ts' not found.
The file is in the program because:
@@ -208,14 +208,14 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/pro
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-
-12:00:47 AM - File change detected. Starting incremental compilation...
-
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+
+12:00:47 AM - File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
12:00:57 AM - Found 0 errors. Watching for file changes.
@@ -340,14 +340,14 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/pro
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-
-12:01:03 AM - File change detected. Starting incremental compilation...
-
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+
+12:01:03 AM - File change detected. Starting incremental compilation...
+
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file
error TS6053: File '/user/username/projects/myproject/projects/project1/class3.d.ts' not found.
@@ -424,14 +424,14 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/pro
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-
-12:01:16 AM - File change detected. Starting incremental compilation...
-
Synchronizing program
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+
+12:01:16 AM - File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
12:01:26 AM - Found 0 errors. Watching for file changes.
diff --git a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js
index 1480894fbe6f6..c23e8f8b0ec2e 100644
--- a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js
+++ b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js
@@ -133,15 +133,15 @@ Output::
DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
-
-12:00:43 AM - File change detected. Starting incremental compilation...
-
Synchronizing program
Loading config file: /user/username/projects/myproject/projects/project1/tsconfig.json
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
+
+12:00:43 AM - File change detected. Starting incremental compilation...
+
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.ts 250 undefined Source file
12:00:53 AM - Found 0 errors. Watching for file changes.
From e59d8f5b7a7080b48c56591febcb2bf9fbba0e6f Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Thu, 13 Jan 2022 12:16:55 -0800
Subject: [PATCH 05/10] Ensure diag is cleared on synchronizeProgram
---
src/compiler/watchPublic.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts
index 730cc453c2cfe..37b428d337626 100644
--- a/src/compiler/watchPublic.ts
+++ b/src/compiler/watchPublic.ts
@@ -452,6 +452,7 @@ namespace ts {
}
changesAffectResolution = false; // reset for next sync
+ reportWatchDiagnosticOnCreateProgram = undefined;
if (host.afterProgramCreate && program !== builderProgram) {
host.afterProgramCreate(builderProgram);
From 582a8dab2b2a0849d58f4cd9d67f65d16a130899 Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Thu, 13 Jan 2022 12:28:00 -0800
Subject: [PATCH 06/10] Be less clever
---
src/compiler/watchPublic.ts | 18 ++++++++----------
...en-creating-new-file-in-symlinked-folder.js | 4 ++--
...-file-is-added-to-the-referenced-project.js | 16 ++++++++--------
3 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts
index 37b428d337626..58afa7ea32101 100644
--- a/src/compiler/watchPublic.ts
+++ b/src/compiler/watchPublic.ts
@@ -273,6 +273,7 @@ namespace ts {
let sharedExtendedConfigFileWatchers: ESMap>; // Map of file watchers for extended files, shared between different referenced projects
let extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
let changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
+ let reportWatchDiagnosticOnCreateProgram: DiagnosticMessage | undefined; // Diagnostic message to report in synchronizeProgram before new program creation
const sourceFilesCache = new Map(); // Cache that stores the source file and version info
let missingFilePathsRequestedForRelease: Path[] | undefined; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
@@ -280,22 +281,13 @@ namespace ts {
const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
const currentDirectory = host.getCurrentDirectory();
- const { configFileName, optionsToExtend: optionsToExtendForConfigFile = {}, watchOptionsToExtend, extraFileExtensions, createProgram: realCreateProgram } = host;
+ const { configFileName, optionsToExtend: optionsToExtendForConfigFile = {}, watchOptionsToExtend, extraFileExtensions, createProgram } = host;
let { rootFiles: rootFileNames, options: compilerOptions, watchOptions, projectReferences } = host;
let wildcardDirectories: MapLike | undefined;
let configFileParsingDiagnostics: Diagnostic[] | undefined;
let canConfigFileJsonReportNoInputFiles = false;
let hasChangedConfigFileParsingErrors = false;
- let reportWatchDiagnosticOnCreateProgram: DiagnosticMessage | undefined;
- const createProgram: CreateProgram = (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
- if (reportWatchDiagnosticOnCreateProgram) {
- reportWatchDiagnostic(reportWatchDiagnosticOnCreateProgram);
- reportWatchDiagnosticOnCreateProgram = undefined;
- }
- return realCreateProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
- };
-
const cachedDirectoryStructureHost = configFileName === undefined ? undefined : createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames);
const directoryStructureHost: DirectoryStructureHost = cachedDirectoryStructureHost || host;
const parseConfigFileHost = parseConfigHostFromCompilerHostLike(host, directoryStructureHost);
@@ -443,11 +435,17 @@ namespace ts {
const hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
if (hasChangedConfigFileParsingErrors) {
+ if (reportWatchDiagnosticOnCreateProgram) {
+ reportWatchDiagnostic(reportWatchDiagnosticOnCreateProgram);
+ }
builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
hasChangedConfigFileParsingErrors = false;
}
}
else {
+ if (reportWatchDiagnosticOnCreateProgram) {
+ reportWatchDiagnostic(reportWatchDiagnosticOnCreateProgram);
+ }
createNewProgram(hasInvalidatedResolution);
}
diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-creating-new-file-in-symlinked-folder.js b/tests/baselines/reference/tscWatch/programUpdates/when-creating-new-file-in-symlinked-folder.js
index 8cb8c85f5b405..af10639931622 100644
--- a/tests/baselines/reference/tscWatch/programUpdates/when-creating-new-file-in-symlinked-folder.js
+++ b/tests/baselines/reference/tscWatch/programUpdates/when-creating-new-file-in-symlinked-folder.js
@@ -117,11 +117,11 @@ Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/folder2/module3.ts :: WatchInfo: /user/username/projects/myproject/folder2 1 undefined Wild card directory
Reloading new file names and options
Synchronizing program
+[[90m12:00:41 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/client/folder1/module1.ts","/user/username/projects/myproject/client/linktofolder2/module2.ts","/user/username/projects/myproject/client/linktofolder2/module3.ts"]
options: {"baseUrl":"/user/username/projects/myproject/client","paths":{"*":["*"]},"pathsBasePath":"/user/username/projects/myproject","watch":true,"project":"/user/username/projects/myproject","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
-[[90m12:00:41 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/client/linktofolder2/module3.ts 250 undefined Source file
DirectoryWatcher:: Triggered with /user/username/projects/myproject/folder2/module3.js :: WatchInfo: /user/username/projects/myproject/folder2 1 undefined Wild card directory
Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/folder2/module3.js
diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-new-file-is-added-to-the-referenced-project.js b/tests/baselines/reference/tscWatch/programUpdates/when-new-file-is-added-to-the-referenced-project.js
index 557032c8ebd3c..e24e1ba0986f1 100644
--- a/tests/baselines/reference/tscWatch/programUpdates/when-new-file-is-added-to-the-referenced-project.js
+++ b/tests/baselines/reference/tscWatch/programUpdates/when-new-file-is-added-to-the-referenced-project.js
@@ -173,12 +173,12 @@ Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
Reloading new file names and options
+[[90m12:00:45 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"watch":true,"project":"/user/username/projects/myproject/projects/project2/tsconfig.json","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-[[90m12:00:45 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file
[91merror[0m[90m TS6053: [0mFile '/user/username/projects/myproject/projects/project1/class3.d.ts' not found.
The file is in the program because:
@@ -252,12 +252,12 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
+[[90m12:00:49 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"watch":true,"project":"/user/username/projects/myproject/projects/project2/tsconfig.json","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-[[90m12:00:49 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
[[90m12:00:59 AM[0m] Found 0 errors. Watching for file changes.
@@ -425,12 +425,12 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
+[[90m12:01:08 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"watch":true,"project":"/user/username/projects/myproject/projects/project2/tsconfig.json","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-[[90m12:01:08 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file
[91merror[0m[90m TS6053: [0mFile '/user/username/projects/myproject/projects/project1/class3.d.ts' not found.
@@ -551,12 +551,12 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
+[[90m12:01:24 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"watch":true,"project":"/user/username/projects/myproject/projects/project2/tsconfig.json","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-[[90m12:01:24 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
[[90m12:01:34 AM[0m] Found 0 errors. Watching for file changes.
From 67e8cff20116e072750554a0069569150adf85ab Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Thu, 13 Jan 2022 12:35:23 -0800
Subject: [PATCH 07/10] Fix missing baselines
---
.../consoleClearing/with---diagnostics.js | 4 ++--
.../with---extendedDiagnostics.js | 4 ++--
...-no-notification-from-fs-for-index-file.js | 16 ++++++-------
...ing-useSourceOfProjectReferenceRedirect.js | 24 +++++++++----------
...-host-implementing-getParsedCommandLine.js | 6 ++---
5 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js b/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js
index 71a354fd970fc..d032563a545d9 100644
--- a/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js
+++ b/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js
@@ -72,11 +72,11 @@ FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source fil
Scheduling update
Elapsed:: *ms FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file
Synchronizing program
+[[90m12:00:17 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/f.ts"]
options: {"watch":true,"diagnostics":true}
-[[90m12:00:17 AM[0m] File change detected. Starting incremental compilation...
-
[[90m12:00:21 AM[0m] Found 0 errors. Watching for file changes.
diff --git a/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js b/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js
index d685d07abf23b..e021f79145ef0 100644
--- a/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js
+++ b/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js
@@ -74,11 +74,11 @@ FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source fil
Scheduling update
Elapsed:: *ms FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file
Synchronizing program
+[[90m12:00:17 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/f.ts"]
options: {"watch":true,"extendedDiagnostics":true}
-[[90m12:00:17 AM[0m] File change detected. Starting incremental compilation...
-
[[90m12:00:21 AM[0m] Found 0 errors. Watching for file changes.
diff --git a/tests/baselines/reference/tscWatch/resolutionCache/works-when-installing-something-in-node_modules-or-@types-when-there-is-no-notification-from-fs-for-index-file.js b/tests/baselines/reference/tscWatch/resolutionCache/works-when-installing-something-in-node_modules-or-@types-when-there-is-no-notification-from-fs-for-index-file.js
index de1a2b3d606d4..0f536d2d6faf1 100644
--- a/tests/baselines/reference/tscWatch/resolutionCache/works-when-installing-something-in-node_modules-or-@types-when-there-is-no-notification-from-fs-for-index-file.js
+++ b/tests/baselines/reference/tscWatch/resolutionCache/works-when-installing-something-in-node_modules-or-@types-when-there-is-no-notification-from-fs-for-index-file.js
@@ -217,11 +217,11 @@ Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Reloading new file names and options
Synchronizing program
+[[90m12:00:48 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/worker.ts"]
options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
-[[90m12:00:48 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/globals.d.ts 250 undefined Source file
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/ts3.6/base.d.ts 250 undefined Source file
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/base.d.ts 250 undefined Source file
@@ -312,11 +312,11 @@ Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types/mocha/index.d.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Reloading new file names and options
Synchronizing program
+[[90m12:00:59 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/worker.ts"]
options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
-[[90m12:00:59 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/mocha/index.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/mocha/package.json 2000 undefined package.json file
[96mworker.ts[0m:[93m1[0m:[93m1[0m - [91merror[0m[90m TS2580: [0mCannot find name 'process'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.
@@ -384,11 +384,11 @@ Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/node_modules/@types/node :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Reloading new file names and options
Synchronizing program
+[[90m12:01:03 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/worker.ts"]
options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
-[[90m12:01:03 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types/mocha/package.json 2000 undefined package.json file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/package.json 2000 undefined package.json file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/node/package.json 2000 undefined package.json file
@@ -483,11 +483,11 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec
Scheduling update
Reloading new file names and options
Synchronizing program
+[[90m12:01:15 AM[0m] File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/worker.ts"]
options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
-[[90m12:01:15 AM[0m] File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/index.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/base.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types/node/ts3.6/base.d.ts 250 undefined Source file
diff --git a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js
index 4fb035071b5cc..9a42287a007e2 100644
--- a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js
+++ b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine-without-implementing-useSourceOfProjectReferenceRedirect.js
@@ -135,13 +135,13 @@ Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
Loading config file: /user/username/projects/myproject/projects/project1/tsconfig.json
+
+12:00:43 AM - File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-
-12:00:43 AM - File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file
error TS6053: File '/user/username/projects/myproject/projects/project1/class3.d.ts' not found.
The file is in the program because:
@@ -209,13 +209,13 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
+
+12:00:47 AM - File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-
-12:00:47 AM - File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
12:00:57 AM - Found 0 errors. Watching for file changes.
@@ -341,13 +341,13 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
+
+12:01:03 AM - File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-
-12:01:03 AM - File change detected. Starting incremental compilation...
-
FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 500 undefined Missing file
error TS6053: File '/user/username/projects/myproject/projects/project1/class3.d.ts' not found.
@@ -425,13 +425,13 @@ DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/pro
Project: /user/username/projects/myproject/projects/project1/tsconfig.json Detected output file: /user/username/projects/myproject/projects/project1/class3.d.ts
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.d.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
+
+12:01:16 AM - File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-
-12:01:16 AM - File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.d.ts 250 undefined Source file
12:01:26 AM - Found 0 errors. Watching for file changes.
diff --git a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js
index c23e8f8b0ec2e..ae46872cf8043 100644
--- a/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js
+++ b/tests/baselines/reference/tscWatch/watchApi/when-new-file-is-added-to-the-referenced-project-with-host-implementing-getParsedCommandLine.js
@@ -135,13 +135,13 @@ Scheduling update
Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/projects/project1/class3.ts :: WatchInfo: /user/username/projects/myproject/projects/project1 1 undefined Wild card directory of referenced project
Synchronizing program
Loading config file: /user/username/projects/myproject/projects/project1/tsconfig.json
+
+12:00:43 AM - File change detected. Starting incremental compilation...
+
CreatingProgramWith::
roots: ["/user/username/projects/myproject/projects/project2/class2.ts"]
options: {"module":0,"composite":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/projects/project2/tsconfig.json"}
projectReferences: [{"path":"/user/username/projects/myproject/projects/project1","originalPath":"../project1"}]
-
-12:00:43 AM - File change detected. Starting incremental compilation...
-
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/projects/project1/class3.ts 250 undefined Source file
12:00:53 AM - Found 0 errors. Watching for file changes.
From 8b21e9bb46145211ad017ea43c07140a3a0b3c3f Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Tue, 18 Jan 2022 11:01:09 -0800
Subject: [PATCH 08/10] Switch to a boolean
---
src/compiler/watchPublic.ts | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts
index 58afa7ea32101..37eeedac35d34 100644
--- a/src/compiler/watchPublic.ts
+++ b/src/compiler/watchPublic.ts
@@ -273,7 +273,7 @@ namespace ts {
let sharedExtendedConfigFileWatchers: ESMap>; // Map of file watchers for extended files, shared between different referenced projects
let extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
let changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
- let reportWatchDiagnosticOnCreateProgram: DiagnosticMessage | undefined; // Diagnostic message to report in synchronizeProgram before new program creation
+ let reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..."
const sourceFilesCache = new Map(); // Cache that stores the source file and version info
let missingFilePathsRequestedForRelease: Path[] | undefined; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
@@ -435,22 +435,22 @@ namespace ts {
const hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
if (hasChangedConfigFileParsingErrors) {
- if (reportWatchDiagnosticOnCreateProgram) {
- reportWatchDiagnostic(reportWatchDiagnosticOnCreateProgram);
+ if (reportFileChangeDetectedOnCreateProgram) {
+ reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
}
builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
hasChangedConfigFileParsingErrors = false;
}
}
else {
- if (reportWatchDiagnosticOnCreateProgram) {
- reportWatchDiagnostic(reportWatchDiagnosticOnCreateProgram);
+ if (reportFileChangeDetectedOnCreateProgram) {
+ reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
}
createNewProgram(hasInvalidatedResolution);
}
changesAffectResolution = false; // reset for next sync
- reportWatchDiagnosticOnCreateProgram = undefined;
+ reportFileChangeDetectedOnCreateProgram = false;
if (host.afterProgramCreate && program !== builderProgram) {
host.afterProgramCreate(builderProgram);
@@ -673,7 +673,7 @@ namespace ts {
function updateProgramWithWatchStatus() {
timerToUpdateProgram = undefined;
- reportWatchDiagnosticOnCreateProgram = Diagnostics.File_change_detected_Starting_incremental_compilation;
+ reportFileChangeDetectedOnCreateProgram = true;
updateProgram();
}
From d5d0bc66f12d0b083d302b15443357ab1128e123 Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Tue, 18 Jan 2022 11:02:30 -0800
Subject: [PATCH 09/10] Clarify bool
---
src/compiler/watchPublic.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts
index 37eeedac35d34..14a60843dd2df 100644
--- a/src/compiler/watchPublic.ts
+++ b/src/compiler/watchPublic.ts
@@ -273,7 +273,7 @@ namespace ts {
let sharedExtendedConfigFileWatchers: ESMap>; // Map of file watchers for extended files, shared between different referenced projects
let extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
let changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
- let reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..."
+ let reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
const sourceFilesCache = new Map(); // Cache that stores the source file and version info
let missingFilePathsRequestedForRelease: Path[] | undefined; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
From e7fc25de7594ba9bb5fd8e47de407faf0386c819 Mon Sep 17 00:00:00 2001
From: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Date: Tue, 18 Jan 2022 17:51:57 -0800
Subject: [PATCH 10/10] Add test for deleting a file declared in files
---
.../unittests/tscWatch/programUpdates.ts | 28 ++++
.../file-in-files-is-deleted.js | 131 ++++++++++++++++++
2 files changed, 159 insertions(+)
create mode 100644 tests/baselines/reference/tscWatch/programUpdates/file-in-files-is-deleted.js
diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts
index a4a2d0ffb8269..ea5ab542f52a9 100644
--- a/src/testRunner/unittests/tscWatch/programUpdates.ts
+++ b/src/testRunner/unittests/tscWatch/programUpdates.ts
@@ -638,6 +638,34 @@ export class A {
]
});
+ verifyTscWatch({
+ scenario,
+ subScenario: "file in files is deleted",
+ commandLineArgs: ["-w", "-p", configFilePath],
+ sys: () => {
+ const file1 = {
+ path: "/a/b/f1.ts",
+ content: "let x = 1"
+ };
+ const file2 = {
+ path: "/a/b/f2.ts",
+ content: "let y = 1"
+ };
+ const configFile = {
+ path: configFilePath,
+ content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] })
+ };
+ return createWatchedSystem([file1, file2, libFile, configFile]);
+ },
+ changes: [
+ {
+ caption: "Delete f2",
+ change: sys => sys.deleteFile("/a/b/f2.ts"),
+ timeouts: checkSingleTimeoutQueueLengthAndRun,
+ }
+ ]
+ });
+
verifyTscWatch({
scenario,
subScenario: "config file is deleted",
diff --git a/tests/baselines/reference/tscWatch/programUpdates/file-in-files-is-deleted.js b/tests/baselines/reference/tscWatch/programUpdates/file-in-files-is-deleted.js
new file mode 100644
index 0000000000000..67b8d85e3d235
--- /dev/null
+++ b/tests/baselines/reference/tscWatch/programUpdates/file-in-files-is-deleted.js
@@ -0,0 +1,131 @@
+Input::
+//// [/a/b/f1.ts]
+let x = 1
+
+//// [/a/b/f2.ts]
+let y = 1
+
+//// [/a/lib/lib.d.ts]
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+
+//// [/a/b/tsconfig.json]
+{"compilerOptions":{},"files":["f1.ts","f2.ts"]}
+
+
+/a/lib/tsc.js -w -p /a/b/tsconfig.json
+Output::
+>> Screen clear
+[[90m12:00:17 AM[0m] Starting compilation in watch mode...
+
+[[90m12:00:22 AM[0m] Found 0 errors. Watching for file changes.
+
+
+
+Program root files: ["/a/b/f1.ts","/a/b/f2.ts"]
+Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.d.ts
+/a/b/f1.ts
+/a/b/f2.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.d.ts
+/a/b/f1.ts
+/a/b/f2.ts
+
+Shape signatures in builder refreshed for::
+/a/lib/lib.d.ts (used version)
+/a/b/f1.ts (used version)
+/a/b/f2.ts (used version)
+
+WatchedFiles::
+/a/b/tsconfig.json:
+ {"fileName":"/a/b/tsconfig.json","pollingInterval":250}
+/a/b/f1.ts:
+ {"fileName":"/a/b/f1.ts","pollingInterval":250}
+/a/b/f2.ts:
+ {"fileName":"/a/b/f2.ts","pollingInterval":250}
+/a/lib/lib.d.ts:
+ {"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/a/b/node_modules/@types:
+ {"directoryName":"/a/b/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined
+
+//// [/a/b/f1.js]
+var x = 1;
+
+
+//// [/a/b/f2.js]
+var y = 1;
+
+
+
+Change:: Delete f2
+
+Input::
+//// [/a/b/f2.ts] deleted
+
+Output::
+>> Screen clear
+[[90m12:00:24 AM[0m] File change detected. Starting incremental compilation...
+
+[91merror[0m[90m TS6053: [0mFile '/a/b/f2.ts' not found.
+ The file is in the program because:
+ Part of 'files' list in tsconfig.json
+
+ [96ma/b/tsconfig.json[0m:[93m1[0m:[93m40[0m
+ [7m1[0m {"compilerOptions":{},"files":["f1.ts","f2.ts"]}
+ [7m [0m [96m ~~~~~~~[0m
+ File is matched by 'files' list specified here.
+
+[[90m12:00:28 AM[0m] Found 1 error. Watching for file changes.
+
+
+
+Program root files: ["/a/b/f1.ts","/a/b/f2.ts"]
+Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/a/lib/lib.d.ts
+/a/b/f1.ts
+
+No cached semantic diagnostics in the builder::
+
+Shape signatures in builder refreshed for::
+/a/b/f1.ts (computed .d.ts)
+
+WatchedFiles::
+/a/b/tsconfig.json:
+ {"fileName":"/a/b/tsconfig.json","pollingInterval":250}
+/a/b/f1.ts:
+ {"fileName":"/a/b/f1.ts","pollingInterval":250}
+/a/lib/lib.d.ts:
+ {"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
+/a/b/f2.ts:
+ {"fileName":"/a/b/f2.ts","pollingInterval":250}
+
+FsWatches::
+
+FsWatchesRecursive::
+/a/b/node_modules/@types:
+ {"directoryName":"/a/b/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
+
+exitCode:: ExitStatus.undefined
+
+//// [/a/b/f1.js] file written with same contents