mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 11:54:44 -06:00
parent
a1c8608f68
commit
b7b2c333a9
@ -1974,7 +1974,7 @@ namespace ts.server {
|
||||
// Read updated contents from disk
|
||||
const configFilename = normalizePath(project.getConfigFilePath());
|
||||
|
||||
const configFileContent = this.host.readFile(configFilename)!; // TODO: GH#18217
|
||||
const configFileContent = this.host.readFile(configFilename) || "";
|
||||
|
||||
const result = parseJsonText(configFilename, configFileContent);
|
||||
if (!result.endOfFileToken) {
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user