mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-04 12:43:33 +00:00
Summary: - The branch adds `useAutoCleanupTempDirTracker()`, broadens the temp-dir warning reporter to flag new manual helper imports/usages, updates docs, and migrates two script tests to the new helper. - PR surface: Tests +301, Docs +1, Other +248. Total +550 across 8 files. - Reproducibility: not applicable. this is test/tooling cleanup, and the changed behavior is exercised through helper/reporter tests and CI evidence rather than a user reproduction path. Automerge notes: - PR branch already contained follow-up commit before automerge: test: harden temp dir helper guard - PR branch already contained follow-up commit before automerge: test: clarify auto cleanup temp dir helper name - PR branch already contained follow-up commit before automerge: test: cover existing mkdtemp temp dir forms - PR branch already contained follow-up commit before automerge: test: read staged temp helper source from index Validation: - ClawSweeper review passed for head1fdd7d2a9a. - Required merge gates passed before the squash merge. Prepared head SHA:1fdd7d2a9aReview: https://github.com/openclaw/openclaw/pull/93209#issuecomment-4705653665 Co-authored-by: Mason Huang <masonxhuang@tencent.com> Approved-by: hxy91819
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
// Parallels Package Log Progress Extract tests cover parallels package log progress extract script behavior.
|
|
import { spawnSync } from "node:child_process";
|
|
import { writeFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js";
|
|
|
|
const SCRIPT_PATH = "scripts/e2e/lib/parallels-package/log-progress-extract.mjs";
|
|
const tempRoots = useAutoCleanupTempDirTracker();
|
|
|
|
function makeTempRoot(): string {
|
|
return tempRoots.make("openclaw-parallels-progress-");
|
|
}
|
|
|
|
function runExtract(logPath?: string) {
|
|
return spawnSync(process.execPath, [SCRIPT_PATH, ...(logPath ? [logPath] : [])], {
|
|
encoding: "utf8",
|
|
});
|
|
}
|
|
|
|
describe("parallels package log progress extractor", () => {
|
|
it("prints a blank status when the log is absent", () => {
|
|
const result = runExtract(path.join(makeTempRoot(), "missing.log"));
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toBe("\n");
|
|
});
|
|
|
|
it("extracts the latest progress line from recent log output", () => {
|
|
const logPath = path.join(makeTempRoot(), "phase.log");
|
|
writeFileSync(logPath, "==> Build package\nwarn: transient\n==> Copy artifact\n");
|
|
|
|
const result = runExtract(logPath);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toBe("Copy artifact\n");
|
|
});
|
|
|
|
it("does not let stale progress hide recent warnings in long logs", () => {
|
|
const logPath = path.join(makeTempRoot(), "phase.log");
|
|
writeFileSync(
|
|
logPath,
|
|
`==> Stale build step\n${"ordinary output\n".repeat(24 * 1024)}warn: recent package issue\n`,
|
|
);
|
|
|
|
const result = runExtract(logPath);
|
|
|
|
expect(result.status).toBe(0);
|
|
expect(result.stdout).toBe("warn: recent package issue\n");
|
|
});
|
|
});
|