Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
217
test/scripts/test-report-utils.test.ts
Normal file
217
test/scripts/test-report-utils.test.ts
Normal file
@@ -0,0 +1,217 @@
|
||||
// Test Report Utils tests cover test report utils script behavior.
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
collectVitestAssertionDurations,
|
||||
collectVitestFileDurations,
|
||||
normalizeTrackedRepoPath,
|
||||
tryReadJsonFile,
|
||||
} from "../../scripts/test-report-utils.mjs";
|
||||
|
||||
const { spawnSyncMock } = vi.hoisted(() => ({
|
||||
spawnSyncMock: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("node:child_process", async () => {
|
||||
const actual = await vi.importActual<typeof import("node:child_process")>("node:child_process");
|
||||
return {
|
||||
...actual,
|
||||
spawnSync: spawnSyncMock,
|
||||
};
|
||||
});
|
||||
|
||||
describe("scripts/test-report-utils normalizeTrackedRepoPath", () => {
|
||||
it("normalizes repo-local absolute paths to repo-relative slash paths", () => {
|
||||
const absoluteFile = path.join(process.cwd(), "src", "tools", "example.test.ts");
|
||||
|
||||
expect(normalizeTrackedRepoPath(absoluteFile)).toBe("src/tools/example.test.ts");
|
||||
});
|
||||
|
||||
it("preserves external absolute paths as normalized absolute paths", () => {
|
||||
const externalFile = path.join(path.parse(process.cwd()).root, "tmp", "outside.test.ts");
|
||||
|
||||
expect(normalizeTrackedRepoPath(externalFile)).toBe(externalFile.split(path.sep).join("/"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("scripts/test-report-utils collectVitestFileDurations", () => {
|
||||
it("extracts per-file durations and applies file normalization", () => {
|
||||
const report = {
|
||||
testResults: [
|
||||
{
|
||||
name: path.join(process.cwd(), "src", "alpha.test.ts"),
|
||||
startTime: 100,
|
||||
endTime: 460,
|
||||
assertionResults: [{}, {}],
|
||||
},
|
||||
{
|
||||
name: "src/zero.test.ts",
|
||||
startTime: 300,
|
||||
endTime: 300,
|
||||
assertionResults: [{}],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
expect(collectVitestFileDurations(report, normalizeTrackedRepoPath)).toEqual([
|
||||
{
|
||||
file: "src/alpha.test.ts",
|
||||
durationMs: 360,
|
||||
testCount: 2,
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("scripts/test-report-utils collectVitestAssertionDurations", () => {
|
||||
it("extracts per-test durations with normalized files", () => {
|
||||
const report = {
|
||||
testResults: [
|
||||
{
|
||||
name: path.join(process.cwd(), "src", "alpha.test.ts"),
|
||||
assertionResults: [
|
||||
{ duration: 25, fullName: "alpha fast", status: "passed" },
|
||||
{ duration: 0, fullName: "alpha zero", status: "passed" },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
expect(collectVitestAssertionDurations(report, normalizeTrackedRepoPath)).toEqual([
|
||||
{
|
||||
file: "src/alpha.test.ts",
|
||||
durationMs: 25,
|
||||
fullName: "alpha fast",
|
||||
status: "passed",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("scripts/test-report-utils tryReadJsonFile", () => {
|
||||
it("returns the fallback when the file is missing", () => {
|
||||
const missingPath = path.join(os.tmpdir(), `openclaw-missing-${Date.now()}.json`);
|
||||
|
||||
expect(tryReadJsonFile(missingPath, { ok: true })).toEqual({ ok: true });
|
||||
});
|
||||
|
||||
it("reads valid JSON files", () => {
|
||||
const tempPath = path.join(os.tmpdir(), `openclaw-json-${Date.now()}.json`);
|
||||
fs.writeFileSync(tempPath, JSON.stringify({ ok: true }));
|
||||
|
||||
try {
|
||||
expect(tryReadJsonFile(tempPath, null)).toEqual({ ok: true });
|
||||
} finally {
|
||||
fs.unlinkSync(tempPath);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("scripts/test-report-utils runVitestJsonReport", () => {
|
||||
beforeEach(() => {
|
||||
vi.resetModules();
|
||||
spawnSyncMock.mockReset();
|
||||
});
|
||||
|
||||
it("launches Vitest through pnpm exec", async () => {
|
||||
const { runVitestJsonReport } = await import("../../scripts/test-report-utils.mjs");
|
||||
const reportPath = path.join(os.tmpdir(), `openclaw-vitest-json-${Date.now()}.json`);
|
||||
spawnSyncMock.mockImplementation(() => {
|
||||
fs.writeFileSync(reportPath, `${JSON.stringify({ testResults: [] })}\n`, "utf8");
|
||||
return { status: 0 };
|
||||
});
|
||||
|
||||
try {
|
||||
expect(
|
||||
runVitestJsonReport({
|
||||
config: "test/vitest/vitest.unit.config.ts",
|
||||
reportPath,
|
||||
}),
|
||||
).toBe(reportPath);
|
||||
} finally {
|
||||
fs.rmSync(reportPath, { force: true });
|
||||
}
|
||||
|
||||
expect(spawnSyncMock).toHaveBeenCalledWith(
|
||||
"pnpm",
|
||||
[
|
||||
"exec",
|
||||
"vitest",
|
||||
"run",
|
||||
"--config",
|
||||
"test/vitest/vitest.unit.config.ts",
|
||||
"--reporter=json",
|
||||
"--outputFile",
|
||||
reportPath,
|
||||
],
|
||||
{
|
||||
stdio: "inherit",
|
||||
env: process.env,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it("uses distinct default report paths when invocations share a clock tick", async () => {
|
||||
const { runVitestJsonReport } = await import("../../scripts/test-report-utils.mjs");
|
||||
const reportPaths: string[] = [];
|
||||
const nowSpy = vi.spyOn(Date, "now").mockReturnValue(1234567890);
|
||||
spawnSyncMock.mockImplementation((_command: string, args: string[]) => {
|
||||
const outputFileIndex = args.indexOf("--outputFile") + 1;
|
||||
const outputFile = args[outputFileIndex];
|
||||
reportPaths.push(outputFile);
|
||||
fs.writeFileSync(outputFile, `${JSON.stringify({ testResults: [] })}\n`, "utf8");
|
||||
return { status: 0 };
|
||||
});
|
||||
|
||||
try {
|
||||
runVitestJsonReport({
|
||||
config: "test/vitest/vitest.unit.config.ts",
|
||||
});
|
||||
runVitestJsonReport({
|
||||
config: "test/vitest/vitest.unit.config.ts",
|
||||
});
|
||||
|
||||
expect(reportPaths).toHaveLength(2);
|
||||
expect(reportPaths[0]).not.toBe(reportPaths[1]);
|
||||
for (const reportPath of reportPaths) {
|
||||
expect(path.dirname(reportPath)).toBe(os.tmpdir());
|
||||
expect(path.basename(reportPath)).toMatch(
|
||||
/^openclaw-vitest-report-\d+-1234567890-[0-9a-f-]+\.json$/u,
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
nowSpy.mockRestore();
|
||||
for (const reportPath of reportPaths) {
|
||||
fs.rmSync(reportPath, { force: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("fails when Vitest exits successfully without writing a JSON report", async () => {
|
||||
const { runVitestJsonReport } = await import("../../scripts/test-report-utils.mjs");
|
||||
spawnSyncMock.mockReturnValue({ status: 0 });
|
||||
const reportPath = path.join(os.tmpdir(), `openclaw-vitest-json-missing-${Date.now()}.json`);
|
||||
const exitSpy = vi.spyOn(process, "exit").mockImplementation((code) => {
|
||||
throw new Error(`process.exit ${String(code)}`);
|
||||
});
|
||||
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
|
||||
try {
|
||||
expect(() =>
|
||||
runVitestJsonReport({
|
||||
config: "test/vitest/vitest.unit.config.ts",
|
||||
reportPath,
|
||||
}),
|
||||
).toThrow("process.exit 1");
|
||||
expect(errorSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining("[test-report-utils] missing Vitest JSON report:"),
|
||||
);
|
||||
} finally {
|
||||
exitSpy.mockRestore();
|
||||
errorSpy.mockRestore();
|
||||
fs.rmSync(reportPath, { force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user