Tests for more state and remove some unnecessary logs (#57324)

This commit is contained in:
Sheetal Nandi
2024-02-07 13:47:40 -08:00
committed by GitHub
parent c790dc1dc7
commit 1ca93fe78f
679 changed files with 9894 additions and 405 deletions
+15 -1
View File
@@ -8,6 +8,8 @@ import {
import {
AutoImportProviderProject,
AuxiliaryProject,
isBackgroundProject,
isConfiguredProject,
LogLevel,
Project,
ProjectKind,
@@ -21,6 +23,10 @@ import {
interface ProjectData {
projectStateVersion: Project["projectStateVersion"];
projectProgramVersion: Project["projectProgramVersion"];
dirty: Project["dirty"];
isClosed: boolean;
isOrphan: boolean;
noOpenRef: boolean;
autoImportProviderHost: Project["autoImportProviderHost"];
noDtsResolutionProject: Project["noDtsResolutionProject"];
originalConfiguredProjects: Project["originalConfiguredProjects"];
@@ -83,6 +89,10 @@ export function patchServiceForStateBaseline(service: ProjectService) {
const projectPropertyLogs = [] as string[];
projectDiff = printProperty(PrintPropertyWhen.Always, data, "projectStateVersion", project.projectStateVersion, projectDiff, projectPropertyLogs);
projectDiff = printProperty(PrintPropertyWhen.Always, data, "projectProgramVersion", project.projectProgramVersion, projectDiff, projectPropertyLogs);
projectDiff = printProperty(PrintPropertyWhen.TruthyOrChangedOrNew, data, "dirty", project.dirty, projectDiff, projectPropertyLogs);
projectDiff = printProperty(PrintPropertyWhen.TruthyOrChangedOrNew, data, "isClosed", project.isClosed(), projectDiff, projectPropertyLogs);
projectDiff = printProperty(PrintPropertyWhen.TruthyOrChangedOrNew, data, "isOrphan", !isBackgroundProject(project) && project.isOrphan(), projectDiff, projectPropertyLogs);
projectDiff = printProperty(PrintPropertyWhen.TruthyOrChangedOrNew, data, "noOpenRef", isConfiguredProject(project) && !project.hasOpenRef(), projectDiff, projectPropertyLogs);
projectDiff = printProperty(PrintPropertyWhen.DefinedOrChangedOrNew, data, "autoImportProviderHost", project.autoImportProviderHost, projectDiff, projectPropertyLogs, project.autoImportProviderHost ? project.autoImportProviderHost.projectName : project.autoImportProviderHost);
projectDiff = printProperty(PrintPropertyWhen.DefinedOrChangedOrNew, data, "noDtsResolutionProject", project.noDtsResolutionProject, projectDiff, projectPropertyLogs, project.noDtsResolutionProject ? project.noDtsResolutionProject.projectName : project.noDtsResolutionProject);
return printSetPropertyAndCreateStatementLog(
@@ -100,6 +110,10 @@ export function patchServiceForStateBaseline(service: ProjectService) {
project => ({
projectStateVersion: project.projectStateVersion,
projectProgramVersion: project.projectProgramVersion,
dirty: project.dirty,
isClosed: project.isClosed(),
isOrphan: !isBackgroundProject(project) && project.isOrphan(),
noOpenRef: isConfiguredProject(project) && !project.hasOpenRef(),
autoImportProviderHost: project.autoImportProviderHost,
noDtsResolutionProject: project.noDtsResolutionProject,
originalConfiguredProjects: project.originalConfiguredProjects && new Set(project.originalConfiguredProjects),
@@ -127,7 +141,7 @@ export function patchServiceForStateBaseline(service: ProjectService) {
}
return printSetPropertyAndCreateStatementLog(
logs,
`${info.fileName}${isOpen ? " (Open)" : ""}`,
`${info.fileName}${info.isDynamic ? " (Dynamic)" : ""}${isOpen ? " (Open)" : ""}`,
PrintPropertyWhen.Always,
"containingProjects",
infoPropertyLogs,
@@ -34,13 +34,6 @@ export function baselineTsserverLogs(scenario: string, subScenario: string, sess
Harness.Baseline.runBaseline(`tsserver/${scenario}/${subScenario.split(" ").join("-")}.js`, sessionOrService.logger.logs.join("\r\n"));
}
export function appendAllScriptInfos(session: TestSession) {
session.logger.log("");
session.logger.log(`ScriptInfos:`);
session.getProjectService().filenameToScriptInfo.forEach(info => session.logger.log(`path: ${info.path} fileName: ${info.fileName}`));
session.logger.log("");
}
export function toExternalFile(fileName: string): ts.server.protocol.ExternalFile {
return { fileName };
}
@@ -486,21 +479,9 @@ export function verifyGetErrScenario(scenario: VerifyGetErrScenario) {
verifyErrorsUsingSyncMethods(scenario);
}
export function verifyDynamic(session: TestSession, path: string) {
session.logger.log(`${path} isDynamic:: ${session.getProjectService().filenameToScriptInfo.get(path)!.isDynamic}`);
}
export function createHostWithSolutionBuild(files: readonly FileOrFolderOrSymLink[], rootNames: readonly string[]) {
const host = createServerHost(files);
// ts build should succeed
ensureErrorFreeBuild(host, rootNames);
return host;
}
export function logInferredProjectsOrphanStatus(session: TestSession) {
session.getProjectService().inferredProjects.forEach(inferredProject => session.logger.log(`Inferred project: ${inferredProject.projectName} isOrphan:: ${inferredProject.isOrphan()} isClosed: ${inferredProject.isClosed()}`));
}
export function logConfiguredProjectsHasOpenRefStatus(session: TestSession) {
session.getProjectService().configuredProjects.forEach(configuredProject => session.logger.log(`Configured project: ${configuredProject.projectName} hasOpenRef:: ${configuredProject.hasOpenRef()} isClosed: ${configuredProject.isClosed()}`));
}
@@ -95,11 +95,7 @@ describe("unittests:: tsserver:: autoImportProvider", () => {
it("Auto-importable file is in inferred project until imported", () => {
const { session, updateFile } = setup([angularFormsDts, angularFormsPackageJson, tsconfig, packageJson, indexTs]);
openFilesForSession([angularFormsDts], session);
session.logger.log(`Default Project for ${angularFormsDts.path}:: ${session.getProjectService().getDefaultProjectForFile(angularFormsDts.path as ts.server.NormalizedPath, /*ensureProject*/ true)?.projectName}`);
updateFile(indexTs.path, "import '@angular/forms'");
session.logger.log(`Default Project for ${angularFormsDts.path}:: ${session.getProjectService().getDefaultProjectForFile(angularFormsDts.path as ts.server.NormalizedPath, /*ensureProject*/ true)?.projectName}`);
assert.isUndefined(session.getProjectService().configuredProjects.get(tsconfig.path)!.getLanguageService().getAutoImportProvider());
session.host.baselineHost("After getAutoImportProvider");
baselineTsserverLogs("autoImportProvider", "Auto-importable file is in inferred project until imported", session);
@@ -1022,11 +1022,6 @@ describe("unittests:: tsserver:: compileOnSave:: CompileOnSaveAffectedFileListRe
});
}
function logDirtyOfProjects(session: TestSession) {
session.logger.log(`Project1 is dirty: ${session.getProjectService().configuredProjects.get(`/user/username/projects/myproject/app1/tsconfig.json`)!.dirty}`);
session.logger.log(`Project2 is dirty: ${session.getProjectService().configuredProjects.get(`/user/username/projects/myproject/app2/tsconfig.json`)!.dirty}`);
}
function verify(subScenario: string, commandArgs: ts.server.protocol.FileRequestArgs) {
it(subScenario, () => {
const core: File = {
@@ -1063,12 +1058,10 @@ describe("unittests:: tsserver:: compileOnSave:: CompileOnSaveAffectedFileListRe
openFilesForSession([app1, app2, core], session);
insertString(session, app1);
insertString(session, app2);
logDirtyOfProjects(session);
session.executeCommandSeq<ts.server.protocol.CompileOnSaveAffectedFileListRequest>({
command: ts.server.protocol.CommandTypes.CompileOnSaveAffectedFileList,
arguments: commandArgs,
});
logDirtyOfProjects(session);
baselineTsserverLogs("compileOnSave", subScenario, session);
});
}
@@ -12,8 +12,6 @@ import {
import {
baselineTsserverLogs,
closeFilesForSession,
logConfiguredProjectsHasOpenRefStatus,
logInferredProjectsOrphanStatus,
openFilesForSession,
TestSession,
verifyGetErrRequest,
@@ -230,8 +228,6 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
host.runQueuedTimeoutCallbacks();
// will not remove project 1
logInferredProjectsOrphanStatus(session);
// Open random file and it will reuse first inferred project
openFilesForSession([randomFile], session);
baselineTsserverLogs("configuredProjects", "should properly handle module resolution changes in config file", session);
@@ -301,13 +297,8 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
const host = createServerHost([file1, file2, configFile, libFile]);
const session = new TestSession({ host, useSingleInferredProject: true });
openFilesForSession([file1], session);
logConfiguredProjectsHasOpenRefStatus(session); // file1
closeFilesForSession([file1], session);
logConfiguredProjectsHasOpenRefStatus(session); // No open files
openFilesForSession([file2], session);
logConfiguredProjectsHasOpenRefStatus(session); // file2
baselineTsserverLogs("configuredProjects", "should reuse same project if file is opened from the configured project that has no open files", session);
});
@@ -328,13 +319,8 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
const host = createServerHost([file1, configFile, libFile]);
const session = new TestSession({ host, useSingleInferredProject: true });
openFilesForSession([file1], session);
logConfiguredProjectsHasOpenRefStatus(session); // file1
closeFilesForSession([file1], session);
logConfiguredProjectsHasOpenRefStatus(session); // No files
openFilesForSession([libFile], session);
logConfiguredProjectsHasOpenRefStatus(session); // No files + project closed
baselineTsserverLogs("configuredProjects", "should not close configured project after closing last open file, but should be closed on next file open if its not the file from same project", session);
});
@@ -362,7 +348,6 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
host.writeFile(configFile.path, configFile.content);
host.runQueuedTimeoutCallbacks(); // load configured project from disk + ensureProjectsForOpenFiles
logInferredProjectsOrphanStatus(session);
baselineTsserverLogs("configuredProjects", "open file become a part of configured project if it is referenced from root file", session);
});
@@ -466,24 +451,11 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
const session = new TestSession(host);
openFilesForSession([file1, file2, file3, file4], session);
logConfiguredProjectsHasOpenRefStatus(session); // file1 and file3
host.writeFile(configFile.path, "{}");
host.runQueuedTimeoutCallbacks();
logConfiguredProjectsHasOpenRefStatus(session); // file1, file2, file3
logInferredProjectsOrphanStatus(session);
closeFilesForSession([file1, file2, file4], session);
logConfiguredProjectsHasOpenRefStatus(session); // file3
logInferredProjectsOrphanStatus(session);
openFilesForSession([file4], session);
logConfiguredProjectsHasOpenRefStatus(session); // file3
closeFilesForSession([file3], session);
logConfiguredProjectsHasOpenRefStatus(session); // No files
const file5: File = {
path: "/file5.ts",
@@ -523,23 +495,15 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
const host = createServerHost(hostFiles);
const session = new TestSession(host);
openFilesForSession([file1, file2, file3], session);
logConfiguredProjectsHasOpenRefStatus(session); // file1 and file3
closeFilesForSession([file1, file3], session);
logConfiguredProjectsHasOpenRefStatus(session); // No files
host.writeFile(configFile.path, "{}");
session.host.baselineHost("configFile updated");
// Time out is not yet run so there is project update pending
logConfiguredProjectsHasOpenRefStatus(session); // Pending update and file2 might get into the project
openFilesForSession([file4], session);
logConfiguredProjectsHasOpenRefStatus(session); // Pending update and F2 might get into the project
host.runQueuedTimeoutCallbacks();
logConfiguredProjectsHasOpenRefStatus(session); // file2
logInferredProjectsOrphanStatus(session);
baselineTsserverLogs("configuredProjects", "Open ref of configured project when open file gets added to the project as part of configured file update buts its open file references are all closed when the update happens", session);
});
@@ -566,29 +530,13 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
const session = new TestSession(host);
openFilesForSession([f1], session);
logConfiguredProjectsHasOpenRefStatus(session); // f1
closeFilesForSession([f1], session);
logConfiguredProjectsHasOpenRefStatus(session); // No files
for (const f of [f1, f2, f3]) {
// All the script infos should be present and contain the project since it is still alive.
const scriptInfo = session.getProjectService().getScriptInfoForNormalizedPath(ts.server.toNormalizedPath(f.path))!;
session.logger.log(`Containing projects for ${f.path}:: ${scriptInfo.containingProjects.map(p => p.projectName).join(",")}`);
}
const f4 = {
path: "/aa.js",
content: "var x = 1",
};
host.writeFile(f4.path, f4.content);
openFilesForSession([f4], session);
logConfiguredProjectsHasOpenRefStatus(session); // No files
for (const f of [f1, f2, f3]) {
// All the script infos should not be present since the project is closed and orphan script infos are collected
assert.isUndefined(session.getProjectService().getScriptInfoForNormalizedPath(ts.server.toNormalizedPath(f.path)));
}
baselineTsserverLogs("configuredProjects", "files are properly detached when language service is disabled", session);
});
@@ -6,7 +6,6 @@ import {
protocolFileLocationFromSubstring,
setCompilerOptionsForInferredProjectsRequestForSession,
TestSession,
verifyDynamic,
} from "../helpers/tsserver";
import {
createServerHost,
@@ -25,8 +24,6 @@ var x = 10;`,
const host = createServerHost([libFile]);
const session = new TestSession(host);
openFilesForSession([{ file, content: file.content }], session);
verifyDynamic(session, session.getProjectService().toPath(file.path));
baselineTsserverLogs("dynamicFiles", subscenario, session);
});
}
@@ -50,7 +47,6 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => {
projectRootPath: "/proj",
},
});
verifyDynamic(session, `/proj/untitled:^untitled-1`);
session.executeCommandSeq<ts.server.protocol.CodeFixRequest>({
command: ts.server.protocol.CommandTypes.GetCodeFixes,
arguments: {
@@ -77,7 +73,6 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => {
content: "const x = 10;",
projectRootPath: "/user/username/projects/myproject",
}], session);
verifyDynamic(session, `/user/username/projects/myproject/${untitledFile}`);
const untitled: File = {
path: `/user/username/projects/myproject/Untitled-1.ts`,
@@ -97,7 +92,6 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => {
content: "const x = 10;",
projectRootPath: "/user/username/projects/myproject",
}], session);
verifyDynamic(session, `/user/username/projects/myproject/${untitledFile}`);
baselineTsserverLogs("dynamicFiles", "opening untitled files", session);
});
@@ -117,7 +111,6 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => {
content: "const x = 10;",
projectRootPath: "/user/username/projects/myproject",
}], session);
verifyDynamic(session, `/user/username/projects/myproject/${untitledFile}`);
// Close untitled file
closeFilesForSession([untitledFile], session);
@@ -173,8 +166,6 @@ describe("unittests:: tsserver:: dynamicFiles:: ", () => {
}, session);
openFilesForSession([{ file: file.path, content: "var x = 10;" }], session);
verifyDynamic(session, `/${file.path}`);
session.executeCommandSeq<ts.server.protocol.QuickInfoRequest>({
command: ts.server.protocol.CommandTypes.Quickinfo,
arguments: protocolFileLocationFromSubstring(file, "x"),
@@ -202,8 +193,6 @@ describe("unittests:: tsserver:: dynamicFiles:: ", () => {
const session = new TestSession({ host, useInferredProjectPerProjectRoot: true });
openFilesForSession([{ file: file.path, projectRootPath: "/user/username/projects/myproject" }], session);
verifyDynamic(session, `/user/username/projects/myproject/${file.path}`);
session.executeCommandSeq<ts.server.protocol.OutliningSpansRequest>({
command: ts.server.protocol.CommandTypes.GetOutliningSpans,
arguments: {
@@ -6,15 +6,12 @@ import {
import {
baselineTsserverLogs,
closeFilesForSession,
logConfiguredProjectsHasOpenRefStatus,
logInferredProjectsOrphanStatus,
openExternalProjectForSession,
openExternalProjectsForSession,
openFilesForSession,
TestSession,
toExternalFile,
toExternalFiles,
verifyDynamic,
} from "../helpers/tsserver";
import {
createServerHost,
@@ -176,8 +173,6 @@ describe("unittests:: tsserver:: externalProjects", () => {
projectFileName,
}, session);
verifyDynamic(session, "/^scriptdocument1 file1.ts");
externalFiles[0].content = "let x =1;";
session.executeCommandSeq<ts.server.protocol.ApplyChangedToOpenFilesRequest>({
command: ts.server.protocol.CommandTypes.ApplyChangedToOpenFiles,
@@ -252,23 +247,16 @@ describe("unittests:: tsserver:: externalProjects", () => {
// open client file - should not lead to creation of inferred project
openFilesForSession([file1], session);
logInferredProjectsOrphanStatus(session);
openFilesForSession([file3], session);
logInferredProjectsOrphanStatus(session);
session.executeCommandSeq<ts.server.protocol.CloseExternalProjectRequest>({
command: ts.server.protocol.CommandTypes.CloseExternalProject,
arguments: { projectFileName },
});
logInferredProjectsOrphanStatus(session);
// open file 'file1' from configured project keeps project alive
closeFilesForSession([file3], session);
logInferredProjectsOrphanStatus(session);
closeFilesForSession([file1], session);
logInferredProjectsOrphanStatus(session);
openFilesForSession([file2], session);
baselineTsserverLogs("externalProjects", "external project that included config files", session);
@@ -714,12 +702,9 @@ describe("unittests:: tsserver:: externalProjects", () => {
const host = createServerHost([f, config]);
const session = new TestSession(host);
openFilesForSession([f], session);
logConfiguredProjectsHasOpenRefStatus(session);
closeFilesForSession([f], session);
logConfiguredProjectsHasOpenRefStatus(session);
openFilesForSession([f], session);
logConfiguredProjectsHasOpenRefStatus(session);
baselineTsserverLogs("externalProjects", "should handle non-existing directories in config file", session);
});
@@ -814,7 +799,6 @@ describe("unittests:: tsserver:: externalProjects", () => {
rootFiles: [{ fileName: jsConfig.path }, { fileName: tsconfig.path }, { fileName: jsFilePath }],
options: { allowJs: false },
}], session);
logInferredProjectsOrphanStatus(session);
baselineTsserverLogs("externalProjects", "handles creation of external project with jsconfig before jsconfig creation watcher is invoked", session);
});
@@ -11,7 +11,6 @@ import {
import {
baselineTsserverLogs,
closeFilesForSession,
logInferredProjectsOrphanStatus,
openFilesForSession,
setCompilerOptionsForInferredProjectsRequestForSession,
TestSession,
@@ -107,7 +106,6 @@ describe("unittests:: tsserver:: inferredProjects", () => {
moduleResolution: ts.server.protocol.ModuleResolutionKind.Classic,
}, session);
host.runQueuedTimeoutCallbacks();
logInferredProjectsOrphanStatus(session);
baselineTsserverLogs("inferredProjects", "project settings for inferred projects", session);
});
@@ -3,7 +3,6 @@ import {
jsonToReadableText,
} from "../helpers";
import {
appendAllScriptInfos,
baselineTsserverLogs,
closeFilesForSession,
openExternalProjectForSession,
@@ -241,7 +240,6 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", (
projectRootPath: useProjectRoot ? folderPath : undefined,
},
});
appendAllScriptInfos(session);
// Since this is not js project so no typings are queued
verifyGetErrRequest({ session, files: [untitledFile] });
@@ -12,8 +12,6 @@ import {
import {
baselineTsserverLogs,
closeFilesForSession,
logConfiguredProjectsHasOpenRefStatus,
logInferredProjectsOrphanStatus,
openExternalProjectForSession,
openFilesForSession,
protocolFileLocationFromSubstring,
@@ -325,7 +323,6 @@ describe("unittests:: tsserver:: projects::", () => {
host.writeFile(file2.path, `export * from "../c/f3"`); // now inferred project should inclule file3
host.runQueuedTimeoutCallbacks();
logInferredProjectsOrphanStatus(session);
baselineTsserverLogs("projects", "changes in closed files are reflected in project structure", session);
});
@@ -512,22 +509,11 @@ describe("unittests:: tsserver:: projects::", () => {
const session = new TestSession(host);
openFilesForSession([file2], session);
logInferredProjectsOrphanStatus(session);
openFilesForSession([file3], session);
logInferredProjectsOrphanStatus(session);
openFilesForSession([file1], session);
logInferredProjectsOrphanStatus(session);
closeFilesForSession([file1], session);
logInferredProjectsOrphanStatus(session);
closeFilesForSession([file3], session);
logInferredProjectsOrphanStatus(session);
openFilesForSession([file3], session);
logInferredProjectsOrphanStatus(session);
baselineTsserverLogs("projects", "correctly migrate files between projects", session);
});
@@ -892,19 +878,10 @@ describe("unittests:: tsserver:: projects::", () => {
const session = new TestSession(host);
openFilesForSession([file2], session);
logConfiguredProjectsHasOpenRefStatus(session);
openFilesForSession([file1], session);
logConfiguredProjectsHasOpenRefStatus(session);
closeFilesForSession([file2], session);
logConfiguredProjectsHasOpenRefStatus(session);
closeFilesForSession([file1], session);
logConfiguredProjectsHasOpenRefStatus(session);
openFilesForSession([file2], session);
logConfiguredProjectsHasOpenRefStatus(session);
baselineTsserverLogs("projects", "File in multiple projects at opened and closed correctly", session);
});
@@ -1183,19 +1160,11 @@ describe("unittests:: tsserver:: projects::", () => {
host.writeFile(config.path, config.content);
host.runQueuedTimeoutCallbacks();
verifyFile2InfoIsOrphan();
file2.content += "export let z = 10;";
host.writeFile(file2.path, file2.content);
host.runQueuedTimeoutCallbacks();
verifyFile2InfoIsOrphan();
baselineTsserverLogs("projects", "Orphan source files are handled correctly on watch trigger", session);
function verifyFile2InfoIsOrphan() {
const info = ts.Debug.checkDefined(session.getProjectService().getScriptInfoForPath(file2.path as ts.Path));
session.logger.log(`Containing projects for ${file2.path}:: ${info.containingProjects.map(p => p.projectName).join(",")}`);
}
});
it("no project structure update on directory watch invoke on open file save", () => {
@@ -2,7 +2,6 @@ import * as ts from "../../_namespaces/ts";
import {
baselineTsserverLogs,
closeFilesForSession,
logInferredProjectsOrphanStatus,
openFilesForSession,
TestSession,
} from "../helpers/tsserver";
@@ -71,7 +70,6 @@ describe("unittests:: tsserver:: reload", () => {
// send close request
closeFilesForSession([f1], session);
checkScriptInfoAndProjects("contents of closed file");
checkInferredProjectIsOrphan();
// Can reload contents of the file when its not open and has no project
// reload from temp file
@@ -80,7 +78,6 @@ describe("unittests:: tsserver:: reload", () => {
arguments: { file: f1.path, tmpfile: tmp.path },
});
checkScriptInfoAndProjects("contents of temp file");
checkInferredProjectIsOrphan();
// reload from own file
session.executeCommandSeq<ts.server.protocol.ReloadRequest>({
@@ -88,7 +85,6 @@ describe("unittests:: tsserver:: reload", () => {
arguments: { file: f1.path, tmpfile: undefined! },
});
checkScriptInfoAndProjects("contents of closed file");
checkInferredProjectIsOrphan();
// Open file again without setting its content
openFilesForSession([f1], session);
@@ -99,7 +95,6 @@ describe("unittests:: tsserver:: reload", () => {
closeFilesForSession([f1], session);
checkScriptInfoAndProjects("contents of closed file");
assert.strictEqual(info.getSnapshot(), snap);
checkInferredProjectIsOrphan();
// reload from temp file
session.executeCommandSeq<ts.server.protocol.ReloadRequest>({
@@ -108,7 +103,6 @@ describe("unittests:: tsserver:: reload", () => {
});
checkScriptInfoAndProjects("contents of temp file");
assert.notStrictEqual(info.getSnapshot(), snap);
checkInferredProjectIsOrphan();
// reload from own file
session.executeCommandSeq<ts.server.protocol.ReloadRequest>({
@@ -117,14 +111,8 @@ describe("unittests:: tsserver:: reload", () => {
});
checkScriptInfoAndProjects("contents of closed file");
assert.notStrictEqual(info.getSnapshot(), snap);
checkInferredProjectIsOrphan();
baselineTsserverLogs("reload", "should work when script info doesnt have any project open", session);
function checkInferredProjectIsOrphan() {
logInferredProjectsOrphanStatus(session);
session.logger.log(`info:: ${info.path}:: ${info.containingProjects.map(p => p.projectName).join(",")}`);
}
function checkScriptInfoAndProjects(captionForContents: string) {
assert.strictEqual(session.getProjectService().getScriptInfo(f1.path), info);
checkScriptInfoContents(captionForContents);