From 2cffbc4854e3b657d56d69e65b832e644c842413 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Mon, 6 Apr 2026 05:44:49 +0100 Subject: [PATCH] test(root): reuse temp dir helper in launcher e2e --- test/openclaw-launcher.e2e.test.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/openclaw-launcher.e2e.test.ts b/test/openclaw-launcher.e2e.test.ts index 53a6d14d8d4..6b573ad9c48 100644 --- a/test/openclaw-launcher.e2e.test.ts +++ b/test/openclaw-launcher.e2e.test.ts @@ -1,12 +1,11 @@ import { spawnSync } from "node:child_process"; import fs from "node:fs/promises"; -import os from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; +import { cleanupTempDirs, makeTempDir } from "./helpers/temp-dir.js"; async function makeLauncherFixture(fixtureRoots: string[]): Promise { - const fixtureRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-launcher-")); - fixtureRoots.push(fixtureRoot); + const fixtureRoot = makeTempDir(fixtureRoots, "openclaw-launcher-"); await fs.copyFile( path.resolve(process.cwd(), "openclaw.mjs"), path.join(fixtureRoot, "openclaw.mjs"), @@ -24,11 +23,7 @@ describe("openclaw launcher", () => { const fixtureRoots: string[] = []; afterEach(async () => { - await Promise.all( - fixtureRoots.splice(0).map(async (fixtureRoot) => { - await fs.rm(fixtureRoot, { recursive: true, force: true }); - }), - ); + cleanupTempDirs(fixtureRoots); }); it("surfaces transitive entry import failures instead of masking them as missing dist", async () => {