mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 05:20:44 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
67
openclaw/test/scripts/run-vitest-profile.test.ts
Normal file
67
openclaw/test/scripts/run-vitest-profile.test.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
buildVitestProfileCommand,
|
||||
parseArgs,
|
||||
resolveVitestProfileDir,
|
||||
} from "../../scripts/run-vitest-profile.mjs";
|
||||
import { createScriptTestHarness } from "./test-helpers.js";
|
||||
|
||||
describe("scripts/run-vitest-profile", () => {
|
||||
const { trackTempDir } = createScriptTestHarness();
|
||||
|
||||
it("defaults profile output outside the repo", () => {
|
||||
const outputDir = trackTempDir(resolveVitestProfileDir({ mode: "main", outputDir: "" }));
|
||||
|
||||
expect(outputDir.startsWith(os.tmpdir())).toBe(true);
|
||||
expect(outputDir.startsWith(process.cwd())).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps explicit output directories", () => {
|
||||
expect(
|
||||
resolveVitestProfileDir({ mode: "runner", outputDir: ".artifacts/custom-profile" }),
|
||||
).toBe(path.resolve(".artifacts/custom-profile"));
|
||||
});
|
||||
|
||||
it("builds main-thread cpu profiling args", () => {
|
||||
expect(buildVitestProfileCommand({ mode: "main", outputDir: "/tmp/profile-main" })).toEqual({
|
||||
command: process.execPath,
|
||||
args: [
|
||||
"--cpu-prof",
|
||||
"--cpu-prof-dir=/tmp/profile-main",
|
||||
"./node_modules/vitest/vitest.mjs",
|
||||
"run",
|
||||
"--config",
|
||||
"test/vitest/vitest.unit.config.ts",
|
||||
"--no-file-parallelism",
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("builds runner cpu and heap profiling args", () => {
|
||||
expect(buildVitestProfileCommand({ mode: "runner", outputDir: "/tmp/profile-runner" })).toEqual(
|
||||
{
|
||||
command: "pnpm",
|
||||
args: [
|
||||
"vitest",
|
||||
"run",
|
||||
"--config",
|
||||
"test/vitest/vitest.unit.config.ts",
|
||||
"--no-file-parallelism",
|
||||
"--execArgv=--cpu-prof",
|
||||
"--execArgv=--cpu-prof-dir=/tmp/profile-runner",
|
||||
"--execArgv=--heap-prof",
|
||||
"--execArgv=--heap-prof-dir=/tmp/profile-runner",
|
||||
],
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it("parses mode and explicit output dir", () => {
|
||||
expect(parseArgs(["runner", "--output-dir", "/tmp/out"])).toEqual({
|
||||
mode: "runner",
|
||||
outputDir: "/tmp/out",
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue