From 6667ab38ee3c50c4a296b60be7ef40c5a5c36f92 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 15 Mar 2026 17:36:19 +0300 Subject: [PATCH] fix(web-test): stopRecording/addNarration return stub when not recording Enables --no-record dry-run of video scripts without errors. stopRecording() returns { file: null, duration: 0, size: 0 } instead of throwing, and addNarration(null) returns a matching stub. Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/skills/web-test/scripts/browser.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.claude/skills/web-test/scripts/browser.mjs b/.claude/skills/web-test/scripts/browser.mjs index e07f405d..d82e9e2c 100644 --- a/.claude/skills/web-test/scripts/browser.mjs +++ b/.claude/skills/web-test/scripts/browser.mjs @@ -3639,7 +3639,7 @@ export async function startRecording(outputPath, opts = {}) { * @returns {{ file: string, duration: number, size: number }} */ export async function stopRecording() { - if (!recorder) throw new Error('Not recording. Call startRecording() first.'); + if (!recorder) return { file: null, duration: 0, size: 0 }; const { cdp, ffmpeg, startTime, outputPath } = recorder; @@ -3790,6 +3790,7 @@ export function getCaptions() { * @returns {{ file: string, duration: number, size: number, captions: number, warnings?: string[] }} */ export async function addNarration(videoPath, opts = {}) { + if (!videoPath) return { file: null, duration: 0, size: 0, captions: 0 }; const ffmpegPath = resolveFfmpeg(opts.ffmpegPath); const ttsProvider = getTtsProvider(opts.provider || 'edge'); const ttsOpts = { voice: opts.voice, apiKey: opts.apiKey, apiUrl: opts.apiUrl, model: opts.model };