mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
resolveVitestNodeArgs,
|
|
resolveVitestSpawnParams,
|
|
shouldSuppressVitestStderrLine,
|
|
} from "../../scripts/run-vitest.mjs";
|
|
|
|
describe("scripts/run-vitest", () => {
|
|
it("adds --no-maglev to vitest child processes by default", () => {
|
|
expect(resolveVitestNodeArgs({ PATH: "/usr/bin" })).toEqual(["--no-maglev"]);
|
|
});
|
|
|
|
it("allows opting back into Maglev explicitly", () => {
|
|
expect(
|
|
resolveVitestNodeArgs({
|
|
OPENCLAW_VITEST_ENABLE_MAGLEV: "1",
|
|
PATH: "/usr/bin",
|
|
}),
|
|
).toEqual([]);
|
|
});
|
|
|
|
it("spawns vitest in a detached process group on Unix hosts", () => {
|
|
expect(resolveVitestSpawnParams({ PATH: "/usr/bin" }, "darwin")).toEqual({
|
|
env: { PATH: "/usr/bin" },
|
|
detached: true,
|
|
stdio: ["inherit", "pipe", "pipe"],
|
|
});
|
|
expect(resolveVitestSpawnParams({ PATH: "/usr/bin" }, "win32")).toEqual({
|
|
env: { PATH: "/usr/bin" },
|
|
detached: false,
|
|
stdio: ["inherit", "pipe", "pipe"],
|
|
});
|
|
});
|
|
|
|
it("suppresses rolldown plugin timing noise while keeping other stderr intact", () => {
|
|
expect(
|
|
shouldSuppressVitestStderrLine(
|
|
"\u001b[33m[PLUGIN_TIMINGS] Warning:\u001b[0m plugin `foo` was slow\n",
|
|
),
|
|
).toBe(true);
|
|
expect(shouldSuppressVitestStderrLine("real failure output\n")).toBe(false);
|
|
});
|
|
});
|