Skip to main content

Module test_stream

Module test_stream 

Source
Expand description

bynk test --format ndjson (#2267, Slice D stage 1): the supported result stream.

The runner already writes one JSON event per line (BYNK_TEST_FORMAT=ndjson), an internal protocol between the generated entry and the driver. --format json collects all of it and prints one document at the end; --format ndjson forwards it as it arrives, so a consumer sees each suite when that suite finishes. The events the driver prints are its own, not the runner’s lines passed through, so the contract does not depend on the runner’s wording:

  • run-begin {suites}
  • suite-begin {name, kind, tests}
  • case {suite, <the document's case fields>}: the same object the JSON document holds for the case, in the same field order, behind type and suite, so it carries tier and the generative fields too
  • suite-end {name}
  • run-end {passed, failed, skipped?, transport?}
  • error {kind, message?, diagnostics?, stderr?}: the document’s error object, for a compile failure, a run the driver could not start or finish, and a runner that died before run-end

The stream ends with exactly one of run-end or error. A case a remote run skipped (--skip-unsupported) is a case event with outcome skipped between the last suite-end and run-end. A line that is not a recognised runner event is dropped. Field order is the contract; a consumer ignores event types and fields it does not know.

Structs§

Stream
Turns the runner’s event lines into the stream’s, one at a time.
StreamContext
What the stream knows about the run besides the runner’s own events.

Functions§

events_for
The stream for a document held in full: a run that could not start (a compile failure, a launch error) is one error event, and a normal one is its suites’ events then run-end. Used where nothing is read live.
forward
Run cmd, forwarding each event to out as the runner writes it, and return its exit status. The runner’s stderr is collected on a thread, so a full pipe cannot stall it. If out stops accepting output (a consumer that went away), the runner is killed rather than left running.
print_run
Print a document in --format json, or its events in --format ndjson.

Type Aliases§

Skipped
A remote run’s skipped case, as it goes into the stream: suite, case, reason.