diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index bcc37fcd5a857..b9e6540291fa7 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -854,7 +854,6 @@ namespace ts { tscWatchFile: string | undefined; useNonPollingWatchers?: boolean; tscWatchDirectory: string | undefined; - defaultWatchFileKind: System["defaultWatchFileKind"]; inodeWatching: boolean; sysLog: (s: string) => void; } @@ -875,7 +874,6 @@ namespace ts { tscWatchFile, useNonPollingWatchers, tscWatchDirectory, - defaultWatchFileKind, inodeWatching, sysLog, }: CreateSystemWatchFunctions): { watchFile: HostWatchFile; watchDirectory: HostWatchDirectory; } { @@ -953,8 +951,8 @@ namespace ts { return useNonPollingWatchers ? // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(WatchFileKind.UseFsEventsOnParentDirectory, PollingWatchKind.PriorityInterval, options) : - // Default to do not use fixed polling interval - { watchFile: defaultWatchFileKind?.() || WatchFileKind.UseFsEvents }; + // Default to using fs events + { watchFile: WatchFileKind.UseFsEvents }; } } @@ -1380,7 +1378,6 @@ namespace ts { base64encode?(input: string): string; /*@internal*/ bufferFrom?(input: string, encoding?: string): Buffer; /*@internal*/ require?(baseDir: string, moduleName: string): RequireResult; - /*@internal*/ defaultWatchFileKind?(): WatchFileKind | undefined; // For testing /*@internal*/ now?(): Date; @@ -1473,7 +1470,6 @@ namespace ts { tscWatchFile: process.env.TSC_WATCHFILE, useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, - defaultWatchFileKind: () => sys!.defaultWatchFileKind?.(), inodeWatching: isLinuxOrMacOs, sysLog, }); diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index 3006a3f1ffdb3..5c1d2cea88883 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -350,7 +350,6 @@ interface Array { length: number; [n: number]: T; }` private readonly executingFilePath: string; private readonly currentDirectory: string; public require: ((initialPath: string, moduleName: string) => RequireResult) | undefined; - public defaultWatchFileKind?: () => WatchFileKind | undefined; public storeFilesChangingSignatureDuringEmit = true; watchFile: HostWatchFile; private inodeWatching: boolean | undefined; @@ -398,7 +397,6 @@ interface Array { length: number; [n: number]: T; }` realpath: this.realpath.bind(this), tscWatchFile, tscWatchDirectory, - defaultWatchFileKind: () => this.defaultWatchFileKind?.(), inodeWatching: !!this.inodeWatching, sysLog: s => this.write(s + this.newLine), }); diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index 95cacc1e7d088..45dd1ff714391 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -120,36 +120,6 @@ namespace ts.tscWatch { ] }); - verifyTscWatch({ - scenario, - subScenario: "watchFile/setting default as fixed chunk size watch file works", - commandLineArgs: ["-w", "-p", "/a/b/tsconfig.json"], - sys: () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: "{}" - }; - const files = [libFile, commonFile1, commonFile2, configFile]; - const sys = createWatchedSystem(files); - sys.defaultWatchFileKind = () => WatchFileKind.FixedChunkSizePolling; - return sys; - }, - changes: [ - { - caption: "Make change to file but should detect as changed and schedule program update", - // Make a change to file - change: sys => sys.writeFile(commonFile1.path, "var zz30 = 100;"), - timeouts: checkSingleTimeoutQueueLengthAndRun, - }, - { - caption: "Callbacks: queue and scheduled program update", - change: noop, - // Callbacks: scheduled program update and queue for the polling - timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2), - }, - ] - }); - describe("tsc-watch when watchDirectories implementation", () => { function verifyRenamingFileInSubFolder(subScenario: string, tscWatchDirectory: Tsc_WatchDirectory) { const projectFolder = "/a/username/project"; diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFile/setting-default-as-fixed-chunk-size-watch-file-works.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFile/setting-default-as-fixed-chunk-size-watch-file-works.js deleted file mode 100644 index ad32a6849eeab..0000000000000 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFile/setting-default-as-fixed-chunk-size-watch-file-works.js +++ /dev/null @@ -1,140 +0,0 @@ -Input:: -//// [/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/commonFile1.ts] -let x = 1 - -//// [/a/b/commonFile2.ts] -let y = 1 - -//// [/a/b/tsconfig.json] -{} - - -/a/lib/tsc.js -w -p /a/b/tsconfig.json -Output:: ->> Screen clear -[12:00:17 AM] Starting compilation in watch mode... - -[12:00:22 AM] Found 0 errors. Watching for file changes. - - - -Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.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/commonFile1.ts -/a/b/commonFile2.ts - -Semantic diagnostics in builder refreshed for:: -/a/lib/lib.d.ts -/a/b/commonFile1.ts -/a/b/commonFile2.ts - -Shape signatures in builder refreshed for:: -/a/lib/lib.d.ts (used version) -/a/b/commonfile1.ts (used version) -/a/b/commonfile2.ts (used version) - -PolledWatches:: -/a/b/node_modules/@types: - {"pollingInterval":500} - -FsWatches:: - -FsWatchesRecursive:: -/a/b: - {} - -exitCode:: ExitStatus.undefined - -//// [/a/b/commonFile1.js] -var x = 1; - - -//// [/a/b/commonFile2.js] -var y = 1; - - - -Change:: Make change to file but should detect as changed and schedule program update - -Input:: -//// [/a/b/commonFile1.ts] -var zz30 = 100; - - -Output:: - -PolledWatches:: -/a/b/node_modules/@types: - {"pollingInterval":500} - -FsWatches:: - -FsWatchesRecursive:: -/a/b: - {} - -exitCode:: ExitStatus.undefined - - -Change:: Callbacks: queue and scheduled program update - -Input:: - -Output:: ->> Screen clear -[12:00:26 AM] File change detected. Starting incremental compilation... - -[12:00:33 AM] Found 0 errors. Watching for file changes. - - - -Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] -Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} -Program structureReused: Completely -Program files:: -/a/lib/lib.d.ts -/a/b/commonFile1.ts -/a/b/commonFile2.ts - -Semantic diagnostics in builder refreshed for:: -/a/lib/lib.d.ts -/a/b/commonFile1.ts -/a/b/commonFile2.ts - -Shape signatures in builder refreshed for:: -/a/b/commonfile1.ts (computed .d.ts) -/a/b/commonfile2.ts (computed .d.ts) - -PolledWatches:: -/a/b/node_modules/@types: - {"pollingInterval":500} - -FsWatches:: - -FsWatchesRecursive:: -/a/b: - {} - -exitCode:: ExitStatus.undefined - -//// [/a/b/commonFile1.js] -var zz30 = 100; - - -//// [/a/b/commonFile2.js] file written with same contents