test(plugins): reuse tracked temp helpers in loader fixture tests

This commit is contained in:
Vincent Koc
2026-04-06 05:52:27 +01:00
parent ddea9a6c01
commit 17d7483404
2 changed files with 10 additions and 19 deletions

View File

@@ -1,27 +1,14 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterAll, describe, expect, it } from "vitest";
import { cleanupTrackedTempDirs, makeTrackedTempDir } from "./test-helpers/fs-fixtures.js";
function mkdtempSafe(prefix: string) {
const dir = fs.mkdtempSync(prefix);
try {
fs.chmodSync(dir, 0o755);
} catch {
// Best-effort
}
return dir;
}
const fixtureRoot = mkdtempSafe(path.join(os.tmpdir(), "openclaw-plugin-graceful-"));
const fixtureTempDirs: string[] = [];
const fixtureRoot = makeTrackedTempDir("openclaw-plugin-graceful", fixtureTempDirs);
let tempDirIndex = 0;
afterAll(() => {
try {
fs.rmSync(fixtureRoot, { recursive: true, force: true });
} catch {
// Ignore cleanup errors
}
cleanupTrackedTempDirs(fixtureTempDirs);
});
function makeTempDir() {