Files
openclaw/src/config/home-env.test-harness.ts
2026-02-19 15:08:14 +00:00

15 lines
321 B
TypeScript

import { createTempHomeEnv } from "../test-utils/temp-home.js";
export async function withTempHome<T>(
prefix: string,
fn: (home: string) => Promise<T>,
): Promise<T> {
const tempHome = await createTempHomeEnv(prefix);
try {
return await fn(tempHome.home);
} finally {
await tempHome.restore();
}
}