testkit: remove each test file's temp dir on teardown (runs had piled up ~1 GB)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0d130f76a0
commit
0194f7f6e4
@ -3,7 +3,7 @@
|
||||
// Import this before anything that pulls in @peppa/runner (statically or via @peppa/bot):
|
||||
// runner modules read PEPPA_TMUX_SOCKET / PEPPA_HOME when they load.
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { mkdirSync, mkdtempSync, readFileSync, existsSync, writeFileSync } from "node:fs";
|
||||
import { mkdirSync, mkdtempSync, readFileSync, existsSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@ -43,6 +43,9 @@ export async function teardown() {
|
||||
try {
|
||||
execFileSync("tmux", ["-L", process.env.PEPPA_TMUX_SOCKET!, "kill-server"], { stdio: "ignore" });
|
||||
} catch {}
|
||||
// Every run left its temp dir behind (~1 GB after a few hundred runs filled the disk);
|
||||
// PEPPA_KEEP_TEST_TMP=1 keeps it for debugging.
|
||||
if (!process.env.PEPPA_KEEP_TEST_TMP) rmSync(TMP, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
export async function waitFor<T>(label: string, fn: () => Promise<T | null | undefined | false>, timeoutMs = 25000): Promise<T> {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user