mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 22:10:21 +00:00
test: speed up vitest launcher startup
This commit is contained in:
@@ -22,6 +22,28 @@ describe("resolvePnpmRunner", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("prepends node args when launching pnpm through node", () => {
|
||||
expect(
|
||||
resolvePnpmRunner({
|
||||
npmExecPath: "/home/test/.cache/node/corepack/v1/pnpm/10.32.1/bin/pnpm.cjs",
|
||||
nodeArgs: ["--no-maglev"],
|
||||
nodeExecPath: "/usr/local/bin/node",
|
||||
pnpmArgs: ["exec", "vitest", "run"],
|
||||
platform: "linux",
|
||||
}),
|
||||
).toEqual({
|
||||
command: "/usr/local/bin/node",
|
||||
args: [
|
||||
"--no-maglev",
|
||||
"/home/test/.cache/node/corepack/v1/pnpm/10.32.1/bin/pnpm.cjs",
|
||||
"exec",
|
||||
"vitest",
|
||||
"run",
|
||||
],
|
||||
shell: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back to bare pnpm on non-Windows when npm_execpath is missing", () => {
|
||||
expect(
|
||||
resolvePnpmRunner({
|
||||
|
||||
17
test/scripts/run-vitest.test.ts
Normal file
17
test/scripts/run-vitest.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveVitestNodeArgs } 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([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user