diff --git a/tests/skills/README.md b/tests/skills/README.md index cadf6aa1..feb94049 100644 --- a/tests/skills/README.md +++ b/tests/skills/README.md @@ -14,10 +14,23 @@ node tests/skills/runner.mjs --verbose # подробн node tests/skills/runner.mjs --update-snapshots # обновить эталоны node tests/skills/runner.mjs --runtime python # запуск на PY-версиях node tests/skills/runner.mjs --json report.json # JSON-отчёт +node tests/skills/runner.mjs --concurrency 4 # ограничить параллельность +node tests/skills/runner.mjs --with-validation # + платформенная валидация +node tests/skills/runner.mjs --help # полный список опций ``` Exit code: 0 = все прошли, 1 = есть падения. +### Платформенная верификация снапшотов + +```bash +node tests/skills/verify-snapshots.mjs --skill form-compile # один навык +node tests/skills/verify-snapshots.mjs --case table # один кейс +node tests/skills/verify-snapshots.mjs --help # полный список опций +``` + +Перепрогоняет навык из DSL кейса и грузит результат в 1С — отлавливает случаи, когда снапшоты обновили, но платформа уже не принимает выход. + ## Что делать при падении 1. Смотри **case id** в выводе — это путь к файлу кейса (можно перезапустить: `node runner.mjs `) @@ -194,7 +207,8 @@ node tests/skills/runner.mjs cases/meta-compile/enum --update-snapshots # од ``` tests/skills/ - runner.mjs # тест-раннер + runner.mjs # тест-раннер (snapshot-сравнение) + verify-snapshots.mjs # платформенная верификация снапшотов README.md # этот файл .cache/ # кэш фикстур (в .gitignore) cases/ diff --git a/tests/skills/runner.mjs b/tests/skills/runner.mjs index cafe95df..fd0b228e 100644 --- a/tests/skills/runner.mjs +++ b/tests/skills/runner.mjs @@ -18,11 +18,32 @@ const CACHE = resolve(ROOT, '.cache'); // ─── CLI args ─────────────────────────────────────────────────────────────── +function printHelp() { + console.log(`skill-test-runner — Snapshot-based regression tests for 1C skill scripts + +Usage: + node tests/skills/runner.mjs [filter] [options] + +Arguments: + filter Substring to match case id (e.g. "form-compile" or "form-compile/table") + +Options: + --update-snapshots Overwrite snapshot files with current actual output + --runtime Which script port to run (default: powershell) + --json Write JSON report to + --concurrency Number of parallel workers (default: cpu count) + --with-validation Run platform validation (1cv8 design checks) after compile + -v, --verbose Verbose output + -h, --help, /? Show this help and exit +`); +} + function parseArgs(argv) { - const args = { filter: null, updateSnapshots: false, runtime: 'powershell', jsonReport: null, verbose: false, concurrency: cpus().length, withValidation: false }; + const args = { filter: null, updateSnapshots: false, runtime: 'powershell', jsonReport: null, verbose: false, concurrency: cpus().length, withValidation: false, help: false }; const rest = argv.slice(2); for (let i = 0; i < rest.length; i++) { const a = rest[i]; + if (a === '-h' || a === '--help' || a === '/?' || a === '/help' || a === '?') { args.help = true; continue; } if (a === '--update-snapshots') { args.updateSnapshots = true; continue; } if (a === '--runtime' && rest[i + 1]) { args.runtime = rest[++i]; continue; } if (a === '--json' && rest[i + 1]) { args.jsonReport = rest[++i]; continue; } @@ -1020,6 +1041,7 @@ function printIntegrationReport(results, opts) { async function main() { const opts = parseArgs(process.argv); + if (opts.help) { printHelp(); return; } mkdirSync(CACHE, { recursive: true }); // Load platform context for platform-dependent tests diff --git a/tests/skills/verify-snapshots.mjs b/tests/skills/verify-snapshots.mjs index 89b420a7..887f1f33 100644 --- a/tests/skills/verify-snapshots.mjs +++ b/tests/skills/verify-snapshots.mjs @@ -23,11 +23,30 @@ const REPORT_DIR = resolve(REPO_ROOT, 'debug/snapshot-verify'); // ─── CLI args ─────────────────────────────────────────────────────────────── +function printHelp() { + console.log(`verify-snapshots — Platform verification of skill test snapshots + +Reruns skill scripts from test-case DSL, then loads results into 1C platform. + +Usage: + node tests/skills/verify-snapshots.mjs [options] + +Options: + --skill Run only cases for the given skill (e.g. form-compile) + --case Run only the case with this name + --runtime Which script port to run (default: powershell) + --keep Keep generated work directories on disk after run + -v, --verbose Verbose output + -h, --help, /? Show this help and exit +`); +} + function parseArgs(argv) { - const args = { skill: null, caseName: null, runtime: 'powershell', keep: false, verbose: false }; + const args = { skill: null, caseName: null, runtime: 'powershell', keep: false, verbose: false, help: false }; const rest = argv.slice(2); for (let i = 0; i < rest.length; i++) { const a = rest[i]; + if (a === '-h' || a === '--help' || a === '/?' || a === '/help' || a === '?') { args.help = true; continue; } if (a === '--skill' && rest[i + 1]) { args.skill = rest[++i]; continue; } if (a === '--case' && rest[i + 1]) { args.caseName = rest[++i]; continue; } if (a === '--runtime' && rest[i + 1]) { args.runtime = rest[++i]; continue; } @@ -1034,6 +1053,7 @@ function writeReport(results) { async function main() { const opts = parseArgs(process.argv); + if (opts.help) { printHelp(); return; } const v8ctx = loadV8Context(); if (!v8ctx) {