From 092bfaaff4f22c1621245da704161c67182b7ed2 Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 18 Feb 2022 21:15:16 +0000 Subject: [PATCH] Rename dir to workspaceDir --- test/e2e/codeServer.test.ts | 4 ++-- test/e2e/models/CodeServer.ts | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/test/e2e/codeServer.test.ts b/test/e2e/codeServer.test.ts index 349e106f..1f712f91 100644 --- a/test/e2e/codeServer.test.ts +++ b/test/e2e/codeServer.test.ts @@ -28,14 +28,14 @@ describe("CodeServer", true, [], () => { }) test("should open a file", async ({ codeServerPage }) => { - const dir = await codeServerPage.dir() + const dir = await codeServerPage.workspaceDir const file = path.join(dir, "foo") await fs.writeFile(file, "bar") await codeServerPage.openFile(file) }) test("should not share state with other paths", async ({ codeServerPage }) => { - const dir = await codeServerPage.dir() + const dir = await codeServerPage.workspaceDir const file = path.join(dir, "foo") await fs.writeFile(file, "bar") diff --git a/test/e2e/models/CodeServer.ts b/test/e2e/models/CodeServer.ts index 34a9d34b..e8fff071 100644 --- a/test/e2e/models/CodeServer.ts +++ b/test/e2e/models/CodeServer.ts @@ -37,7 +37,7 @@ export class CodeServer { private process: Promise | undefined public readonly logger: Logger private closed = false - private workspaceDir: Promise | undefined + private _workspaceDir: Promise | undefined constructor(name: string, private readonly codeServerArgs: string[]) { this.logger = logger.named(name) @@ -55,18 +55,21 @@ export class CodeServer { return address } - async dir(): Promise { - if (!this.workspaceDir) { - this.workspaceDir = tmpdir(workspaceDir) + /** + * The workspace directory code-server opens with. + */ + get workspaceDir(): Promise { + if (!this._workspaceDir) { + this._workspaceDir = tmpdir(workspaceDir) } - return this.workspaceDir + return this._workspaceDir } /** * Create a random workspace and seed it with settings. */ private async createWorkspace(): Promise { - const dir = await this.dir() + const dir = await this.workspaceDir await fs.mkdir(path.join(dir, "User")) await fs.writeFile( path.join(dir, "User/settings.json"), @@ -198,8 +201,11 @@ export class CodeServerPage { return this.codeServer.address() } - dir() { - return this.codeServer.dir() + /** + * The workspace directory code-server opens with. + */ + get workspaceDir() { + return this.codeServer.workspaceDir } /**