mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 11:14:46 +00:00
test(commands): skip temp home cleanup in agent suite
This commit is contained in:
@@ -234,7 +234,11 @@ vi.mock("../config/sessions/transcript-resolve.runtime.js", () => {
|
||||
const runtime = createThrowingTestRuntime();
|
||||
|
||||
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
|
||||
return withTempHomeBase(fn, { prefix: "openclaw-agent-", skipSessionCleanup: true });
|
||||
return withTempHomeBase(fn, {
|
||||
prefix: "openclaw-agent-",
|
||||
skipHomeCleanup: true,
|
||||
skipSessionCleanup: true,
|
||||
});
|
||||
}
|
||||
|
||||
function mockConfig(
|
||||
|
||||
@@ -104,6 +104,7 @@ export async function withTempHome<T>(
|
||||
opts: {
|
||||
env?: Record<string, EnvValue>;
|
||||
prefix?: string;
|
||||
skipHomeCleanup?: boolean;
|
||||
skipSessionCleanup?: boolean;
|
||||
} = {},
|
||||
): Promise<T> {
|
||||
@@ -139,22 +140,24 @@ export async function withTempHome<T>(
|
||||
}
|
||||
restoreExtraEnv(envSnapshot);
|
||||
restoreEnv(snapshot);
|
||||
try {
|
||||
if (process.platform === "win32") {
|
||||
await fs.rm(base, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 50,
|
||||
});
|
||||
} else {
|
||||
await fs.rm(base, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
if (!opts.skipHomeCleanup) {
|
||||
try {
|
||||
if (process.platform === "win32") {
|
||||
await fs.rm(base, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 50,
|
||||
});
|
||||
} else {
|
||||
await fs.rm(base, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// ignore cleanup failures in tests
|
||||
}
|
||||
} catch {
|
||||
// ignore cleanup failures in tests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user