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.
This commit is contained in:
Andrew Casey
2017-06-21 10:49:17 -07:00
parent 4652fc491f
commit 6d200bffbd
3 changed files with 3 additions and 3 deletions

View File

@@ -631,7 +631,7 @@ namespace ts.server {
// Missing files that are not yet watched should be added to the map.
missingFilePaths.forEach(p => {
if (!this.missingFilesMap.contains(p)) {
const fileWatcher = ts.sys.watchFile(p, (_filename: string, removed?: boolean) => {
const fileWatcher = this.projectService.host.watchFile(p, (_filename: string, removed?: boolean) => {
// removed = deleted ? true : (added ? false : undefined)
if (removed === false && this.missingFilesMap.contains(p)) {
fileWatcher.close();