2026-01-01 22:55:21 +01:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
|
|
|
|
|
import { runCommandWithTimeout } from "./exec.js";
|
|
|
|
|
|
|
|
|
|
describe("runCommandWithTimeout", () => {
|
|
|
|
|
it("passes env overrides to child", async () => {
|
|
|
|
|
const result = await runCommandWithTimeout(
|
|
|
|
|
[
|
|
|
|
|
process.execPath,
|
|
|
|
|
"-e",
|
2026-01-04 14:32:47 +00:00
|
|
|
'process.stdout.write(process.env.CLAWDBOT_TEST_ENV ?? "")',
|
2026-01-01 22:55:21 +01:00
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
timeoutMs: 5_000,
|
2026-01-04 14:32:47 +00:00
|
|
|
env: { CLAWDBOT_TEST_ENV: "ok" },
|
2026-01-01 22:55:21 +01:00
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(result.code).toBe(0);
|
|
|
|
|
expect(result.stdout).toBe("ok");
|
|
|
|
|
});
|
|
|
|
|
});
|