Skip to content

Commit 3fb0963

Browse files
committed
Add regression test
1 parent b86cb27 commit 3fb0963

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/testRunner/unittests/tsserver/projects.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,30 @@ namespace ts.projectSystem {
103103
assert.isFalse(proj3.languageServiceEnabled);
104104
});
105105

106+
it("should not crash when opening a file in a project with a disabled language service", () => {
107+
const file1 = {
108+
path: "/a/b/f1.js",
109+
content: "let x =1;",
110+
fileSize: 50 * 1024 * 1024
111+
};
112+
const file2 = {
113+
path: "/a/b/f2.js",
114+
content: "let x =1;",
115+
fileSize: 100
116+
};
117+
118+
const projName = "proj1";
119+
120+
const host = createServerHost([file1, file2]);
121+
const projectService = createProjectService(host, { useSingleInferredProject: true }, { eventHandler: noop });
122+
123+
projectService.openExternalProject({ rootFiles: toExternalFiles([file1.path, file2.path]), options: {}, projectFileName: projName });
124+
const proj1 = projectService.findProject(projName)!;
125+
assert.isFalse(proj1.languageServiceEnabled);
126+
127+
assert.doesNotThrow(() => projectService.openClientFile(file2.path));
128+
});
129+
106130
describe("ignoreConfigFiles", () => {
107131
it("external project including config file", () => {
108132
const file1 = {

0 commit comments

Comments
 (0)