@unotest/dsl
v0.52.1
Published
The @unotest scenario language: JavaScript (ES2020) parsed to ESTree, a vocab-agnostic validator (@unotest/dsl/validator) and an interpreter (@unotest/dsl/executor). See LANGUAGE.md.
Readme
@unotest/dsl
The language of @unotest scenarios: JavaScript (ES2020) parsed into an
ESTree program, a vocab-agnostic validator under
@unotest/dsl/validator, and an interpreter under
@unotest/dsl/executor.
What the language is and what it leaves out — LANGUAGE.md.
Parse
import { AcornScenarioParser, ScenarioSyntaxError } from "@unotest/dsl";
const parsed = new AcornScenarioParser().parse(source, "e2e/login.js");
// parsed.program — ESTree.Program; parsed.functions, parsed.entriesA source that is not JavaScript throws ScenarioSyntaxError with
file, line, col and format(source) — the message and a caret
code frame. ESTree types are re-exported as ESTree.
Validate
import { validateScenario } from "@unotest/dsl/validator";
// `registry` is a FunctionContractRegistry supplied by the platform
// (e.g. @unotest/web's web-vocab contracts) — this package ships none.
const diagnostics = validateScenario(parsed, registry);The validator checks the language (what is outside it, the built-in forms, the top level) and the calls against the injected contracts: unknown functions, arity, argument kinds.
Run
@unotest/dsl/executor exports ScenarioInterpreter — an async
generator of step events over the parsed program — and the host
interfaces (IExecutionRuntime, IFunctionDispatcher) a platform
implements to give scenarios their functions.
Consumers
@unotest/web— CLI / MCP / runner: parses and validates scenarios forlintand runs them on the interpreter.
Pre-launch
Pre-1.0.0 — public API may change without deprecation cycles. Pin to
an exact version if breakage matters.
