diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index ba368e3c56695..09705e74f26eb 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -3548,7 +3548,7 @@ namespace ts { } if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) { return { - key: useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec), + key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec)), flags: WatchDirectoryFlags.Recursive }; } diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 4163337ab4a1e..a17f857024f11 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -639,7 +639,7 @@ export class A { { caption: "Add new file", change: sys => sys.writeFile(`${projectRoot}/new-file.ts`, "export const z = 1;"), - timeouts: sys => sys.checkTimeoutQueueLengthAndRun(0), + timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), }, { caption: "Import new file", diff --git a/tests/baselines/reference/tscWatch/programUpdates/correctly-parses-wild-card-directories-from-implicit-glob-when-two-keys-differ-only-in-directory-seperator.js b/tests/baselines/reference/tscWatch/programUpdates/correctly-parses-wild-card-directories-from-implicit-glob-when-two-keys-differ-only-in-directory-seperator.js index d0d1b48f60032..d8438868a08a3 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/correctly-parses-wild-card-directories-from-implicit-glob-when-two-keys-differ-only-in-directory-seperator.js +++ b/tests/baselines/reference/tscWatch/programUpdates/correctly-parses-wild-card-directories-from-implicit-glob-when-two-keys-differ-only-in-directory-seperator.js @@ -39,6 +39,8 @@ DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_mod Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots [12:00:34 AM] 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/f1.ts","/user/username/projects/myproject/f2.ts"] @@ -74,6 +76,8 @@ 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 @@ -149,6 +153,41 @@ export const z = 1; Output:: +DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Scheduling update +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Reloading new file names and options +Synchronizing program +[12:00:39 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts","/user/username/projects/myproject/new-file.ts"] + options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/new-file.ts 250 undefined Source file +DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.js :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/new-file.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.js :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.d.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/new-file.d.ts +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.d.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +[12:00:47 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts","/user/username/projects/myproject/new-file.ts"] +Program options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/f1.ts +/user/username/projects/myproject/f2.ts +/user/username/projects/myproject/new-file.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/new-file.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/new-file.ts (computed .d.ts) WatchedFiles:: /user/username/projects/myproject/tsconfig.json: @@ -159,15 +198,77 @@ WatchedFiles:: {"fileName":"/user/username/projects/myproject/f2.ts","pollingInterval":250} /a/lib/lib.d.ts: {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/new-file.ts: + {"fileName":"/user/username/projects/myproject/new-file.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/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./f1.ts","./f2.ts","./new-file.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true},{"version":"-10906998252-export const x = 1","signature":"-7495133367-export declare const x = 1;\n"},{"version":"-10905812331-export const y = 1","signature":"-6203665398-export declare const y = 1;\n"},{"version":"-11960320495-export const z = 1;","signature":"-9207164725-export declare const z = 1;\n"}],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4]},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./f1.ts", + "./f2.ts", + "./new-file.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "affectsGlobalScope": true + }, + "./f1.ts": { + "version": "-10906998252-export const x = 1", + "signature": "-7495133367-export declare const x = 1;\n" + }, + "./f2.ts": { + "version": "-10905812331-export const y = 1", + "signature": "-6203665398-export declare const y = 1;\n" + }, + "./new-file.ts": { + "version": "-11960320495-export const z = 1;", + "signature": "-9207164725-export declare const z = 1;\n" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./f1.ts", + "./f2.ts", + "./new-file.ts" + ] + }, + "version": "FakeTSVersion", + "size": 949 +} + +//// [/user/username/projects/myproject/new-file.js] +"use strict"; +exports.__esModule = true; +exports.z = void 0; +exports.z = 1; + + +//// [/user/username/projects/myproject/new-file.d.ts] +export declare const z = 1; + + Change:: Import new file @@ -180,23 +281,18 @@ Output:: FileWatcher:: Triggered with /user/username/projects/myproject/f1.ts 1:: WatchInfo: /user/username/projects/myproject/f1.ts 250 undefined Source file Scheduling update Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/f1.ts 1:: WatchInfo: /user/username/projects/myproject/f1.ts 250 undefined Source file +Reloading new file names and options Synchronizing program -[12:00:41 AM] File change detected. Starting incremental compilation... +[12:00:53 AM] File change detected. Starting incremental compilation... CreatingProgramWith:: - roots: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts"] + roots: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts","/user/username/projects/myproject/new-file.ts"] options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/new-file.ts 250 undefined Source file -f1.ts:1:19 - error TS6307: File '/user/username/projects/myproject/new-file.ts' is not listed within the file list of project '/user/username/projects/myproject/tsconfig.json'. Projects must list all files or use an 'include' pattern. - -1 import { z } from "./new-file";export const x = 1 -   ~~~~~~~~~~~~ - -[12:00:55 AM] Found 1 error. Watching for file changes. +[12:01:03 AM] Found 0 errors. Watching for file changes. -Program root files: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts"] +Program root files: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts","/user/username/projects/myproject/new-file.ts"] Program options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: SafeModules Program files:: @@ -206,11 +302,9 @@ Program files:: /user/username/projects/myproject/f2.ts Semantic diagnostics in builder refreshed for:: -/user/username/projects/myproject/new-file.ts /user/username/projects/myproject/f1.ts Shape signatures in builder refreshed for:: -/user/username/projects/myproject/new-file.ts (computed .d.ts) /user/username/projects/myproject/f1.ts (computed .d.ts) WatchedFiles:: @@ -230,6 +324,8 @@ 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 @@ -291,14 +387,3 @@ exitCode:: ExitStatus.undefined "size": 1005 } -//// [/user/username/projects/myproject/new-file.js] -"use strict"; -exports.__esModule = true; -exports.z = void 0; -exports.z = 1; - - -//// [/user/username/projects/myproject/new-file.d.ts] -export declare const z = 1; - -