fix(tests): verify-snapshots — поддержка writeFile-шагов в preRun

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) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-07-08 21:24:43 +03:00
parent 91196ea63f
commit 54225aeaf3
+10
View File
@@ -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);