Handle if reading tsconfig file fails (#37563)

Fixes #36862
This commit is contained in:
Sheetal Nandi
2020-03-25 10:14:31 -07:00
committed by GitHub
parent a1c8608f68
commit b7b2c333a9
2 changed files with 24 additions and 1 deletions

View File

@@ -1233,4 +1233,27 @@ declare var console: {
checkWatchedDirectories(host, watchedRecursiveDirectories, /*recursive*/ true);
});
});
describe("unittests:: tsserver:: ConfiguredProjects:: when reading tsconfig file fails", () => {
it("should be tolerated without crashing the server", () => {
const configFile = {
path: `${tscWatch.projectRoot}/tsconfig.json`,
content: ""
};
const file1 = {
path: `${tscWatch.projectRoot}/file1.ts`,
content: "let t = 10;"
};
const host = createServerHost([file1, configFile]);
const projectService = createProjectService(host);
const originalReadFile = host.readFile;
host.readFile = f => {
return f === configFile.path ?
undefined :
originalReadFile.call(host, f);
};
projectService.openClientFile(file1.path);
});
});
}