Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6d200bf

Browse filesBrowse files
committed
Watch files through the host
Call `this.projectService.host.watchFile`, rather than `ts.sys.watchFile` so that it gets mocked correctly in the unit tests. Repair two failing tests.
1 parent 4652fc4 commit 6d200bf
Copy full SHA for 6d200bf

3 files changed

+3-3Lines changed: 3 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/harness/unittests/tsserverProjectSystem.ts‎

Copy file name to clipboardExpand all lines: src/harness/unittests/tsserverProjectSystem.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,7 @@ namespace ts.projectSystem {
20282028
projectService.openExternalProject({ projectFileName, options: {}, rootFiles: [{ fileName: file1.path, scriptKind: ScriptKind.JS, hasMixedContent: true }] });
20292029

20302030
checkNumberOfProjects(projectService, { externalProjects: 1 });
2031-
checkWatchedFiles(host, []);
2031+
checkWatchedFiles(host, [libFile.path]); // watching the "missing" lib file
20322032

20332033
const project = projectService.externalProjects[0];
20342034

Collapse file

‎src/harness/unittests/typingsInstaller.ts‎

Copy file name to clipboardExpand all lines: src/harness/unittests/typingsInstaller.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ namespace ts.projectSystem {
731731
checkNumberOfProjects(projectService, { configuredProjects: 1 });
732732
const p = projectService.configuredProjects[0];
733733
checkProjectActualFiles(p, [app.path, jsconfig.path]);
734-
checkWatchedFiles(host, [jsconfig.path, "/bower_components", "/node_modules"]);
734+
checkWatchedFiles(host, [jsconfig.path, "/bower_components", "/node_modules", libFile.path]);
735735

736736
installer.installAll(/*expectedCount*/ 1);
737737

Collapse file

‎src/server/project.ts‎

Copy file name to clipboardExpand all lines: src/server/project.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ namespace ts.server {
631631
// Missing files that are not yet watched should be added to the map.
632632
missingFilePaths.forEach(p => {
633633
if (!this.missingFilesMap.contains(p)) {
634-
const fileWatcher = ts.sys.watchFile(p, (_filename: string, removed?: boolean) => {
634+
const fileWatcher = this.projectService.host.watchFile(p, (_filename: string, removed?: boolean) => {
635635
// removed = deleted ? true : (added ? false : undefined)
636636
if (removed === false && this.missingFilesMap.contains(p)) {
637637
fileWatcher.close();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.