From 0194f7f6e4cc30b6fc86a2ebdf978ea7c9219653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=81=D0=B5=D0=BB=D1=8C?= Date: Sat, 14 Nov 2026 01:25:16 +0500 Subject: [PATCH] testkit: remove each test file's temp dir on teardown (runs had piled up ~1 GB) Co-Authored-By: Claude Opus 5.5 --- packages/testkit/test/helpers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/testkit/test/helpers.ts b/packages/testkit/test/helpers.ts index f61e4ad4..547ae835 100644 --- a/packages/testkit/test/helpers.ts +++ b/packages/testkit/test/helpers.ts @@ -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(label: string, fn: () => Promise, timeoutMs = 25000): Promise {