mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-11 13:33:41 +03:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user