refactor(browser): dedupe control-server test harness

This commit is contained in:
Peter Steinberger
2026-02-22 17:54:12 +00:00
parent 79ec29b150
commit 78220db2be
4 changed files with 74 additions and 98 deletions

View File

@@ -0,0 +1,18 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterAll, beforeAll } from "vitest";
type ChromeUserDataDirRef = {
dir: string;
};
export function installChromeUserDataDirHooks(chromeUserDataDir: ChromeUserDataDirRef): void {
beforeAll(async () => {
chromeUserDataDir.dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-chrome-user-data-"));
});
afterAll(async () => {
await fs.rm(chromeUserDataDir.dir, { recursive: true, force: true });
});
}