test(cli): align timeout failure with result contract

This commit is contained in:
James
2026-07-20 09:04:03 -07:00
parent 3aa2404747
commit 00b88abeb7
+2 -7
View File
@@ -3,7 +3,7 @@ import { writeFileSync, readFileSync, mkdtempSync, rmSync } from "node:fs";
import { join } from "node:path";
import { tmpdir } from "node:os";
import { WhisperUnavailableError } from "../whisper/manager.js";
import { consumeCommandResult } from "../utils/commandResult.js";
import { CliRuntimeError, consumeCommandResult } from "../utils/commandResult.js";
// Make the whisper core report "unavailable" so we exercise the soft-skip path.
const transcribeMock = vi.fn();
@@ -101,16 +101,13 @@ Render video. Built for agents.
const { dir, input } = dummyAudio();
dirs.push(dir);
const consoleLog = vi.mocked(console.log);
const exitSpy = vi.spyOn(process, "exit").mockImplementation(((code?: number) => {
throw new Error(`__exit_${code}__`);
}) as never);
// 100 is well below the 5000ms minimum — must fail loud instead of silently
// reverting to the auto-scaled default (the whole point of the flag is
// that the user explicitly asked for a specific value).
await expect(
transcribeCmd.run!({ args: { input, json: true, timeout: "100" } } as never),
).rejects.toThrow("__exit_1__");
).rejects.toThrow(CliRuntimeError);
const log = consoleLog.mock.calls.at(-1)?.[0];
expect(typeof log).toBe("string");
@@ -119,8 +116,6 @@ Render video. Built for agents.
expect(parsed.ok).toBe(false);
expect(parsed.error).toContain("--timeout");
expect(parsed.error).toContain("5000");
exitSpy.mockRestore();
});
it("--preserve-cues keeps single-word cues separate when exporting from JSON", async () => {