From a88c36655b575d3039f187e64016b971efc0f173 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 12 Sep 2022 20:36:24 -0700 Subject: [PATCH] Fix test baselining for tsserver host timeouts (#50748) --- .../tsserver/cachingFileSystemInformation.ts | 12 +-- .../unittests/tsserver/configFileSearch.ts | 12 +-- .../unittests/tsserver/configuredProjects.ts | 20 ++-- .../events/projectUpdatedInBackground.ts | 6 +- src/testRunner/unittests/tsserver/helpers.ts | 93 +++++++++---------- .../unittests/tsserver/moduleResolution.ts | 40 ++++---- .../tsserver/moduleSpecifierCache.ts | 2 +- .../unittests/tsserver/projectErrors.ts | 16 ++-- .../unittests/tsserver/projectReferences.ts | 32 +++---- .../tsserver/projectReferencesSourcemap.ts | 82 ++++++++-------- src/testRunner/unittests/tsserver/projects.ts | 14 +-- .../tsserver/projectsWithReferences.ts | 42 ++++----- .../unittests/tsserver/resolutionCache.ts | 34 +++---- src/testRunner/unittests/tsserver/symLinks.ts | 20 ++-- .../unittests/tsserver/typingsInstaller.ts | 6 +- .../unittests/tsserver/watchEnvironment.ts | 4 +- ...-same-ambient-module-and-is-also-module.js | 36 +++++++ ...esnt-exist-on-disk-yet-with-projectRoot.js | 16 ++++ ...t-exist-on-disk-yet-without-projectRoot.js | 14 +++ ...oundUpdate-and-project-is-at-root-level.js | 18 ++++ ...Update-and-project-is-not-at-root-level.js | 44 +++++++++ ...oundUpdate-and-project-is-at-root-level.js | 18 ++++ ...Update-and-project-is-not-at-root-level.js | 44 +++++++++ ...directory-watch-invoke-on-file-creation.js | 16 ++++ .../disable-suggestion-diagnostics.js | 14 +++ .../resolutionCache/suggestion-diagnostics.js | 14 +++ .../suppressed-diagnostic-events.js | 20 ++++ 27 files changed, 467 insertions(+), 222 deletions(-) diff --git a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts index 77e2de13023c8..0f042ba32abee 100644 --- a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts +++ b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts @@ -146,7 +146,7 @@ namespace ts.projectSystem { logCacheAndClear(projectService.logger); host.writeFile(imported.path, imported.content); - projectService.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); logSemanticDiagnostics(projectService, project, root); logCacheAndClear(projectService.logger); baselineTsserverLogs("cachingFileSystemInformation", "loads missing files from disk", projectService); @@ -280,7 +280,7 @@ namespace ts.projectSystem { // Create file cookie.ts host.writeFile(file3.path, file3.content); - projectService.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); logCacheAndClear(projectService.logger); projectService.openClientFile(file3.path); @@ -479,15 +479,15 @@ namespace ts.projectSystem { if (npmInstallComplete || timeoutDuringPartialInstallation) { if (timeoutQueueLengthWhenRunningTimeouts) { // Expected project update - projectService.checkTimeoutQueueLengthAndRun(timeoutQueueLengthWhenRunningTimeouts + 1); // Scheduled invalidation of resolutions - projectService.runQueuedTimeoutCallbacks(); // Actual update + host.checkTimeoutQueueLengthAndRun(timeoutQueueLengthWhenRunningTimeouts + 1); // Scheduled invalidation of resolutions + host.runQueuedTimeoutCallbacks(); // Actual update } else { - projectService.checkTimeoutQueueLengthAndRun(timeoutQueueLengthWhenRunningTimeouts); + host.checkTimeoutQueueLengthAndRun(timeoutQueueLengthWhenRunningTimeouts); } } else { - projectService.checkTimeoutQueueLength(3); + host.checkTimeoutQueueLength(3); } } } diff --git a/src/testRunner/unittests/tsserver/configFileSearch.ts b/src/testRunner/unittests/tsserver/configFileSearch.ts index 02829a326f997..a81bedb6431e0 100644 --- a/src/testRunner/unittests/tsserver/configFileSearch.ts +++ b/src/testRunner/unittests/tsserver/configFileSearch.ts @@ -43,7 +43,7 @@ namespace ts.projectSystem { // Delete config file - should create inferred project and not configured project host.deleteFile(configFile.path); - service.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); checkNumberOfProjects(service, { inferredProjects: 1 }); baselineTsserverLogs("configFileSearch", "should use projectRootPath when searching for inferred project again", service); }); @@ -73,7 +73,7 @@ namespace ts.projectSystem { // Delete config file - should create inferred project with project root path set host.deleteFile(configFile.path); - service.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("configFileSearch", "should use projectRootPath when searching for inferred project again 2", service); }); @@ -98,10 +98,10 @@ namespace ts.projectSystem { const { host, projectService } = openClientFile([file, libFile, tsconfig]); host.deleteFile(tsconfig.path); - projectService.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); host.writeFile(tsconfig.path, tsconfig.content); - projectService.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("configFileSearch", "tsconfig for the file exists", projectService); }); @@ -110,10 +110,10 @@ namespace ts.projectSystem { const { host, projectService } = openClientFile([file, libFile]); host.writeFile(tsconfig.path, tsconfig.content); - projectService.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); host.deleteFile(tsconfig.path); - projectService.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("configFileSearch", "tsconfig for the file does not exist", projectService); }); diff --git a/src/testRunner/unittests/tsserver/configuredProjects.ts b/src/testRunner/unittests/tsserver/configuredProjects.ts index 7e0446fd58626..3524e69206dfc 100644 --- a/src/testRunner/unittests/tsserver/configuredProjects.ts +++ b/src/testRunner/unittests/tsserver/configuredProjects.ts @@ -90,11 +90,11 @@ namespace ts.projectSystem { // Add a tsconfig file host.writeFile(configFile.path, configFile.content); - projectService.checkTimeoutQueueLengthAndRun(2); // load configured project from disk + ensureProjectsForOpenFiles + host.checkTimeoutQueueLengthAndRun(2); // load configured project from disk + ensureProjectsForOpenFiles // remove the tsconfig file host.deleteFile(configFile.path); - projectService.checkTimeoutQueueLengthAndRun(1); // Refresh inferred projects + host.checkTimeoutQueueLengthAndRun(1); // Refresh inferred projects baselineTsserverLogs("configuredProjects", "add and then remove a config file in a folder with loose files", projectService); }); @@ -110,7 +110,7 @@ namespace ts.projectSystem { // add a new ts file host.writeFile(commonFile2.path, commonFile2.content); - projectService.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("configuredProjects", "add new files to a configured project without file list", projectService); }); @@ -548,7 +548,7 @@ namespace ts.projectSystem { assert.isTrue(configProject1.hasOpenRef()); // file1 and file3 host.writeFile(configFile.path, "{}"); - projectService.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); assert.isTrue(configProject1.hasOpenRef()); // file1, file2, file3 assert.isTrue(projectService.inferredProjects[0].isOrphan()); @@ -1033,7 +1033,7 @@ foo();` strict: true } })); - projectService.checkTimeoutQueueLengthAndRun(3); + host.checkTimeoutQueueLengthAndRun(3); host.writeFile(bravoExtendedConfig.path, JSON.stringify({ extends: "./alpha.tsconfig.json", @@ -1041,15 +1041,15 @@ foo();` strict: false } })); - projectService.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); host.writeFile(bConfig.path, JSON.stringify({ extends: "../extended/alpha.tsconfig.json", })); - projectService.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); host.writeFile(alphaExtendedConfig.path, "{}"); - projectService.checkTimeoutQueueLengthAndRun(3); + host.checkTimeoutQueueLengthAndRun(3); baselineTsserverLogs("configuredProjects", "should watch the extended configs of multiple projects", projectService); }); @@ -1183,8 +1183,8 @@ foo();` projectService.openClientFile(file1.path); host.writeFile(file2.path, file2.content); - projectService.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions - projectService.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions + host.runQueuedTimeoutCallbacks(); // Actual update // On next file open the files file2a should be closed and not watched any more projectService.openClientFile(file2.path); diff --git a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts index 61991ef4a89fa..951c7215872d2 100644 --- a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts +++ b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts @@ -442,7 +442,7 @@ namespace ts.projectSystem { file3.content += "export class d {}"; host.writeFile(file3.path, file3.content); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // Since this is first event verifyProjectsUpdatedInBackgroundEventHandler([{ @@ -453,8 +453,8 @@ namespace ts.projectSystem { }]); host.writeFile(file2.path, file2.content); - session.runQueuedTimeoutCallbacks(); // For invalidation - session.runQueuedTimeoutCallbacks(); // For actual update + host.runQueuedTimeoutCallbacks(); // For invalidation + host.runQueuedTimeoutCallbacks(); // For actual update verifyProjectsUpdatedInBackgroundEventHandler(useSlashRootAsSomeNotRootFolderInUserDirectory ? [{ eventName: server.ProjectsUpdatedInBackgroundEvent, diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 6a8504aeef4ac..8d7be8e8ae4ab 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -342,6 +342,41 @@ namespace ts.projectSystem { } } + function patchHostTimeouts(host: TestFSWithWatch.TestServerHostTrackingWrittenFiles, session: TestSession | TestProjectService) { + const originalCheckTimeoutQueueLength = host.checkTimeoutQueueLength; + const originalRunQueuedTimeoutCallbacks = host.runQueuedTimeoutCallbacks; + const originalRunQueuedImmediateCallbacks = host.runQueuedImmediateCallbacks; + + host.checkTimeoutQueueLengthAndRun = checkTimeoutQueueLengthAndRun; + host.checkTimeoutQueueLength = checkTimeoutQueueLength; + host.runQueuedTimeoutCallbacks = runQueuedTimeoutCallbacks; + host.runQueuedImmediateCallbacks = runQueuedImmediateCallbacks; + + function checkTimeoutQueueLengthAndRun(expected: number) { + session.baselineHost(`Before checking timeout queue length (${expected}) and running`); + originalCheckTimeoutQueueLength.call(host, expected); + originalRunQueuedTimeoutCallbacks.call(host); + session.baselineHost(`After checking timeout queue length (${expected}) and running`); + } + + function checkTimeoutQueueLength(expected: number) { + session.baselineHost(`Checking timeout queue length: ${expected}`); + originalCheckTimeoutQueueLength.call(host, expected); + } + + function runQueuedTimeoutCallbacks(timeoutId?: number) { + session.baselineHost(`Before running timeout callback${timeoutId === undefined ? "s" : timeoutId}`); + originalRunQueuedTimeoutCallbacks.call(host, timeoutId); + session.baselineHost(`After running timeout callback${timeoutId === undefined ? "s" : timeoutId}`); + } + + function runQueuedImmediateCallbacks(checkCount?: number) { + session.baselineHost(`Before running immediate callbacks${checkCount === undefined ? "" : ` and checking length (${checkCount})`}`); + originalRunQueuedImmediateCallbacks.call(host, checkCount); + session.baselineHost(`Before running immediate callbacks${checkCount === undefined ? "" : ` and checking length (${checkCount})`}`); + } + } + export interface TestSessionOptions extends server.SessionOptions { logger: Logger; } @@ -357,6 +392,7 @@ namespace ts.projectSystem { super(opts); this.logger = opts.logger; this.testhost = TestFSWithWatch.changeToHostTrackingWrittenFiles(this.host as TestServerHost); + patchHostTimeouts(this.testhost, this); } getProjectService() { @@ -408,29 +444,6 @@ namespace ts.projectSystem { this.hostDiff = this.testhost.snap(); this.testhost.writtenFiles.clear(); } - - checkTimeoutQueueLengthAndRun(expected: number) { - this.baselineHost(`Before checking timeout queue length (${expected}) and running`); - this.testhost.checkTimeoutQueueLengthAndRun(expected); - this.baselineHost(`After checking timeout queue length (${expected}) and running`); - } - - checkTimeoutQueueLength(expected: number) { - this.baselineHost(`Checking timeout queue length: ${expected}`); - this.testhost.checkTimeoutQueueLength(expected); - } - - runQueuedTimeoutCallbacks(timeoutId?: number) { - this.baselineHost(`Before running timeout callback${timeoutId === undefined ? "s" : timeoutId}`); - this.testhost.runQueuedTimeoutCallbacks(timeoutId); - this.baselineHost(`After running timeout callback${timeoutId === undefined ? "s" : timeoutId}`); - } - - runQueuedImmediateCallbacks(checkCount?: number) { - this.baselineHost(`Before running immediate callbacks${checkCount === undefined ? "" : ` and checking length (${checkCount})`}`); - this.testhost.runQueuedImmediateCallbacks(checkCount); - this.baselineHost(`Before running immediate callbacks${checkCount === undefined ? "" : ` and checking length (${checkCount})`}`); - } } export function createSession(host: server.ServerHost, opts: Partial = {}) { @@ -513,6 +526,7 @@ namespace ts.projectSystem { ...opts }); this.testhost = TestFSWithWatch.changeToHostTrackingWrittenFiles(this.host as TestServerHost); + patchHostTimeouts(this.testhost, this); this.baselineHost("Creating project service"); } @@ -528,29 +542,6 @@ namespace ts.projectSystem { this.hostDiff = this.testhost.snap(); this.testhost.writtenFiles.clear(); } - - checkTimeoutQueueLengthAndRun(expected: number) { - this.baselineHost(`Before checking timeout queue length (${expected}) and running`); - this.testhost.checkTimeoutQueueLengthAndRun(expected); - this.baselineHost(`After checking timeout queue length (${expected}) and running`); - } - - checkTimeoutQueueLength(expected: number) { - this.baselineHost(`Checking timeout queue length: ${expected}`); - this.testhost.checkTimeoutQueueLength(expected); - } - - runQueuedTimeoutCallbacks(timeoutId?: number) { - this.baselineHost(`Before running timeout callback${timeoutId === undefined ? "s" : timeoutId}`); - this.testhost.runQueuedTimeoutCallbacks(timeoutId); - this.baselineHost(`After running timeout callback${timeoutId === undefined ? "s" : timeoutId}`); - } - - runQueuedImmediateCallbacks(checkCount?: number) { - this.baselineHost(`Before running immediate callbacks${checkCount === undefined ? "" : ` and checking length (${checkCount})`}`); - this.testhost.runQueuedImmediateCallbacks(checkCount); - this.baselineHost(`Before running immediate callbacks${checkCount === undefined ? "" : ` and checking length (${checkCount})`}`); - } } export function createProjectService(host: TestServerHost, options?: Partial) { @@ -854,14 +845,14 @@ namespace ts.projectSystem { Debug.assert(session.logger.logs.length); for (let i = 0; i < files.length; i++) { if (existingTimeouts !== undefined) { - session.checkTimeoutQueueLength(existingTimeouts + 1); - session.runQueuedTimeoutCallbacks(host.getNextTimeoutId() - 1); + host.checkTimeoutQueueLength(existingTimeouts + 1); + host.runQueuedTimeoutCallbacks(host.getNextTimeoutId() - 1); } else { - session.checkTimeoutQueueLengthAndRun(1); + host.checkTimeoutQueueLengthAndRun(1); } - if (!skip?.[i]?.semantic) session.runQueuedImmediateCallbacks(1); - if (!skip?.[i]?.suggestion) session.runQueuedImmediateCallbacks(1); + if (!skip?.[i]?.semantic) host.runQueuedImmediateCallbacks(1); + if (!skip?.[i]?.suggestion) host.runQueuedImmediateCallbacks(1); } } diff --git a/src/testRunner/unittests/tsserver/moduleResolution.ts b/src/testRunner/unittests/tsserver/moduleResolution.ts index c83ea4db1238c..914de1b3a22d3 100644 --- a/src/testRunner/unittests/tsserver/moduleResolution.ts +++ b/src/testRunner/unittests/tsserver/moduleResolution.ts @@ -46,34 +46,34 @@ namespace ts.projectSystem { host.writeFile(packageFile.path, JSON.stringify({ name: "app", version: "1.0.0", type: "module", })); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); session.logger.info("Modify package json file to remove type module"); host.writeFile(packageFile.path, packageFile.content); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); session.logger.info("Delete package.json"); host.deleteFile(packageFile.path); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); session.logger.info("Modify package json file to add type module"); host.writeFile(packageFile.path, JSON.stringify({ name: "app", version: "1.0.0", type: "module", })); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); session.logger.info("Delete package.json"); host.deleteFile(packageFile.path); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); baselineTsserverLogs("moduleResolution", "package json file is edited", session); @@ -86,32 +86,32 @@ namespace ts.projectSystem { session.logger.info("Modify package json file to remove type module"); host.writeFile(packageFile.path, JSON.stringify({ name: "app", version: "1.0.0" })); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); session.logger.info("Modify package json file to add type module"); host.writeFile(packageFile.path, packageFile.content); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); session.logger.info("Delete package.json"); host.deleteFile(packageFile.path); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); session.logger.info("Modify package json file to without type module"); host.writeFile(packageFile.path, JSON.stringify({ name: "app", version: "1.0.0" })); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); session.logger.info("Delete package.json"); host.deleteFile(packageFile.path); - session.runQueuedTimeoutCallbacks(); // Failed lookup updates - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Failed lookup updates + host.runQueuedTimeoutCallbacks(); // Actual update verifyErr(); baselineTsserverLogs("moduleResolution", "package json file is edited when package json with type module exists", session); diff --git a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts index 8a9ff13178578..b9423ec98dd96 100644 --- a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts +++ b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts @@ -63,7 +63,7 @@ namespace ts.projectSystem { // Completion at an import statement will calculate and cache module specifiers triggerCompletions({ file: cTs.path, line: 1, offset: cTs.content.length + 1 }); host.writeFile("/node_modules/.staging/mobx-12345678/package.json", "{}"); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); assert.equal(moduleSpecifierCache.count(), 0); baselineTsserverLogs("moduleSpecifierCache", "invalidates module specifiers when changes happen in contained node_modules directories", session); }); diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index 2ddcf00cd4b26..750b968b6c0f8 100644 --- a/src/testRunner/unittests/tsserver/projectErrors.ts +++ b/src/testRunner/unittests/tsserver/projectErrors.ts @@ -289,8 +289,8 @@ namespace ts.projectSystem { verifyGetErrRequest({ session, host, files: [app] }); host.renameFolder(`${projectDir}/foo`, `${projectDir}/foo2`); - session.runQueuedTimeoutCallbacks(); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyGetErrRequest({ session, host, files: [app] }); baselineTsserverLogs("projectErrors", `folder rename updates project structure and reports no errors`, session); }); @@ -310,7 +310,7 @@ namespace ts.projectSystem { } }); - session.checkTimeoutQueueLengthAndRun(1); + host.checkTimeoutQueueLengthAndRun(1); baselineTsserverLogs("projectErrors", "getting errors before opening file", session); }); @@ -474,13 +474,13 @@ declare module '@custom/plugin' { } }`; host.writeFile(configFile.path, configFile.content); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); configFile.content = `{ "compilerOptions": {} }`; host.writeFile(configFile.path, configFile.content); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("projectErrors", "configFileDiagnostic events are generated when the config file changes", session); }); @@ -868,13 +868,13 @@ console.log(blabla);` function verifyWhileNpmInstall(timeouts: number) { filesAndFoldersToAdd.forEach(f => host.ensureFileOrFolder(f)); if (npmInstallComplete || timeoutDuringPartialInstallation) { - session.checkTimeoutQueueLengthAndRun(timeouts); // Invalidation of failed lookups + host.checkTimeoutQueueLengthAndRun(timeouts); // Invalidation of failed lookups if (timeouts) { - session.checkTimeoutQueueLengthAndRun(timeouts - 1); // Actual update + host.checkTimeoutQueueLengthAndRun(timeouts - 1); // Actual update } } else { - session.checkTimeoutQueueLength(timeouts ? 3 : 2); + host.checkTimeoutQueueLength(timeouts ? 3 : 2); } verifyGetErrRequest({ session, host, files: [main], existingTimeouts: !npmInstallComplete && !timeoutDuringPartialInstallation ? timeouts ? 3 : 2 : undefined }); } diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index dfed05abe3c22..694b279395294 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -1257,16 +1257,16 @@ bar;` // Add new class to referenced project const class3 = `${tscWatch.projectRoot}/projects/project1/class3.ts`; host.writeFile(class3, `class class3 {}`); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // Add excluded file to referenced project host.ensureFileOrFolder({ path: `${tscWatch.projectRoot}/projects/project1/temp/file.d.ts`, content: `declare class file {}` }); - session.checkTimeoutQueueLengthAndRun(0); + host.checkTimeoutQueueLengthAndRun(0); // Add output from new class to referenced project const class3Dts = `${tscWatch.projectRoot}/projects/project1/class3.d.ts`; host.writeFile(class3Dts, `declare class class3 {}`); - session.checkTimeoutQueueLengthAndRun(0); + host.checkTimeoutQueueLengthAndRun(0); baselineTsserverLogs("projectReferences", `new file is added to the referenced project when referenced project is not open`, session); }); @@ -1277,14 +1277,14 @@ bar;` // Add new class to referenced project const class3 = `${tscWatch.projectRoot}/projects/project1/class3.ts`; host.writeFile(class3, `class class3 {}`); - session.checkTimeoutQueueLengthAndRun(3); + host.checkTimeoutQueueLengthAndRun(3); // Add excluded file to referenced project host.ensureFileOrFolder({ path: `${tscWatch.projectRoot}/projects/project1/temp/file.d.ts`, content: `declare class file {}` }); - session.checkTimeoutQueueLengthAndRun(0); + host.checkTimeoutQueueLengthAndRun(0); // Add output from new class to referenced project const class3Dts = `${tscWatch.projectRoot}/projects/project1/class3.d.ts`; host.writeFile(class3Dts, `declare class class3 {}`); - session.checkTimeoutQueueLengthAndRun(0); + host.checkTimeoutQueueLengthAndRun(0); baselineTsserverLogs("projectReferences", `new file is added to the referenced project when referenced project is open`, session); }); @@ -1294,20 +1294,20 @@ bar;` // Add new class to referenced project const class3 = `${tscWatch.projectRoot}/projects/project1/class3.ts`; host.writeFile(class3, `class class3 {}`); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // Add output of new class to referenced project const class3Dts = `${tscWatch.projectRoot}/projects/project1/class3.d.ts`; host.writeFile(class3Dts, `declare class class3 {}`); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // Add excluded file to referenced project host.ensureFileOrFolder({ path: `${tscWatch.projectRoot}/projects/project1/temp/file.d.ts`, content: `declare class file {}` }); - session.checkTimeoutQueueLengthAndRun(0); + host.checkTimeoutQueueLengthAndRun(0); // Delete output from new class to referenced project host.deleteFile(class3Dts); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // Write back output of new class to referenced project host.writeFile(class3Dts, `declare class class3 {}`); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectReferences", `new file is added to the referenced project when referenced project is not open with disableSourceOfProjectReferenceRedirect`, session); }); @@ -1318,20 +1318,20 @@ bar;` // Add new class to referenced project const class3 = `${tscWatch.projectRoot}/projects/project1/class3.ts`; host.writeFile(class3, `class class3 {}`); - session.checkTimeoutQueueLengthAndRun(3); + host.checkTimeoutQueueLengthAndRun(3); // Add output of new class to referenced project const class3Dts = `${tscWatch.projectRoot}/projects/project1/class3.d.ts`; host.writeFile(class3Dts, `declare class class3 {}`); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // Add excluded file to referenced project host.ensureFileOrFolder({ path: `${tscWatch.projectRoot}/projects/project1/temp/file.d.ts`, content: `declare class file {}` }); - session.checkTimeoutQueueLengthAndRun(0); + host.checkTimeoutQueueLengthAndRun(0); // Delete output from new class to referenced project host.deleteFile(class3Dts); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // Write back output of new class to referenced project host.writeFile(class3Dts, `declare class class3 {}`); - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectReferences", `new file is added to the referenced project when referenced project is open with disableSourceOfProjectReferenceRedirect`, session); }); }); diff --git a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts index 3773d1fa8c314..d951b02058c2c 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -311,11 +311,11 @@ fn5(); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToMainTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -355,7 +355,7 @@ fn5(); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -395,7 +395,7 @@ fn5(); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -554,11 +554,11 @@ fn5(); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToMainTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -598,7 +598,7 @@ fn5(); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -638,7 +638,7 @@ fn5(); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -778,7 +778,7 @@ fn5(); // Make change, without rebuild of solution host.writeFile(dependencyTs.path, `function fooBar() { } ${dependencyTs.content}`); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -855,11 +855,11 @@ ${dependencyTs.content}`); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToMainTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -899,7 +899,7 @@ ${dependencyTs.content}`); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -939,7 +939,7 @@ ${dependencyTs.content}`); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1107,11 +1107,11 @@ ${dependencyTs.content}`); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToDependencyTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1151,7 +1151,7 @@ ${dependencyTs.content}`); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1191,7 +1191,7 @@ ${dependencyTs.content}`); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1350,11 +1350,11 @@ ${dependencyTs.content}`); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToDependencyTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1394,7 +1394,7 @@ ${dependencyTs.content}`); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1434,7 +1434,7 @@ ${dependencyTs.content}`); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1568,7 +1568,7 @@ ${dependencyTs.content}`); }); it(`when defining project source changes, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change // Make change, without rebuild of solution @@ -1578,7 +1578,7 @@ ${dependencyTs.content}`); file: dependencyTs.path, line: 1, offset: 1, endLine: 1, endOffset: 1, insertString: `function fooBar() { } `} }); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1659,11 +1659,11 @@ ${dependencyTs.content}`); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToDependencyTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1703,7 +1703,7 @@ ${dependencyTs.content}`); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1743,7 +1743,7 @@ ${dependencyTs.content}`); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1921,12 +1921,12 @@ ${dependencyTs.content}`); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToMainTs(session); makeChangeToDependencyTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -1983,7 +1983,7 @@ ${dependencyTs.content}`); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -2039,7 +2039,7 @@ ${dependencyTs.content}`); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -2274,12 +2274,12 @@ ${dependencyTs.content}`); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToMainTs(session); makeChangeToDependencyTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -2336,7 +2336,7 @@ ${dependencyTs.content}`); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -2392,7 +2392,7 @@ ${dependencyTs.content}`); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -2592,7 +2592,7 @@ ${dependencyTs.content}`); }); it(`when defining project source changes, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change // Make change, without rebuild of solution @@ -2602,7 +2602,7 @@ ${dependencyTs.content}`); file: dependencyTs.path, line: 1, offset: 1, endLine: 1, endOffset: 1, insertString: `function fooBar() { } `} }); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -2716,12 +2716,12 @@ ${dependencyTs.content}`); // Edit it(`when usage file changes, document position mapper doesnt change, when timeout occurs before request`, () => { // Create DocumentPositionMapper - const { session, dependencyMap, documentPositionMapper } = setupWithAction(); + const { host, session, dependencyMap, documentPositionMapper } = setupWithAction(); // change makeChangeToMainTs(session); makeChangeToDependencyTs(session); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -2778,7 +2778,7 @@ ${dependencyTs.content}`); // change changeDtsFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action @@ -2834,7 +2834,7 @@ ${dependencyTs.content}`); // change changeDtsMapFile(host); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); verifyDocumentPositionMapperEqual(session, dependencyMap, documentPositionMapper); // action diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index fb4f19ec0f034..84d09a3dbda25 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -19,7 +19,7 @@ namespace ts.projectSystem { session.executeCommand(getErrRequest); host.writeFile(commonFile2.path, commonFile2.content); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); session.executeCommand(getErrRequest); baselineTsserverLogs("projects", "handles the missing files added with tripleslash ref", session); }); @@ -1520,24 +1520,24 @@ namespace ts.projectSystem { openFile(fileB); openFile(fileSubA); - session.checkTimeoutQueueLengthAndRun(0); + host.checkTimeoutQueueLengthAndRun(0); // This should schedule 2 timeouts for ensuring project structure and ensuring projects for open file host.deleteFile(fileSubA.path); host.deleteFolder(getDirectoryPath(fileSubA.path)); host.writeFile(fileA.path, fileA.content); - session.checkTimeoutQueueLength(2); + host.checkTimeoutQueueLength(2); closeFilesForSession([fileSubA], session); // This should cancel existing updates and schedule new ones - session.checkTimeoutQueueLength(2); + host.checkTimeoutQueueLength(2); // Open the fileA (as if rename) // config project is updated to check if fileA is present in it openFile(fileA); // Run the timeout for updating configured project and ensuring projects for open file - session.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // file is deleted but watches are not yet invoked const originalFileExists = host.fileExists; @@ -1548,13 +1548,13 @@ namespace ts.projectSystem { // This should create inferred project since fileSubA not on the disk openFile(fileSubA); - session.checkTimeoutQueueLengthAndRun(2); // Update configured project and projects for open file + host.checkTimeoutQueueLengthAndRun(2); // Update configured project and projects for open file host.fileExists = originalFileExists; // Actually trigger the file move host.deleteFile(fileA.path); host.ensureFileOrFolder(fileSubA); - session.checkTimeoutQueueLength(2); + host.checkTimeoutQueueLength(2); verifyGetErrRequest({ session, host, files: [fileB, fileSubA], existingTimeouts: 2 }); baselineTsserverLogs("projects", "handles delayed directory watch invoke on file creation", session); diff --git a/src/testRunner/unittests/tsserver/projectsWithReferences.ts b/src/testRunner/unittests/tsserver/projectsWithReferences.ts index ffb977494cd4e..531745f2e9f93 100644 --- a/src/testRunner/unittests/tsserver/projectsWithReferences.ts +++ b/src/testRunner/unittests/tsserver/projectsWithReferences.ts @@ -16,18 +16,18 @@ namespace ts.projectSystem { // local edit in ts file host.appendFile(logicIndex.path, `function foo() {}`); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // non local edit in ts file host.appendFile(logicIndex.path, `export function gfoo() {}`); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // change in project reference config file host.writeFile(logicConfig.path, JSON.stringify({ compilerOptions: { composite: true, declaration: true, declarationDir: "decls" }, references: [{ path: "../core" }] })); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectsWithReferences", "sample project", service); }); @@ -89,7 +89,7 @@ export class A {}` // non local edit host.appendFile(bTs.path, `export function gFoo() { }`); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectsWithReferences", "transitive references with non local edit", service); }); @@ -103,11 +103,11 @@ export class A {}` host.ensureFileOrFolder(nRefsTs); cTsConfigJson.compilerOptions.paths = { "@ref/*": ["../nrefs/*"] }; host.writeFile(cConfig.path, JSON.stringify(cTsConfigJson)); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // revert the edit on config file host.writeFile(cConfig.path, cConfig.content); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectsWithReferences", "transitive references with edit on config file", service); }); @@ -121,33 +121,33 @@ export class A {}` host.ensureFileOrFolder(nRefsTs); bTsConfigJson.compilerOptions.paths = { "@ref/*": ["../nrefs/*"] }; host.writeFile(bConfig.path, JSON.stringify(bTsConfigJson)); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // revert the edit on config file host.writeFile(bConfig.path, bConfig.content); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectsWithReferences", "transitive references with edit in referenced config file", service); }); it("deleting referenced config file", () => { const { host, service, bConfig } = createService(); host.deleteFile(bConfig.path); - service.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation + host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation // revert host.writeFile(bConfig.path, bConfig.content); - service.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation + host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation baselineTsserverLogs("projectsWithReferences", "transitive references with deleting referenced config file", service); }); it("deleting transitively referenced config file", () => { const { host, service, aConfig } = createService(); host.deleteFile(aConfig.path); - service.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation + host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation // revert host.writeFile(aConfig.path, aConfig.content); - service.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation + host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation baselineTsserverLogs("projectsWithReferences", "transitive references with deleting transitively referenced config file", service); }); }); @@ -204,7 +204,7 @@ export class A {}` // non local edit host.appendFile(bTs.path, `export function gFoo() { }`); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectsWithReferences", "trasitive references without files with non local edit", service); }); @@ -218,11 +218,11 @@ export class A {}` host.ensureFileOrFolder(nRefsTs); cTsConfigJson.compilerOptions.paths = { "@ref/*": ["../nrefs/*"] }; host.writeFile(cConfig.path, JSON.stringify(cTsConfigJson)); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // revert the edit on config file host.writeFile(cConfig.path, cConfig.content); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectsWithReferences", "trasitive references without files with edit on config file", service); }); @@ -236,33 +236,33 @@ export class A {}` host.ensureFileOrFolder(nRefsTs); bTsConfigJson.compilerOptions.paths = { "@ref/*": ["../nrefs/*"] }; host.writeFile(bConfig.path, JSON.stringify(bTsConfigJson)); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); // revert the edit on config file host.writeFile(bConfig.path, bConfig.content); - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("projectsWithReferences", "trasitive references without files with edit in referenced config file", service); }); it("deleting referenced config file", () => { const { host, service, bConfig } = createService(); host.deleteFile(bConfig.path); - service.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation + host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation // revert host.writeFile(bConfig.path, bConfig.content); - service.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation + host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation baselineTsserverLogs("projectsWithReferences", "trasitive references without files with deleting referenced config file", service); }); it("deleting transitively referenced config file", () => { const { host, service, aConfig } = createService(); host.deleteFile(aConfig.path); - service.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation + host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation // revert host.writeFile(aConfig.path, aConfig.content); - service.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation + host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation baselineTsserverLogs("projectsWithReferences", "trasitive references without files with deleting transitively referenced config file", service); }); }); diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index 4141a3c1e3fb8..37b24702126ff 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -87,7 +87,7 @@ namespace ts.projectSystem { session.executeCommand(getErrRequest); host.writeFile(moduleFile.path, moduleFile.content); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); // Make a change to trigger the program rebuild const changeRequest = makeSessionRequest( @@ -126,10 +126,10 @@ namespace ts.projectSystem { content: "export = pad;declare function pad(length: number, text: string, char ?: string): string;" }; host.ensureFileOrFolder(padIndex, /*ignoreWatchInvokedWithTriggerAsFileCreate*/ true); - session.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions - session.runQueuedTimeoutCallbacks(); // Actual update - session.runQueuedTimeoutCallbacks(); - session.runQueuedImmediateCallbacks(); + host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions + host.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); + host.runQueuedImmediateCallbacks(); baselineTsserverLogs("resolutionCache", `npm install @types works`, session); }); @@ -210,7 +210,7 @@ namespace ts.projectSystem { } }); - session.checkTimeoutQueueLength(0); + host.checkTimeoutQueueLength(0); baselineTsserverLogs("resolutionCache", "suppressed diagnostic events", session); }); }); @@ -237,11 +237,11 @@ namespace ts.projectSystem { const moduleFileNewPath = "/a/b/moduleFile1.ts"; host.renameFile(moduleFile.path, moduleFileNewPath); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); session.executeCommand(getErrRequest); host.renameFile(moduleFileNewPath, moduleFile.path); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); // Make a change to trigger the program rebuild const changeRequest = makeSessionRequest( @@ -249,7 +249,7 @@ namespace ts.projectSystem { { file: file1.path, line: 1, offset: 44, endLine: 1, endOffset: 44, insertString: "\n" } ); session.executeCommand(changeRequest); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); session.executeCommand(getErrRequest); baselineTsserverLogs("resolutionCache", "renaming module should restore the states for inferred projects", session); @@ -280,11 +280,11 @@ namespace ts.projectSystem { const moduleFileNewPath = "/a/b/moduleFile1.ts"; host.renameFile(moduleFile.path, moduleFileNewPath); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); session.executeCommand(getErrRequest); host.renameFile(moduleFileNewPath, moduleFile.path); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); session.executeCommand(getErrRequest); baselineTsserverLogs("resolutionCache", "renaming module should restore the states for configured projects", session); }); @@ -377,7 +377,7 @@ namespace ts.projectSystem { host.writeFile(file1.path, file1.content + fileContent); host.writeFile(file2.path, file2.content + fileContent); - service.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("resolutionCache", "relative module name from files in same folder", service); }); @@ -393,7 +393,7 @@ namespace ts.projectSystem { host.writeFile(file1.path, file1.content + fileContent); host.writeFile(file2.path, file2.content + fileContent); - service.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("resolutionCache", "non relative module name from files in same folder", service); }); }); @@ -435,7 +435,7 @@ namespace ts.projectSystem { host.writeFile(file2.path, file2.content + fileContent2); host.writeFile(file3.path, file3.content + fileContent3); host.writeFile(file4.path, file4.content + fileContent4); - service.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("resolutionCache", "relative module name from files in different folders", service); }); @@ -452,7 +452,7 @@ namespace ts.projectSystem { host.writeFile(file2.path, file2.content + fileContent); host.writeFile(file3.path, file3.content + fileContent); host.writeFile(file4.path, file4.content + fileContent); - service.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("resolutionCache", "non relative module name from files in different folders", service); }); @@ -474,7 +474,7 @@ namespace ts.projectSystem { host.writeFile(file2.path, file2.content + importModuleContent); host.writeFile(file3.path, file3.content + importModuleContent); host.writeFile(file4.path, file4.content + importModuleContent); - service.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); baselineTsserverLogs("resolutionCache", "non relative module name from inferred project", service); }); }); @@ -595,7 +595,7 @@ export const x = 10;` // invoke callback to simulate saving host.modifyFile(file1.path, file1.content, { invokeFileDeleteCreateAsPartInsteadOfChange: true }); - service.checkTimeoutQueueLengthAndRun(0); + host.checkTimeoutQueueLengthAndRun(0); baselineTsserverLogs("resolutionCache", "avoid unnecessary lookup invalidation on save", service); }); }); diff --git a/src/testRunner/unittests/tsserver/symLinks.ts b/src/testRunner/unittests/tsserver/symLinks.ts index 578d3b14134da..1187d9420655a 100644 --- a/src/testRunner/unittests/tsserver/symLinks.ts +++ b/src/testRunner/unittests/tsserver/symLinks.ts @@ -127,8 +127,8 @@ new C();` host.ensureFileOrFolder(nodeModulesRecorgnizersText); host.writeFile(recongnizerTextDistTypingFile.path, recongnizerTextDistTypingFile.content); - session.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions + host.runQueuedTimeoutCallbacks(); // Actual update verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] }); @@ -138,8 +138,8 @@ new C();` ...config, compilerOptions: { ...config.compilerOptions, resolveJsonModule: true } })); - session.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions + host.runQueuedTimeoutCallbacks(); // Actual update baselineTsserverLogs("symLinks", `module resolution${withPathMapping ? " with path mapping" : ""} when project compiles from sources`, session); }); @@ -150,8 +150,8 @@ new C();` verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] }); host.writeFile(recongnizerTextDistTypingFile.path, recongnizerTextDistTypingFile.content); - session.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions + host.runQueuedTimeoutCallbacks(); // Actual update verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] }); baselineTsserverLogs("symLinks", `module resolution${withPathMapping ? " with path mapping" : ""} when project has node_modules setup but doesnt have modules in typings folder and then recompiles`, session); @@ -164,14 +164,14 @@ new C();` verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] }); host.deleteFolder(recognizersTextDist, /*recursive*/ true); - session.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions + host.runQueuedTimeoutCallbacks(); // Actual update verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] }); host.ensureFileOrFolder(recongnizerTextDistTypingFile); - session.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions - session.runQueuedTimeoutCallbacks(); // Actual update + host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions + host.runQueuedTimeoutCallbacks(); // Actual update verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] }); baselineTsserverLogs("symLinks", `module resolution${withPathMapping ? " with path mapping" : ""} when project recompiles after deleting generated folders`, session); diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index d6678083a1200..59ce0f973bfb9 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -138,7 +138,7 @@ namespace ts.projectSystem { projectService.openClientFile(file1.path); installer.installAll(/*expectedCount*/ 1); - projectService.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("typingsInstaller", "configured projects", projectService); }); @@ -1035,7 +1035,7 @@ namespace ts.projectSystem { installer.installAll(/*expectedCount*/ 1); - projectService.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("typingsInstaller", "configured projects discover from bower_components", projectService); }); @@ -1212,7 +1212,7 @@ namespace ts.projectSystem { for (const name of typeNames) { assert.isTrue(host.fileExists(typePath(name)), `typings for '${name}' should be created`); } - service.checkTimeoutQueueLengthAndRun(2); + host.checkTimeoutQueueLengthAndRun(2); baselineTsserverLogs("typingsInstaller", "redo resolutions pointing to js on typing install", service); }); diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 3fe442f4b98e0..787e10d686bc7 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -39,7 +39,7 @@ namespace ts.projectSystem { content: "" }; host.writeFile(file2.path, file2.content); - session.runQueuedTimeoutCallbacks(); + host.runQueuedTimeoutCallbacks(); session.executeCommandSeq({ command: protocol.CommandTypes.CompletionInfo, arguments: protocolFileLocationFromSubstring(index, '"', { index: 1 }) @@ -149,7 +149,7 @@ namespace ts.projectSystem { emacsIgnoredFileFromIgnoreDirectory ].forEach(ignoredEntity => { host.ensureFileOrFolder(ignoredEntity); - session.checkTimeoutQueueLength(0); + host.checkTimeoutQueueLength(0); }); baselineTsserverLogs("watchEnvironment", `recursive directory does not watch files starting with dot in node_modules`, session); diff --git a/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js b/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js index 61bedf4a6940a..8e7ab74cd7961 100644 --- a/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js +++ b/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js @@ -128,6 +128,24 @@ Info 26 [00:01:05.000] response: { "responseRequired": false } +Checking timeout queue length: 0 + +PolledWatches:: +/users/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/users/username/projects/myproject/tsconfig.json: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/users/username/projects/myproject/src: + {} +/users/username/projects/myproject/node_modules: + {} + Info 27 [00:01:06.000] request: { "command": "geterr", @@ -350,6 +368,24 @@ Info 34 [00:01:13.000] response: { "responseRequired": false } +Checking timeout queue length: 0 + +PolledWatches:: +/users/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/users/username/projects/myproject/tsconfig.json: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/users/username/projects/myproject/src: + {} +/users/username/projects/myproject/node_modules: + {} + Info 35 [00:01:14.000] request: { "command": "geterr", diff --git a/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-with-projectRoot.js b/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-with-projectRoot.js index 964a6f26a2983..a71907fef5bf3 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-with-projectRoot.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-with-projectRoot.js @@ -92,6 +92,22 @@ ScriptInfos: path: /user/someuser/projects/somefolder/untitled:untitled-1 fileName: untitled:Untitled-1 path: /a/lib/lib.d.ts fileName: /a/lib/lib.d.ts +Checking timeout queue length: 0 + +PolledWatches:: +/typings/@epic/core.d.ts: + {"pollingInterval":500} +/user/someuser/projects/somefolder/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/a/lib/lib.d.ts: + {} +/user/someuser/projects/somefolder/src/somefile.d.ts: + {} + +FsWatchesRecursive:: + Info 16 [00:00:47.000] request: { "command": "geterr", diff --git a/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-without-projectRoot.js b/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-without-projectRoot.js index 4d6a73c7f65c9..b92a3b15f2c29 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-without-projectRoot.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-opening-new-file-that-doesnt-exist-on-disk-yet-without-projectRoot.js @@ -87,6 +87,20 @@ ScriptInfos: path: /untitled:untitled-1 fileName: untitled:Untitled-1 path: /a/lib/lib.d.ts fileName: /a/lib/lib.d.ts +Checking timeout queue length: 0 + +PolledWatches:: +/typings/@epic/core.d.ts: + {"pollingInterval":500} + +FsWatches:: +/a/lib/lib.d.ts: + {} +/src/somefile.d.ts: + {} + +FsWatchesRecursive:: + Info 14 [00:00:45.000] request: { "command": "geterr", diff --git a/tests/baselines/reference/tsserver/projectUpdatedInBackground/with-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js b/tests/baselines/reference/tsserver/projectUpdatedInBackground/with-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js index ee76811aea637..2915b38e5002f 100644 --- a/tests/baselines/reference/tsserver/projectUpdatedInBackground/with-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js +++ b/tests/baselines/reference/tsserver/projectUpdatedInBackground/with-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js @@ -164,6 +164,24 @@ Info 36 [00:01:16.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/a/b/project/file1.ts"]}} After checking timeout queue length (2) and running +PolledWatches:: +/a/b/project/node_modules: + {"pollingInterval":500} + +FsWatches:: +/a/b/project/tsconfig.json: + {} +/a/b/project/file3.ts: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/a/b/project: + {} + +Checking timeout queue length: 0 + PolledWatches:: /a/b/project/node_modules: {"pollingInterval":500} diff --git a/tests/baselines/reference/tsserver/projectUpdatedInBackground/with-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js b/tests/baselines/reference/tsserver/projectUpdatedInBackground/with-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js index 4caf578af99b1..bff5ec79577dc 100644 --- a/tests/baselines/reference/tsserver/projectUpdatedInBackground/with-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js +++ b/tests/baselines/reference/tsserver/projectUpdatedInBackground/with-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js @@ -182,6 +182,30 @@ Info 42 [00:01:32.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/rootfolder/otherfolder/a/b/project/file1.ts"]}} After checking timeout queue length (2) and running +PolledWatches:: +/user/username/rootfolder/otherfolder/a/b/project/node_modules: + {"pollingInterval":500} +/user/username/rootfolder/otherfolder/a/b/node_modules: + {"pollingInterval":500} +/user/username/rootfolder/otherfolder/a/node_modules: + {"pollingInterval":500} +/user/username/rootfolder/otherfolder/node_modules: + {"pollingInterval":500} + +FsWatches:: +/user/username/rootfolder/otherfolder/a/b/project/tsconfig.json: + {} +/user/username/rootfolder/otherfolder/a/b/project/file3.ts: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/user/username/rootfolder/otherfolder/a/b/project: + {} + +Checking timeout queue length: 0 + PolledWatches:: /user/username/rootfolder/otherfolder/a/b/project/node_modules: {"pollingInterval":500} @@ -357,3 +381,23 @@ FsWatchesRecursive:: {} /user/username/rootfolder/otherfolder/a/b/node_modules: {} + +Checking timeout queue length: 0 + +PolledWatches:: +/user/username/rootfolder/otherfolder/a/b/project/node_modules: + {"pollingInterval":500} + +FsWatches:: +/user/username/rootfolder/otherfolder/a/b/project/tsconfig.json: + {} +/user/username/rootfolder/otherfolder/a/b/project/file3.ts: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/user/username/rootfolder/otherfolder/a/b/project: + {} +/user/username/rootfolder/otherfolder/a/b/node_modules: + {} diff --git a/tests/baselines/reference/tsserver/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js b/tests/baselines/reference/tsserver/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js index 82758f666df8d..b6f7b698c065e 100644 --- a/tests/baselines/reference/tsserver/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js +++ b/tests/baselines/reference/tsserver/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-at-root-level.js @@ -164,6 +164,24 @@ Info 36 [00:01:16.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/a/b/project/file1.ts"]}} After checking timeout queue length (2) and running +PolledWatches:: +/a/b/project/node_modules: + {"pollingInterval":500} + +FsWatches:: +/a/b/project/tsconfig.json: + {} +/a/b/project/file3.ts: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/a/b/project: + {} + +Checking timeout queue length: 1 + PolledWatches:: /a/b/project/node_modules: {"pollingInterval":500} diff --git a/tests/baselines/reference/tsserver/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js b/tests/baselines/reference/tsserver/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js index 2f7bebb4a2c74..d1e953227a820 100644 --- a/tests/baselines/reference/tsserver/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js +++ b/tests/baselines/reference/tsserver/projectUpdatedInBackground/without-noGetErrOnBackgroundUpdate-and-project-is-not-at-root-level.js @@ -182,6 +182,30 @@ Info 42 [00:01:32.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/rootfolder/otherfolder/a/b/project/file1.ts"]}} After checking timeout queue length (2) and running +PolledWatches:: +/user/username/rootfolder/otherfolder/a/b/project/node_modules: + {"pollingInterval":500} +/user/username/rootfolder/otherfolder/a/b/node_modules: + {"pollingInterval":500} +/user/username/rootfolder/otherfolder/a/node_modules: + {"pollingInterval":500} +/user/username/rootfolder/otherfolder/node_modules: + {"pollingInterval":500} + +FsWatches:: +/user/username/rootfolder/otherfolder/a/b/project/tsconfig.json: + {} +/user/username/rootfolder/otherfolder/a/b/project/file3.ts: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/user/username/rootfolder/otherfolder/a/b/project: + {} + +Checking timeout queue length: 1 + PolledWatches:: /user/username/rootfolder/otherfolder/a/b/project/node_modules: {"pollingInterval":500} @@ -348,3 +372,23 @@ FsWatchesRecursive:: {} /user/username/rootfolder/otherfolder/a/b/node_modules: {} + +Checking timeout queue length: 1 + +PolledWatches:: +/user/username/rootfolder/otherfolder/a/b/project/node_modules: + {"pollingInterval":500} + +FsWatches:: +/user/username/rootfolder/otherfolder/a/b/project/tsconfig.json: + {} +/user/username/rootfolder/otherfolder/a/b/project/file3.ts: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/user/username/rootfolder/otherfolder/a/b/project: + {} +/user/username/rootfolder/otherfolder/a/b/node_modules: + {} diff --git a/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js b/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js index 2798caf0f325d..ebbbaf5c9cce7 100644 --- a/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js +++ b/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js @@ -490,6 +490,22 @@ Info 61 [00:02:20.000] response: { "responseRequired": false } +Checking timeout queue length: 2 + +PolledWatches:: +/users/username/projects/project/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/users/username/projects/project/tsconfig.json: + {} +/a/lib/lib.d.ts: + {} + +FsWatchesRecursive:: +/users/username/projects/project: + {} + Info 62 [00:02:21.000] request: { "seq": 0, diff --git a/tests/baselines/reference/tsserver/resolutionCache/disable-suggestion-diagnostics.js b/tests/baselines/reference/tsserver/resolutionCache/disable-suggestion-diagnostics.js index a3c9f6d3d76b6..f813b576ec1bb 100644 --- a/tests/baselines/reference/tsserver/resolutionCache/disable-suggestion-diagnostics.js +++ b/tests/baselines/reference/tsserver/resolutionCache/disable-suggestion-diagnostics.js @@ -107,6 +107,20 @@ Info 16 [00:00:27.000] response: { "responseRequired": false } +Checking timeout queue length: 0 + +PolledWatches:: +/node_modules: + {"pollingInterval":500} +/a/lib/lib.d.ts: + {"pollingInterval":500} +/bower_components: + {"pollingInterval":500} + +FsWatches:: + +FsWatchesRecursive:: + Info 17 [00:00:28.000] request: { "command": "geterr", diff --git a/tests/baselines/reference/tsserver/resolutionCache/suggestion-diagnostics.js b/tests/baselines/reference/tsserver/resolutionCache/suggestion-diagnostics.js index e545976a8fb83..5699322473bb0 100644 --- a/tests/baselines/reference/tsserver/resolutionCache/suggestion-diagnostics.js +++ b/tests/baselines/reference/tsserver/resolutionCache/suggestion-diagnostics.js @@ -60,6 +60,20 @@ Info 11 [00:00:22.000] response: { "responseRequired": false } +Checking timeout queue length: 0 + +PolledWatches:: +/a/lib/lib.d.ts: + {"pollingInterval":500} +/bower_components: + {"pollingInterval":500} +/node_modules: + {"pollingInterval":500} + +FsWatches:: + +FsWatchesRecursive:: + Info 12 [00:00:23.000] request: { "command": "geterr", diff --git a/tests/baselines/reference/tsserver/resolutionCache/suppressed-diagnostic-events.js b/tests/baselines/reference/tsserver/resolutionCache/suppressed-diagnostic-events.js index 24e314a20227e..62a5dae776316 100644 --- a/tests/baselines/reference/tsserver/resolutionCache/suppressed-diagnostic-events.js +++ b/tests/baselines/reference/tsserver/resolutionCache/suppressed-diagnostic-events.js @@ -56,6 +56,16 @@ Info 11 [00:00:22.000] response: { "responseRequired": false } +Checking timeout queue length: 0 + +PolledWatches:: +/a/lib/lib.d.ts: + {"pollingInterval":500} + +FsWatches:: + +FsWatchesRecursive:: + Info 12 [00:00:23.000] request: { "command": "geterr", @@ -94,6 +104,16 @@ Info 14 [00:00:25.000] response: { "responseRequired": false } +Checking timeout queue length: 0 + +PolledWatches:: +/a/lib/lib.d.ts: + {"pollingInterval":500} + +FsWatches:: + +FsWatchesRecursive:: + Info 15 [00:00:26.000] request: { "command": "geterr",