Skip to content

Commit 706c1e2

Browse files
committed
fix tsserver-project-system
1 parent 5c01d87 commit 706c1e2

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/harness/unittests/tsserverProjectSystem.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ namespace ts.projectSystem {
4949
path: "/a/lib/lib.d.ts",
5050
content: libFileContent
5151
};
52+
export const es5LibFile: FileOrFolder = {
53+
path: "/a/lib/lib.es5.full.d.ts",
54+
content: libFileContent
55+
};
5256

5357
export class TestTypingsInstaller extends TI.TypingsInstaller implements server.ITypingsInstaller {
5458
protected projectService: server.ProjectService;
@@ -658,7 +662,7 @@ namespace ts.projectSystem {
658662
path: "/a/b/c/module.d.ts",
659663
content: `export let x: number`
660664
};
661-
const host = createServerHost([appFile, moduleFile, libFile]);
665+
const host = createServerHost([appFile, moduleFile, es5LibFile]);
662666
const projectService = createProjectService(host);
663667
const { configFileName } = projectService.openClientFile(appFile.path);
664668

@@ -668,7 +672,7 @@ namespace ts.projectSystem {
668672

669673
const project = projectService.inferredProjects[0];
670674

671-
checkFileNames("inferred project", project.getFileNames(), [appFile.path, libFile.path, moduleFile.path]);
675+
checkFileNames("inferred project", project.getFileNames(), [appFile.path, es5LibFile.path, moduleFile.path]);
672676
checkWatchedDirectories(host, ["/a/b/c", "/a/b", "/a"]);
673677
});
674678

@@ -1137,23 +1141,23 @@ namespace ts.projectSystem {
11371141
content: "let x =1;"
11381142
};
11391143

1140-
const host = createServerHost([file1, file2, file3, libFile]);
1144+
const host = createServerHost([file1, file2, file3, es5LibFile]);
11411145
const projectService = createProjectService(host, { useSingleInferredProject: true });
11421146
projectService.openClientFile(file1.path);
11431147
projectService.openClientFile(file2.path);
11441148
projectService.openClientFile(file3.path);
11451149

11461150
checkNumberOfConfiguredProjects(projectService, 0);
11471151
checkNumberOfInferredProjects(projectService, 1);
1148-
checkProjectActualFiles(projectService.inferredProjects[0], [file1.path, file2.path, file3.path, libFile.path]);
1152+
checkProjectActualFiles(projectService.inferredProjects[0], [file1.path, file2.path, file3.path, es5LibFile.path]);
11491153

11501154

11511155
host.reloadFS([file1, configFile, file2, file3, libFile]);
11521156
host.triggerDirectoryWatcherCallback(getDirectoryPath(configFile.path), configFile.path);
11531157

11541158
checkNumberOfConfiguredProjects(projectService, 1);
11551159
checkNumberOfInferredProjects(projectService, 1);
1156-
checkProjectActualFiles(projectService.inferredProjects[0], [file2.path, file3.path, libFile.path]);
1160+
checkProjectActualFiles(projectService.inferredProjects[0], [file2.path, file3.path, es5LibFile.path]);
11571161
});
11581162

11591163
it("should close configured project after closing last open file", () => {
@@ -3471,7 +3475,7 @@ namespace ts.projectSystem {
34713475
path: "/a/b/f1.js",
34723476
content: "function test1() { }"
34733477
};
3474-
const host = createServerHost([f1, libFile]);
3478+
const host = createServerHost([f1, es5LibFile]);
34753479
const session = createSession(host);
34763480
openFilesForSession([f1], session);
34773481

@@ -3491,14 +3495,15 @@ namespace ts.projectSystem {
34913495
type: "request",
34923496
command: server.CommandNames.CompilerOptionsForInferredProjects,
34933497
seq: 3,
3494-
arguments: { options: { module: ModuleKind.CommonJS } }
3498+
arguments: { options: { module: ModuleKind.CommonJS, target: ScriptTarget.ES5 } }
34953499
});
34963500
const diagsAfterUpdate = session.executeCommand(<server.protocol.CompilerOptionsDiagnosticsRequest>{
34973501
type: "request",
34983502
command: server.CommandNames.CompilerOptionsDiagnosticsFull,
34993503
seq: 4,
35003504
arguments: { projectFileName: projectName }
35013505
}).response;
3506+
console.log(diagsAfterUpdate);
35023507
assert.isTrue(diagsAfterUpdate.length === 0);
35033508
});
35043509

0 commit comments

Comments
 (0)