From 00b88abeb7d478c474d1486aefc7d56782c27508 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 16 Jul 2026 03:54:21 -0400 Subject: [PATCH] test(cli): align timeout failure with result contract --- packages/cli/src/commands/transcribe.test.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/commands/transcribe.test.ts b/packages/cli/src/commands/transcribe.test.ts index 293dc576f..621210c90 100644 --- a/packages/cli/src/commands/transcribe.test.ts +++ b/packages/cli/src/commands/transcribe.test.ts @@ -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 () => {