Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,10 @@ namespace ts {
};
}
if (isImplicitGlob(spec)) {
return { key: spec, flags: WatchDirectoryFlags.Recursive };
return {
key: useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec),
flags: WatchDirectoryFlags.Recursive
};
}
return undefined;
}
Expand Down
24 changes: 24 additions & 0 deletions src/testRunner/unittests/tscWatch/programUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,30 @@ export class A {
]
});

verifyTscWatch({
scenario,
subScenario: "can correctly update configured project when set of root files has changed through include",
commandLineArgs: ["-w", "-p", "."],
sys: () => {
const file1 = {
path: `${projectRoot}/Project/file1.ts`,
content: "export const x = 10;"
};
const configFile = {
path: `${projectRoot}/Project/tsconfig.json`,
content: JSON.stringify({ include: [".", "./**/*.json"] })
};
return createWatchedSystem([file1, libFile, configFile], { currentDirectory: `${projectRoot}/Project` });
},
changes: [
{
caption: "Write file2",
change: sys => sys.writeFile(`${projectRoot}/Project/file2.ts`, "export const y = 10;"),
timeouts: checkSingleTimeoutQueueLengthAndRun
}
]
});

verifyTscWatch({
scenario,
subScenario: "can update configured project when set of root files was not changed",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
Input::
//// [/user/username/projects/myproject/Project/file1.ts]
export const x = 10;

//// [/a/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }

//// [/user/username/projects/myproject/Project/tsconfig.json]
{"include":[".","./**/*.json"]}


/a/lib/tsc.js -w -p .
Output::
>> Screen clear
[12:00:23 AM] Starting compilation in watch mode...


[12:00:26 AM] Found 0 errors. Watching for file changes.



Program root files: ["/user/username/projects/myproject/Project/file1.ts"]
Program options: {"watch":true,"project":"/user/username/projects/myproject/Project","configFilePath":"/user/username/projects/myproject/Project/tsconfig.json"}
Program files::
/a/lib/lib.d.ts
/user/username/projects/myproject/Project/file1.ts

Semantic diagnostics in builder refreshed for::
/a/lib/lib.d.ts
/user/username/projects/myproject/Project/file1.ts

WatchedFiles::
/user/username/projects/myproject/project/tsconfig.json:
{"fileName":"/user/username/projects/myproject/Project/tsconfig.json","pollingInterval":250}
/user/username/projects/myproject/project/file1.ts:
{"fileName":"/user/username/projects/myproject/Project/file1.ts","pollingInterval":250}
/a/lib/lib.d.ts:
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}

FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/project/node_modules/@types:
{"directoryName":"/user/username/projects/myproject/Project/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject/node_modules/@types:
{"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject/project:
{"directoryName":"/user/username/projects/myproject/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/Project/file1.js]
"use strict";
exports.__esModule = true;
exports.x = void 0;
exports.x = 10;



Change:: Write file2

Input::
//// [/user/username/projects/myproject/Project/file2.ts]
export const y = 10;


Output::
>> Screen clear
[12:00:29 AM] File change detected. Starting incremental compilation...


[12:00:32 AM] Found 0 errors. Watching for file changes.



Program root files: ["/user/username/projects/myproject/Project/file1.ts","/user/username/projects/myproject/Project/file2.ts"]
Program options: {"watch":true,"project":"/user/username/projects/myproject/Project","configFilePath":"/user/username/projects/myproject/Project/tsconfig.json"}
Program files::
/a/lib/lib.d.ts
/user/username/projects/myproject/Project/file1.ts
/user/username/projects/myproject/Project/file2.ts

Semantic diagnostics in builder refreshed for::
/user/username/projects/myproject/Project/file2.ts

WatchedFiles::
/user/username/projects/myproject/project/tsconfig.json:
{"fileName":"/user/username/projects/myproject/Project/tsconfig.json","pollingInterval":250}
/user/username/projects/myproject/project/file1.ts:
{"fileName":"/user/username/projects/myproject/Project/file1.ts","pollingInterval":250}
/a/lib/lib.d.ts:
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
/user/username/projects/myproject/project/file2.ts:
{"fileName":"/user/username/projects/myproject/Project/file2.ts","pollingInterval":250}

FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/project/node_modules/@types:
{"directoryName":"/user/username/projects/myproject/Project/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject/node_modules/@types:
{"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
/user/username/projects/myproject/project:
{"directoryName":"/user/username/projects/myproject/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/Project/file2.js]
"use strict";
exports.__esModule = true;
exports.y = void 0;
exports.y = 10;