mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-17 08:15:16 +03:00
chore(tests): --help в runner и verify-snapshots, синхронизация README
Чтобы --help/-h/? не запускали полный прогон тестов. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+15
-1
@@ -14,10 +14,23 @@ node tests/skills/runner.mjs --verbose # подробн
|
|||||||
node tests/skills/runner.mjs --update-snapshots # обновить эталоны
|
node tests/skills/runner.mjs --update-snapshots # обновить эталоны
|
||||||
node tests/skills/runner.mjs --runtime python # запуск на PY-версиях
|
node tests/skills/runner.mjs --runtime python # запуск на PY-версиях
|
||||||
node tests/skills/runner.mjs --json report.json # JSON-отчёт
|
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 = есть падения.
|
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 <case-id>`)
|
1. Смотри **case id** в выводе — это путь к файлу кейса (можно перезапустить: `node runner.mjs <case-id>`)
|
||||||
@@ -194,7 +207,8 @@ node tests/skills/runner.mjs cases/meta-compile/enum --update-snapshots # од
|
|||||||
|
|
||||||
```
|
```
|
||||||
tests/skills/
|
tests/skills/
|
||||||
runner.mjs # тест-раннер
|
runner.mjs # тест-раннер (snapshot-сравнение)
|
||||||
|
verify-snapshots.mjs # платформенная верификация снапшотов
|
||||||
README.md # этот файл
|
README.md # этот файл
|
||||||
.cache/ # кэш фикстур (в .gitignore)
|
.cache/ # кэш фикстур (в .gitignore)
|
||||||
cases/
|
cases/
|
||||||
|
|||||||
+23
-1
@@ -18,11 +18,32 @@ const CACHE = resolve(ROOT, '.cache');
|
|||||||
|
|
||||||
// ─── CLI args ───────────────────────────────────────────────────────────────
|
// ─── 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 <ps|python> Which script port to run (default: powershell)
|
||||||
|
--json <path> Write JSON report to <path>
|
||||||
|
--concurrency <N> 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) {
|
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);
|
const rest = argv.slice(2);
|
||||||
for (let i = 0; i < rest.length; i++) {
|
for (let i = 0; i < rest.length; i++) {
|
||||||
const a = rest[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 === '--update-snapshots') { args.updateSnapshots = true; continue; }
|
||||||
if (a === '--runtime' && rest[i + 1]) { args.runtime = rest[++i]; continue; }
|
if (a === '--runtime' && rest[i + 1]) { args.runtime = rest[++i]; continue; }
|
||||||
if (a === '--json' && rest[i + 1]) { args.jsonReport = 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() {
|
async function main() {
|
||||||
const opts = parseArgs(process.argv);
|
const opts = parseArgs(process.argv);
|
||||||
|
if (opts.help) { printHelp(); return; }
|
||||||
mkdirSync(CACHE, { recursive: true });
|
mkdirSync(CACHE, { recursive: true });
|
||||||
|
|
||||||
// Load platform context for platform-dependent tests
|
// Load platform context for platform-dependent tests
|
||||||
|
|||||||
@@ -23,11 +23,30 @@ const REPORT_DIR = resolve(REPO_ROOT, 'debug/snapshot-verify');
|
|||||||
|
|
||||||
// ─── CLI args ───────────────────────────────────────────────────────────────
|
// ─── 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 <name> Run only cases for the given skill (e.g. form-compile)
|
||||||
|
--case <name> Run only the case with this name
|
||||||
|
--runtime <ps|python> 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) {
|
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);
|
const rest = argv.slice(2);
|
||||||
for (let i = 0; i < rest.length; i++) {
|
for (let i = 0; i < rest.length; i++) {
|
||||||
const a = rest[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 === '--skill' && rest[i + 1]) { args.skill = rest[++i]; continue; }
|
||||||
if (a === '--case' && rest[i + 1]) { args.caseName = 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; }
|
if (a === '--runtime' && rest[i + 1]) { args.runtime = rest[++i]; continue; }
|
||||||
@@ -1034,6 +1053,7 @@ function writeReport(results) {
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const opts = parseArgs(process.argv);
|
const opts = parseArgs(process.argv);
|
||||||
|
if (opts.help) { printHelp(); return; }
|
||||||
|
|
||||||
const v8ctx = loadV8Context();
|
const v8ctx = loadV8Context();
|
||||||
if (!v8ctx) {
|
if (!v8ctx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user