mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 17:51:22 +00:00
73 lines
2.2 KiB
TypeScript
73 lines
2.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { BUILD_ALL_STEPS, resolveBuildAllStep } from "../../scripts/build-all.mjs";
|
|
|
|
describe("resolveBuildAllStep", () => {
|
|
it("routes pnpm steps through the npm_execpath pnpm runner on Windows", () => {
|
|
const step = BUILD_ALL_STEPS.find((entry) => entry.label === "canvas:a2ui:bundle");
|
|
expect(step).toBeTruthy();
|
|
|
|
const result = resolveBuildAllStep(step, {
|
|
platform: "win32",
|
|
nodeExecPath: "C:\\Program Files\\nodejs\\node.exe",
|
|
npmExecPath: "C:/Users/test/AppData/Local/pnpm/10.32.1/bin/pnpm.cjs",
|
|
env: {},
|
|
});
|
|
|
|
expect(result).toEqual({
|
|
command: "C:\\Program Files\\nodejs\\node.exe",
|
|
args: ["C:/Users/test/AppData/Local/pnpm/10.32.1/bin/pnpm.cjs", "canvas:a2ui:bundle"],
|
|
options: {
|
|
stdio: "inherit",
|
|
env: {},
|
|
shell: false,
|
|
windowsVerbatimArguments: undefined,
|
|
},
|
|
});
|
|
});
|
|
|
|
it("keeps node steps on the current node binary", () => {
|
|
const step = BUILD_ALL_STEPS.find((entry) => entry.label === "runtime-postbuild");
|
|
expect(step).toBeTruthy();
|
|
|
|
const result = resolveBuildAllStep(step, {
|
|
nodeExecPath: "/custom/node",
|
|
env: { FOO: "bar" },
|
|
});
|
|
|
|
expect(result).toEqual({
|
|
command: "/custom/node",
|
|
args: ["scripts/runtime-postbuild.mjs"],
|
|
options: {
|
|
stdio: "inherit",
|
|
env: { FOO: "bar" },
|
|
},
|
|
});
|
|
});
|
|
|
|
it("adds heap headroom for plugin-sdk dts on Windows", () => {
|
|
const step = BUILD_ALL_STEPS.find((entry) => entry.label === "build:plugin-sdk:dts");
|
|
expect(step).toBeTruthy();
|
|
|
|
const result = resolveBuildAllStep(step, {
|
|
platform: "win32",
|
|
nodeExecPath: "C:\\Program Files\\nodejs\\node.exe",
|
|
npmExecPath: "C:/Users/test/AppData/Local/pnpm/10.32.1/bin/pnpm.cjs",
|
|
env: { FOO: "bar" },
|
|
});
|
|
|
|
expect(result).toEqual({
|
|
command: "C:\\Program Files\\nodejs\\node.exe",
|
|
args: ["C:/Users/test/AppData/Local/pnpm/10.32.1/bin/pnpm.cjs", "build:plugin-sdk:dts"],
|
|
options: {
|
|
stdio: "inherit",
|
|
env: {
|
|
FOO: "bar",
|
|
NODE_OPTIONS: "--max-old-space-size=4096",
|
|
},
|
|
shell: false,
|
|
windowsVerbatimArguments: undefined,
|
|
},
|
|
});
|
|
});
|
|
});
|