From 9cffa81bccad6478d71b361a64618ee47d359497 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 15 Mar 2026 17:59:04 +0300 Subject: [PATCH] fix(web-test): --no-record stubs return proper objects in run.mjs sandbox The real fix: run.mjs sandbox was stubbing stopRecording/addNarration as noop (returning undefined). Now returns { file: null, duration: 0 } so video scripts work transparently with --no-record. Also: browser.mjs stopRecording/addNarration handle missing state gracefully. Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/skills/web-test/scripts/run.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.claude/skills/web-test/scripts/run.mjs b/.claude/skills/web-test/scripts/run.mjs index d3c80ee1..86ab9eb8 100644 --- a/.claude/skills/web-test/scripts/run.mjs +++ b/.claude/skills/web-test/scripts/run.mjs @@ -118,10 +118,13 @@ async function executeScript(code, { noRecord } = {}) { exports.writeFileSync = writeFileSync; exports.readFileSync = readFileSync; - // --no-record: stub all recording/narration functions as no-ops + // --no-record: stub recording/narration functions to return safe defaults if (noRecord) { const noop = async () => {}; - for (const fn of ['startRecording', 'stopRecording', 'addNarration', 'showCaption', 'hideCaption', 'showTitleSlide', 'hideTitleSlide']) { + exports.startRecording = noop; + exports.stopRecording = async () => ({ file: null, duration: 0, size: 0 }); + exports.addNarration = async () => ({ file: null, duration: 0, size: 0, captions: 0 }); + for (const fn of ['showCaption', 'hideCaption', 'showTitleSlide', 'hideTitleSlide']) { exports[fn] = noop; } exports.isRecording = () => false;