From d0ad777cce0fa75ef65b6d013e2af8dbc086af81 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 1 Apr 2022 17:03:12 -0700 Subject: [PATCH] restore order of old code a bit --- src/harness/virtualFileSystemWithWatch.ts | 40 +++++++++++++---------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index 107a7890668..584a8ba6b21 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -1,16 +1,4 @@ namespace ts.TestFSWithWatch { - export const safeList = { - path: "/safeList.json" as Path, - content: JSON.stringify({ - commander: "commander", - express: "express", - jquery: "jquery", - lodash: "lodash", - moment: "moment", - chroma: "chroma-js" - }) - }; - export const libFile: File = { path: "/a/lib/lib.d.ts", content: `/// @@ -26,6 +14,18 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; }` }; + export const safeList = { + path: "/safeList.json" as Path, + content: JSON.stringify({ + commander: "commander", + express: "express", + jquery: "jquery", + lodash: "lodash", + moment: "moment", + chroma: "chroma-js" + }) + }; + function getExecutingFilePathFromLibFile(): string { return combinePaths(getDirectoryPath(libFile.path), "tsc.js"); } @@ -124,6 +124,7 @@ interface Array { length: number; [n: number]: T; }` export function checkWatchedFiles(host: TestServerHost, expectedFiles: readonly string[], additionalInfo?: string) { checkMap(`watchedFiles:: ${additionalInfo || ""}::`, host.watchedFiles, expectedFiles, /*eachKeyCount*/ undefined); } + export interface WatchFileDetails { fileName: string; pollingInterval: PollingInterval; @@ -232,7 +233,12 @@ interface Array { length: number; [n: number]: T; }` public withSafeList: boolean, fileOrFolderorSymLinkList: readonly FileOrFolderOrSymLink[], options: TestServerHostCreationParameters = {}) { - super(fileOrFolderorSymLinkList.concat(withSafeList ? safeList : []), { ...options, executingFilePath: options.executingFilePath || getExecutingFilePathFromLibFile() }); + super( + fileOrFolderorSymLinkList.concat(withSafeList ? safeList : []), + { + ...options, + executingFilePath: options.executingFilePath || getExecutingFilePathFromLibFile() + }); } runQueuedImmediateCallbacks(checkCount?: number) { if (checkCount !== undefined) { @@ -241,6 +247,10 @@ interface Array { length: number; [n: number]: T; }` super.runQueuedImmediateCallbacks(); } + clearScreen(): void { + this.screenClears.push(this.output.length); + } + checkTimeoutQueueLengthAndRun(expected: number) { this.checkTimeoutQueueLength(expected); this.runQueuedTimeoutCallbacks(); @@ -251,10 +261,6 @@ interface Array { length: number; [n: number]: T; }` assert.equal(callbacksCount, expected, `expected ${expected} timeout callbacks queued but found ${callbacksCount}.`); } - clearScreen(): void { - this.screenClears.push(this.output.length); - } - override write(message: string) { this.output.push(message); }