mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-05 22:42:53 +00:00
test(scripts): clean session log temp roots
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user