From 54225aeaf33f2e56e17e824720cac1cdd1fa03dc Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Wed, 8 Jul 2026 21:24:43 +0300 Subject: [PATCH] =?UTF-8?q?fix(tests):=20verify-snapshots=20=E2=80=94=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D0=B0=20writeF?= =?UTF-8?q?ile-=D1=88=D0=B0=D0=B3=D0=BE=D0=B2=20=D0=B2=20preRun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit runPreSteps безусловно вызывал step.script.split('/') и падал на preRun-шаге типа writeFile (нет поля script) — «Cannot read properties of undefined (reading 'split')». Из-за этого cfe-borrow/form-bindings не верифицировался снэпшотами. Добавлена обработка writeFile-шага (ранний continue с записью файла), идентично основному раннеру tests/skills/runner.mjs. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/skills/verify-snapshots.mjs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/skills/verify-snapshots.mjs b/tests/skills/verify-snapshots.mjs index 887f1f33..ea3a3641 100644 --- a/tests/skills/verify-snapshots.mjs +++ b/tests/skills/verify-snapshots.mjs @@ -330,6 +330,16 @@ function buildSkillArgs(skillConfig, caseData, workDir, inputFile, runtime) { function runPreSteps(preRun, workDir, runtime, log) { if (!preRun) return; for (const step of preRun) { + // writeFile step — записать произвольный файл в workDir перед запуском скрипта + if (step.writeFile) { + const wfPath = join(workDir, step.writeFile.path); + const wfContent = typeof step.writeFile.content === 'string' + ? step.writeFile.content + : JSON.stringify(step.writeFile.content, null, 2); + writeFileSync(wfPath, wfContent, 'utf8'); + log(`preRun: writeFile ${step.writeFile.path}`, true); + continue; + } const preArgs = []; for (const [flag, value] of Object.entries(step.args || {})) { preArgs.push(flag);