mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 09:52:13 +00:00
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
parseRunWithEnvArgs,
|
|
resolveSpawnCommand,
|
|
} from "../../scripts/run-with-env.mjs";
|
|
|
|
describe("run-with-env", () => {
|
|
it("parses leading env assignments before the command separator", () => {
|
|
expect(
|
|
parseRunWithEnvArgs([
|
|
"OPENCLAW_GATEWAY_PROJECT_SHARDS=1",
|
|
"EMPTY=",
|
|
"--",
|
|
"node",
|
|
"scripts/run-vitest.mjs",
|
|
"run",
|
|
]),
|
|
).toEqual({
|
|
env: {
|
|
OPENCLAW_GATEWAY_PROJECT_SHARDS: "1",
|
|
EMPTY: "",
|
|
},
|
|
command: "node",
|
|
args: ["scripts/run-vitest.mjs", "run"],
|
|
});
|
|
});
|
|
|
|
it("rejects missing command separators", () => {
|
|
expect(() => parseRunWithEnvArgs(["OPENCLAW_GATEWAY_PROJECT_SHARDS=1", "node"])).toThrow(
|
|
/usage:/u,
|
|
);
|
|
});
|
|
|
|
it("uses the current Node executable for node commands", () => {
|
|
expect(resolveSpawnCommand("node", ["scripts/run-vitest.mjs"], "node.exe")).toEqual({
|
|
command: "node.exe",
|
|
args: ["scripts/run-vitest.mjs"],
|
|
});
|
|
});
|
|
});
|