Expand description
v0.59: the bynk test --format json result model, plus the parser that
folds the runner’s NDJSON event stream into it.
The generated tests/main.ts runner emits one JSON event per line when
BYNK_TEST_FORMAT=ndjson (an internal protocol — proposal v0.59,
Decision 2); run_test captures that stream and renders the single pinned
document below. The document is built from #[derive(Serialize)] structs
in declaration order — field order is the contract (the discipline
bynk/src/report.rs calls out); we never use serde_json::json!, so a
preserve_order feature enabled elsewhere in a build can’t reorder it.
There are three terminal states, distinguished by the consumer on the
presence/kind of error:
- normal —
suitespresent, noerror(may havefailed > 0); - compile — the project never compiled: no
suites,error.kind == "compile"carrying thebynkdiagnostic lines; - runtime — the runner started then died before
run-end: the observedsuitesprefix anderror.kind == "runtime"with the captured stderr.
Two more error.kinds are additive: "timeout" (a --mutate run killed at
its deadline) and "no_tests" (--require-tests on a project with none).
Structs§
- Case
- Coverage
- The
coverageblock: whole-run totals plus one entry per measured.bynkfile, keyed by project-relative path. Attributed to.bynksource lines, not emitted.ts/.js(issue #854); generated glue with no source origin is out-of-scope, never counted. - Eval
Value - #3585: what a
bynk evalsnippet evaluated to: the wire shape of its final expression (whatJson.encodegives it) and that expression’s type. - File
Coverage - One measured
.bynkfile’s line coverage. - Location
- Parsed
Run - The outcome of parsing the runner’s NDJSON stream: the suites observed, the
running tallies, and whether a
run-endevent was seen (a missingrun-endmeans the runner died mid-stream — a crashed/incomplete run). - Refusal
- #2272: a step of a driven history that an agent refused.
indexis the step’s position in the shrunk sequence the case reports (from 0),callthe handler it called, and the rest names the declaration that refused it, asViolationdoes. - Suite
- Test
Error - TestRun
- The pinned
bynk test --format jsondocument. - Unmatched
- The
--suiteand--casevalues a run selected nothing for (#2273), asrun-endreports them: present only when a filter was given and a value went unmatched. A filter that selects nothing is an error, not a vacuous pass. - Violation
- #2272: the declaration a violated invariant or transition names.
kindis the declaration’s own kind,"invariant"or"transition", which the name alone cannot say (an invariant and a transition may share one). - Warning
- #2685: a warning a case raised without failing: a smoke case’s answer
(
bynk.test.smoke_undeclared_status) outside the statuses its route’s handler can return.
Functions§
- parse_
ndjson - Parse the runner’s NDJSON stdout into a
ParsedRun. Unparseable or unrecognised lines are skipped (the stream is an internal protocol; a stray line should never abort the whole report).