Run state to text. Everything here is a pure function of the state and an
options map {:width n :color? bool :now millis}.
Live rendering is a function of the transition between two states:
(live-frame prev state opts) returns the lines that became final since
prev (:emit, printed once and never redrawn) and the lines that change
on every tick (:frame, redrawn in place). The shell keeps prev as the
state it rendered last, which is the only extra memory the live view needs.
Every returned line is at most :width columns wide. Text from tests (names,
messages, captured output) is stripped of control characters and escape
sequences before it is used, so colour appears only where this namespace
puts it.
Run state to text. Everything here is a pure function of the state and an
options map `{:width n :color? bool :now millis}`.
Live rendering is a function of the transition between two states:
`(live-frame prev state opts)` returns the lines that became final since
`prev` (`:emit`, printed once and never redrawn) and the lines that change
on every tick (`:frame`, redrawn in place). The shell keeps `prev` as the
state it rendered last, which is the only extra memory the live view needs.
Every returned line is at most `:width` columns wide. Text from tests (names,
messages, captured output) is stripped of control characters and escape
sequences before it is used, so colour appears only where this namespace
puts it.(ci-lines prev state opts)Append-only lines for non-TTY output: a line for each namespace that
finished since prev (or nil), followed by detailed reports for that
namespace's failures. (:only opts) as in live-frame.
Append-only lines for non-TTY output: a line for each namespace that finished since `prev` (or nil), followed by detailed reports for that namespace's failures. `(:only opts)` as in `live-frame`.
(diff expected actual)Structural diff of expected against actual, as a tree. Node types:
:same, :changed (:expected :actual), :missing and :extra (:value, in
expected only or in actual only), :map (:entries of [k node]), :seq
(:items), :set (:missing :extra :same-count). Sequential values are
aligned with a longest-common-subsequence edit script.
Structural diff of `expected` against `actual`, as a tree. Node types: :same, :changed (`:expected` `:actual`), :missing and :extra (`:value`, in expected only or in actual only), :map (`:entries` of `[k node]`), :seq (`:items`), :set (`:missing` `:extra` `:same-count`). Sequential values are aligned with a longest-common-subsequence edit script.
(diff-lines node opts)Renders a diff tree as lines, each starting with "- ", "+ " or two spaces. Colour marks removed lines red and added lines green.
Renders a diff tree as lines, each starting with "- ", "+ " or two spaces. Colour marks removed lines red and added lines green.
(diff-stats node)Counts leaf differences in a diff tree: {:missing n :extra n :changed n}.
Counts leaf differences in a diff tree: `{:missing n :extra n :changed n}`.
(documentation-lines prev state opts)Append-only lines for the documentation reporter (Kaocha's
kaocha.report/documentation): for each namespace that finished since
prev (or nil), its name and one line per test var with ✓, ✗ or - and
its duration, in the order the vars ran. Namespaces are printed whole
when they finish, so lines of namespaces running in parallel never
interleave. (:only opts) as in live-frame.
Append-only lines for the documentation reporter (Kaocha's `kaocha.report/documentation`): for each namespace that finished since `prev` (or nil), its name and one line per test var with ✓, ✗ or - and its duration, in the order the vars ran. Namespaces are printed whole when they finish, so lines of namespaces running in parallel never interleave. `(:only opts)` as in `live-frame`.
(failure-report state opts)Detailed report for every failure in state, or "" when there are none.
Detailed report for every failure in `state`, or "" when there are none.
(live-frame prev state opts)Splits a state transition into {:emit [...] :frame [...]}. prev is the
state last rendered, or nil. :emit holds permanent lines: a line for each
var that failed since prev and for each namespace that finished since
prev. :frame holds the redrawn part: one line per busy worker, then the
counts footer. With :final? true in opts the frame is empty.
(:only opts), when given, holds every namespace whose events arrived
since prev, and only those are looked at.
Splits a state transition into `{:emit [...] :frame [...]}`. `prev` is the
state last rendered, or nil. :emit holds permanent lines: a line for each
var that failed since `prev` and for each namespace that finished since
`prev`. :frame holds the redrawn part: one line per busy worker, then the
counts footer. With `:final? true` in `opts` the frame is empty.
`(:only opts)`, when given, holds every namespace whose events arrived
since `prev`, and only those are looked at.(orphan-report state opts)Detailed report for failures that belong to no namespace that ran (test
files whose ns form could not be read), which ci-lines never shows. ""
when there are none.
Detailed report for failures that belong to no namespace that ran (test files whose ns form could not be read), which `ci-lines` never shows. "" when there are none.
(output-excerpt lines marks)(output-excerpt lines marks limits)The part of a test's output lines (a vector) that a report shows, as
rows: [:line s], [:gap n] for n lines left out, and [:mark label].
Each of marks, {:line n :label s}, is a failure that happened after
the first n lines were printed. The excerpt keeps the lines around each
mark, or the last ones when there are none (see output-limits). A mark
after the last line gets no row: output that ends at a failure needs no
pointer to it.
The part of a test's output `lines` (a vector) that a report shows, as
rows: `[:line s]`, `[:gap n]` for `n` lines left out, and `[:mark label]`.
Each of `marks`, `{:line n :label s}`, is a failure that happened after
the first `n` lines were printed. The excerpt keeps the lines around each
mark, or the last ones when there are none (see `output-limits`). A mark
after the last line gets no row: output that ends at a failure needs no
pointer to it.(pretty v width)Lines of v printed readably within width columns where its
structure allows, the way clojure.pprint lays out code-free data:
a collection that does not fit on one line puts each item on a line of
its own, indented under the opening bracket. A scalar that is still too
wide is left whole for the caller to wrap.
Lines of `v` printed readably within `width` columns where its structure allows, the way `clojure.pprint` lays out code-free data: a collection that does not fit on one line puts each item on a line of its own, indented under the opening bracket. A scalar that is still too wide is left whole for the caller to wrap.
(protocol-notice {:keys [worker ns reason]} opts)One line saying that a protocol line from worker could not be read,
shown the moment it happens. ns is the namespace the worker held.
One line saying that a protocol line from `worker` could not be read, shown the moment it happens. `ns` is the namespace the worker held.
(still-running-line {:keys [ns var elapsed]} opts)still running: ns/var (1m 05s), for a test that runs for a long time
in CI, where no live view shows it.
`still running: ns/var (1m 05s)`, for a test that runs for a long time in CI, where no live view shows it.
(stray-lines text _opts)Output a test printed outside capture, for the live view, which shows it above the frame. Control and escape sequences are removed, but lines keep their full length: they are printed once and scroll away with the terminal's own wrapping, and only the redrawn frame must fit the width.
Output a test printed outside capture, for the live view, which shows it above the frame. Control and escape sequences are removed, but lines keep their full length: they are printed once and scroll away with the terminal's own wrapping, and only the redrawn frame must fit the width.
(summary state opts)Final block: the counts line, namespaces that never ran, the five slowest
tests, and a command to rerun the failures; with :compact? in opts
(watch mode) the counts line and the namespaces that never ran only. The counts line has the shape
N tests | P passed | F failed | E errors | S skipped (A assertions, 2.31s). The time
is the span of the events in state, so it does not depend on a clock.
Final block: the counts line, namespaces that never ran, the five slowest tests, and a command to rerun the failures; with `:compact?` in `opts` (watch mode) the counts line and the namespaces that never ran only. The counts line has the shape `N tests | P passed | F failed | E errors | S skipped (A assertions, 2.31s)`. The time is the span of the events in `state`, so it does not depend on a clock.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |