test(scripts): clean session log temp roots

This commit is contained in:
Vincent Koc
2026-06-01 16:00:36 +02:00
parent eaeccf5fdf
commit 9e58ef1c82

View File

@@ -1,17 +1,27 @@
import { mkdtempSync, rmSync } from "node:fs";
import fs from "node:fs/promises";
import path from "node:path";
import { tmpdir } from "node:os";
import { mkdtempSync } from "node:fs";
import { describe, expect, it } from "vitest";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import {
countSessionLogMentions,
readSessionLogMentionLimits,
} from "../../scripts/e2e/lib/session-log-mentions.ts";
const tempRoots: string[] = [];
function makeTempRoot() {
return mkdtempSync(path.join(tmpdir(), "openclaw-session-log-mentions-"));
const root = mkdtempSync(path.join(tmpdir(), "openclaw-session-log-mentions-"));
tempRoots.push(root);
return root;
}
afterEach(() => {
for (const root of tempRoots.splice(0)) {
rmSync(root, { force: true, recursive: true });
}
});
describe("session log mention scanner", () => {
it("counts mentions across bounded session logs", async () => {
const root = makeTempRoot();