Test execution, reporting, and inspection
Test execution, reporting, and inspection
A function you can override via binding
, or safely via alter-var-root
.
On test :error
s, the related Throwable be invoked as the sole argument
passed to this var.
For example, you can use this to add an additional println
,
for pretty-printing Spec failures. Remember to flush
if doing so.
A function you can override via `binding`, or safely via `alter-var-root`. On test `:error`s, the related Throwable be invoked as the sole argument passed to this var. For example, you can use this to add an additional `println`, for pretty-printing Spec failures. Remember to `flush` if doing so.
An atom holding the results of the test run in progress
An atom holding the results of the test run in progress
(handle-stacktrace-op {:keys [ns var index transport session id
:nrepl.middleware.print/print-fn]
:as msg})
(handle-test-var-query-op {:keys [fail-fast var-query transport session id]
:as msg})
Handle reporting for test events.
This takes a test event map as an argument and updates the current-report
atom to reflect test results and summary statistics.
Handle reporting for test events. This takes a test event map as an argument and updates the `current-report` atom to reflect test results and summary statistics.
(report-fixture-error ns e)
Delegate reporting for test fixture errors to the report
function. This
finds the erring test fixture in the stacktrace and binds it as the current
test var. Test count is decremented to indicate that no tests were run.
Delegate reporting for test fixture errors to the `report` function. This finds the erring test fixture in the stacktrace and binds it as the current test var. Test count is decremented to indicate that no tests were run.
An atom holding results of test runs, indexed by namespace. This is used to reference exception objects from erring tests, and to rerun tests (by namespace) that did not pass previously. The var itself will be bound from the nREPL session.
An atom holding results of test runs, indexed by namespace. This is used to reference exception objects from erring tests, and to rerun tests (by namespace) that did not pass previously. The var itself will be bound from the nREPL session.
(stack-frame e f)
(stack-frame namespaces e f)
Search the stacktrace of exception e
for the function f
and return info
describing the stack frame, including var, class, and line.
Search the stacktrace of exception `e` for the function `f` and return info describing the stack frame, including var, class, and line.
(test-ns ns vars)
(test-ns ns vars fail-fast?)
If the namespace object defines a function named test-ns-hook
, call that.
Otherwise, test the specified vars. On completion, return a map of test
results.
If the namespace object defines a function named `test-ns-hook`, call that. Otherwise, test the specified vars. On completion, return a map of test results.
(test-nss m)
(test-nss m fail-fast?)
Call test-ns
for each entry in map m
, in which keys are namespace
symbols and values are var symbols to be tested in that namespace (or nil
to test all vars). Symbols are first resolved to their corresponding
objects.
Call `test-ns` for each entry in map `m`, in which keys are namespace symbols and values are var symbols to be tested in that namespace (or `nil` to test all vars). Symbols are first resolved to their corresponding objects.
(test-result ns v m)
Transform the result of a test assertion. Append ns, var, assertion index,
and 'testing' context. Retain any exception. Pretty-print expected/actual or
use its print-method
, if applicable.
Transform the result of a test assertion. Append ns, var, assertion index, and 'testing' context. Retain any exception. Pretty-print expected/actual or use its `print-method`, if applicable.
(test-var v)
If var v
has a function in its :test
metadata, call that function,
with clojure.test/*testing-vars*
bound to append v
.
If var `v` has a function in its `:test` metadata, call that function, with `clojure.test/*testing-vars*` bound to append `v`.
(test-var-query var-query)
(test-var-query var-query fail-fast?)
Call test-ns
for each var found via var-query.
Call `test-ns` for each var found via var-query.
(test-vars ns vars)
(test-vars ns vars fail-fast?)
Call test-var
on each var, with the fixtures defined for namespace object
ns
.
Call `test-var` on each var, with the fixtures defined for namespace object `ns`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close