mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-10 16:14:54 +03:00
65ea06ab6e
Внутренности move в cli/:
- util.mjs — out/die/json/readBody/readStdin/elapsed/elapsed2/slugify/formatDuration/xmlEscape/interpolate/printSteps/usage
- session.mjs — SESSION_FILE, loadSession, cleanup
- exec-context.mjs — buildContext, buildScopedContext, executeScript
- server.mjs — handleRequest (HTTP сервер в процессе start)
- commands/{start,run,exec,shot,stop,status,test}.mjs — по одной команде на файл
- test-runner/assertions.mjs — createAssertions (ctx.assert API)
- test-runner/severity.mjs — SEVERITY_RANK/LEVELS, buildSeverityIndex, resolveSeverity
- test-runner/reporters.mjs — writeAllure, allureStep, syncAllureExtras, buildJUnit
- test-runner/discover.mjs — discoverTests, resetState
run.mjs остался публичным entry-point с CLI-парсингом и dispatcher'ом.
Регресс tests/web-test/ зелёный (19/19, 9m 28s).
23 lines
764 B
JavaScript
23 lines
764 B
JavaScript
// web-test cli/commands/run v1.0 — autonomous connect → exec → disconnect (no server)
|
|
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
|
import { readFileSync } from 'fs';
|
|
import { resolve } from 'path';
|
|
import * as browser from '../../browser.mjs';
|
|
import { out, die, readStdin } from '../util.mjs';
|
|
import { executeScript } from '../exec-context.mjs';
|
|
|
|
export async function cmdRun(url, fileOrDash) {
|
|
if (!url || !fileOrDash) die('Usage: node src/run.mjs run <url> <file|->');
|
|
|
|
const code = fileOrDash === '-'
|
|
? await readStdin()
|
|
: readFileSync(resolve(fileOrDash), 'utf-8');
|
|
|
|
await browser.connect(url);
|
|
const result = await executeScript(code);
|
|
await browser.disconnect();
|
|
|
|
out(result);
|
|
if (!result.ok) process.exit(1);
|
|
}
|