From aa1a496e837ee446e2b7988eafdb81dc9f11490d Mon Sep 17 00:00:00 2001 From: "vercel-gh-bot-5[bot]" <312521305+vercel-gh-bot-5[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 12:19:55 +0000 Subject: [PATCH] refactor(eve): share temporary directory cleanup in test helpers Co-authored-by: ruiconti <1834568+ruiconti@users.noreply.github.com> --- .../testing/use-temporary-app-roots.ts | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/packages/eve/src/internal/testing/use-temporary-app-roots.ts b/packages/eve/src/internal/testing/use-temporary-app-roots.ts index c52f9b1cb0..46e8b3e742 100644 --- a/packages/eve/src/internal/testing/use-temporary-app-roots.ts +++ b/packages/eve/src/internal/testing/use-temporary-app-roots.ts @@ -41,28 +41,12 @@ export function useTemporaryAppRoots(): ( prefix: string, options?: CreateTemporaryAppRootOptions, ) => Promise { - const temporaryRoots: string[] = []; - - afterEach(async () => { - await Promise.all( - temporaryRoots.splice(0).map(async (directoryPath) => { - try { - await rm(directoryPath, { - force: true, - recursive: true, - }); - } catch { - // Best-effort cleanup; a leaked tmpdir must not fail the run. - } - }), - ); - }); + const createTemporaryDirectory = useTemporaryDirectories(); return async (prefix, options = {}) => { - const appRoot = await mkdtemp(join(tmpdir(), prefix)); + const appRoot = await createTemporaryDirectory(prefix); const agentRoot = join(appRoot, "agent"); - temporaryRoots.push(appRoot); await mkdir(agentRoot, { recursive: true, }); @@ -110,7 +94,7 @@ export function useTemporaryDirectories(): (prefix: string) => Promise { recursive: true, }); } catch { - // Best-effort cleanup. + // A leaked temporary directory must not fail the test. } }), );