Liking cljdoc? Tell your friends :D

com.blockether.vis.lang.clojure.coverage

Test coverage for Clojure: the project's Lazytest run under ClojureStorm and Clofidence.

ClojureStorm is a Clojure compiler that reports each expression it runs, and Clofidence records those reports. A coverage run adds both to the project's own test command through one extra deps.edn alias, :vis-coverage. A Lazytest hook in that alias writes the recorded forms as EDN, because the test JVM has no JSON library. This process then turns them into the vis-coverage/1 JSON report that graphify crap reads:

{"format": "vis-coverage/1", "tool": "clofidence", "prefixes": [...],
 "forms": [{"file": "app/core.clj", "ns": "app.core", "line": 3,
             "kind": "defn", "hittable": 12, "hit": 9,
             "children": {"4": [5, 5]}}]}

file is classpath-relative. hittable counts the expressions the compiler instrumented in the top-level form, and hit the ones that ran. children gives the same counts for each direct element of the form, keyed by its index, so a tool can score each method of a defrecord or an extend-type.

Each form also has branches, [measured ran] over the branches of its if, when, cond, cond-> and case forms, and gaps. A gap is the outermost code that never ran inside code that did: {"line", "end_line", "kind", "detail"}, where kind is branch or expression.

Test coverage for Clojure: the project's Lazytest run under ClojureStorm and
Clofidence.

ClojureStorm is a Clojure compiler that reports each expression it runs, and
Clofidence records those reports. A coverage run adds both to the project's own
test command through one extra deps.edn alias, `:vis-coverage`. A Lazytest hook
in that alias writes the recorded forms as EDN, because the test JVM has no JSON
library. This process then turns them into the `vis-coverage/1` JSON report that
`graphify crap` reads:

    {"format": "vis-coverage/1", "tool": "clofidence", "prefixes": [...],
     "forms": [{"file": "app/core.clj", "ns": "app.core", "line": 3,
                 "kind": "defn", "hittable": 12, "hit": 9,
                 "children": {"4": [5, 5]}}]}

`file` is classpath-relative. `hittable` counts the expressions the compiler
instrumented in the top-level form, and `hit` the ones that ran. `children`
gives the same counts for each direct element of the form, keyed by its index,
so a tool can score each method of a `defrecord` or an `extend-type`.

Each form also has `branches`, `[measured ran]` over the branches of its `if`,
`when`, `cond`, `cond->` and `case` forms, and `gaps`. A gap is the outermost
code that never ran inside code that did: `{"line", "end_line", "kind",
"detail"}`, where `kind` is `branch` or `expression`.
raw docstring

alias-ednclj

(alias-edn prefixes)

The -Sdeps value that adds the :vis-coverage alias.

The `-Sdeps` value that adds the `:vis-coverage` alias.
sourceraw docstring

branch-labelclj

(branch-label head size idx)

The branch that the element at idx is in a call of head with size elements: then, else, body, clause, step or default. Nil for other elements.

The branch that the element at `idx` is in a call of `head` with `size`
elements: then, else, body, clause, step or default. Nil for other elements.
sourceraw docstring

branchesclj

(branches {:keys [coords hits nodes]})

The branches of one recorded form that the compiler measured, and the ones that ran. A branch counts when it holds an instrumented expression, and it ran when one of them ran. A branch that is only a constant has no expression to measure.

The branches of one recorded form that the compiler measured, and the ones that
ran. A branch counts when it holds an instrumented expression, and it ran when one
of them ran. A branch that is only a constant has no expression to measure.
sourceraw docstring

clofidence-versionclj

The Clofidence release that records the coverage.

The Clofidence release that records the coverage.
sourceraw docstring

default-prefixesclj

(default-prefixes root)

The namespace prefixes to instrument: for each top-level segment of the project's source namespaces, the prefix that its namespaces share.

The namespace prefixes to instrument: for each top-level segment of the
project's source namespaces, the prefix that its namespaces share.
sourceraw docstring

finish!clj

(finish! root prefixes)

Turn the recorded forms into the report and summarize it. An error names a run that recorded nothing.

Turn the recorded forms into the report and summarize it. An `error` names a
run that recorded nothing.
sourceraw docstring

forms-pathclj

Where the hook writes the recorded forms, under the project root.

Where the hook writes the recorded forms, under the project root.
sourceraw docstring

gapsclj

(gaps {:keys [coords hits nodes line]})

The code of one recorded form that never ran: each expression that did not run inside one that did, so each gap names the outermost code that the tests missed.

The code of one recorded form that never ran: each expression that did not run
inside one that did, so each gap names the outermost code that the tests missed.
sourceraw docstring

hook-pathclj

The source path that holds the hook namespace, under the project root.

The source path that holds the hook namespace, under the project root.
sourceraw docstring

hook-varclj

The Lazytest hook that records coverage.

The Lazytest hook that records coverage.
sourceraw docstring

instrument-commandclj

(instrument-command cmd prefixes)

cmd, a clojure ... -M:aliases args... vector, run under the coverage alias with the hook. Nil when cmd has no -M alias argument.

`cmd`, a `clojure ... -M:aliases args...` vector, run under the coverage alias
with the hook. Nil when `cmd` has no `-M` alias argument.
sourceraw docstring

prepare!clj

(prepare! root)

Write the hook namespace and remove the forms of an earlier run.

Write the hook namespace and remove the forms of an earlier run.
sourceraw docstring

reportclj

(report forms prefixes)

The vis-coverage/1 report of the recorded forms that [[measured?]] keeps.

The `vis-coverage/1` report of the recorded `forms` that [[measured?]] keeps.
sourceraw docstring

report-pathclj

The vis-coverage/1 report, under the project root.

The `vis-coverage/1` report, under the project root.
sourceraw docstring

storm-versionclj

The ClojureStorm compiler release, a drop-in replacement for org.clojure/clojure.

The ClojureStorm compiler release, a drop-in replacement for org.clojure/clojure.
sourceraw docstring

summaryclj

(summary root report)

Covered and measured expressions, branches and gaps of each file in report.

Covered and measured expressions, branches and gaps of each file in `report`.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close