mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-22 07:48:38 +00:00
refactor(browser): dedupe control-server test harness
This commit is contained in:
18
src/browser/chrome-user-data-dir.test-harness.ts
Normal file
18
src/browser/chrome-user-data-dir.test-harness.ts
Normal 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 });
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user