diff --git a/extensions/vscode/e2e/TestUtils.ts b/extensions/vscode/e2e/TestUtils.ts index c6dd6676b..3c27e3621 100644 --- a/extensions/vscode/e2e/TestUtils.ts +++ b/extensions/vscode/e2e/TestUtils.ts @@ -1,8 +1,9 @@ import { expect } from "chai"; import { Key } from "vscode-extension-tester"; +import { access, constants } from 'fs/promises'; +import * as path from "path"; import { DEFAULT_TIMEOUT } from "./constants"; -import path = require("path"); export class TestUtils { public static CONTINUE_GLOBAL_DIR = process.env.CONTINUE_GLOBAL_DIR ?? ""; @@ -11,6 +12,15 @@ export class TestUtils { return path.join(TestUtils.CONTINUE_GLOBAL_DIR, "index", "globalContext.json"); } + public static async fileExists(path: string): Promise { + try { + await access(path, constants.F_OK); + return true; + } catch { + return false; + } + } + /** * In many cases it might be more useful to use existing Selenium * utilities. For example: