Kaocha hooks and :volley/worker-setup inside a worker: resolves the
hooks named in the parent's {:op :configure} message and calls them at
the points volley.hooks/semantics describes. The worker threads the
value init returns through its loop; every function here takes it and
returns the next one, so there is no state of its own.
Portable Clojure, like volley.shell.worker: it runs on babashka and on
the JVM.
A hook is a qualified symbol, resolved with requiring-resolve in the
worker, or a list form, evaluated there (Kaocha's load-hook). The
calling conventions are Kaocha's: pre-load gets the config, post-load
and pre-run the test plan, post-run the result, pre-load-test and
post-load-test a testable and the config, pre-test and post-test a
testable and the test plan, wrap-run the run function, pre-report the
report event. Each hook's return value is passed to the next hook of the
same key, as Kaocha does; what the last one returns is ignored except
for pre-report (the event that gets counted), pre-test (a testable
with :kaocha.testable/skip skips a var) and wrap-run (the wrapped
run function). :volley/worker-setup fns take no arguments.
Kaocha hooks and `:volley/worker-setup` inside a worker: resolves the
hooks named in the parent's `{:op :configure}` message and calls them at
the points `volley.hooks/semantics` describes. The worker threads the
value `init` returns through its loop; every function here takes it and
returns the next one, so there is no state of its own.
Portable Clojure, like `volley.shell.worker`: it runs on babashka and on
the JVM.
A hook is a qualified symbol, resolved with `requiring-resolve` in the
worker, or a list form, evaluated there (Kaocha's `load-hook`). The
calling conventions are Kaocha's: `pre-load` gets the config, `post-load`
and `pre-run` the test plan, `post-run` the result, `pre-load-test` and
`post-load-test` a testable and the config, `pre-test` and `post-test` a
testable and the test plan, `wrap-run` the run function, `pre-report` the
report event. Each hook's return value is passed to the next hook of the
same key, as Kaocha does; what the last one returns is ignored except
for `pre-report` (the event that gets counted), `pre-test` (a testable
with `:kaocha.testable/skip` skips a var) and `wrap-run` (the wrapped
run function). `:volley/worker-setup` fns take no arguments.(active? hs)True when there is anything to call.
True when there is anything to call.
(before-run hs suite)Before the tests of a namespace of suite: pre-run the first time in
this worker, and pre-test with the suite testable the first time for
suite. A throw is kept as the setup error.
Before the tests of a namespace of `suite`: `pre-run` the first time in this worker, and `pre-test` with the suite testable the first time for `suite`. A throw is kept as the setup error.
(init msg)Hook state for the {:op :configure} message msg, or for none (nil):
then every function here does nothing.
Hook state for the `{:op :configure}` message `msg`, or for none (nil):
then every function here does nothing.(plan hs)The test plan hooks see: the config with the namespaces this worker has loaded so far, under their suites.
The test plan hooks see: the config with the namespaces this worker has loaded so far, under their suites.
(post-load-ns hs suite ns-sym ns-obj vars)After ns-sym loaded with test vars vars: post-load-test for it (and
for the suite, the first time), then post-load with the plan so far.
Returns the new state; throws when a hook does.
After `ns-sym` loaded with test vars `vars`: `post-load-test` for it (and for the suite, the first time), then `post-load` with the plan so far. Returns the new state; throws when a hook does.
(post-summary! entries result)Run the post-summary hooks entries in this process (the parent)
with Kaocha-shaped result. Returns the Throwable that stopped them, or
nil.
Run the `post-summary` hooks `entries` in this process (the parent) with Kaocha-shaped `result`. Returns the Throwable that stopped them, or nil.
(pre-load-ns hs ns-sym)pre-load-test with the testable of ns-sym, before it is required.
Throws when a hook does.
`pre-load-test` with the testable of `ns-sym`, before it is required. Throws when a hook does.
(report-fn hs report)report with the pre-report hooks in front: each event goes through
them first. A hook that throws is reported on stderr and the event is
counted unchanged. The project's reporters then get the event.
`report` with the `pre-report` hooks in front: each event goes through them first. A hook that throws is reported on stderr and the event is counted unchanged. The project's reporters then get the event.
(run-ns hs suite ns-sym ns-obj run)Run a namespace: pre-test with its testable, run (a fn of no
arguments returning the var results) wrapped by the wrap-run hooks,
then post-test with the result. Returns [hs result]; throws when a
hook does. In a suite whose wrap-run did not call run it runs
nothing.
Run a namespace: `pre-test` with its testable, `run` (a fn of no arguments returning the var results) wrapped by the `wrap-run` hooks, then `post-test` with the result. Returns `[hs result]`; throws when a hook does. In a suite whose `wrap-run` did not call run it runs nothing.
(run-var hs ns-sym v test! counts)Run test var v of ns-sym: pre-test with its testable, then
(test!) and (counts) for its result, wrapped by the wrap-run
hooks, unless a hook marked it :kaocha.testable/skip, then
post-test. A wrap-run hook may not call them. Returns the var's result
testable, with :kaocha.testable/skip when it was skipped; throws when
a hook does.
Run test var `v` of `ns-sym`: `pre-test` with its testable, then `(test!)` and `(counts)` for its result, wrapped by the `wrap-run` hooks, unless a hook marked it `:kaocha.testable/skip`, then `post-test`. A `wrap-run` hook may not call them. Returns the var's result testable, with `:kaocha.testable/skip` when it was skipped; throws when a hook does.
(setup hs suite)Before a namespace of suite is loaded: the first time in this worker,
resolve every hook, call :volley/worker-setup and pre-load; the first
time for suite, its own worker setup and pre-load-test with the suite
testable. A throw is kept as the setup error.
Before a namespace of `suite` is loaded: the first time in this worker, resolve every hook, call `:volley/worker-setup` and `pre-load`; the first time for `suite`, its own worker setup and `pre-load-test` with the suite testable. A throw is kept as the setup error.
(setup-error hs)The Throwable a worker setup or run-level hook threw, or nil. Once set, the worker runs no more tests.
The Throwable a worker setup or run-level hook threw, or nil. Once set, the worker runs no more tests.
(shutdown hs)When the worker is shut down cleanly: post-test with each suite
testable this worker ran, then post-run with the result. Returns the
Throwables hooks threw (it calls every hook regardless), with those a
suite's wrap-run threw after its run first. After a setup error it
calls no hooks but still returns those.
When the worker is shut down cleanly: `post-test` with each suite testable this worker ran, then `post-run` with the result. Returns the Throwables hooks threw (it calls every hook regardless), with those a suite's `wrap-run` threw after its run first. After a setup error it calls no hooks but still returns those.
(wrap-suite hs suite body)Call the wrap-run hooks once with the testable of suite around
(body hs), which does the rest of this worker's work and returns the
final state, as Kaocha wraps the run of a suite. Returns [hs ran?]:
with ran?, the state body returned (plus what a hook threw after it,
kept for shutdown); without, hs with suite marked unrun, or with
the setup error when the hooks did not resolve or one threw first.
Call the `wrap-run` hooks once with the testable of `suite` around `(body hs)`, which does the rest of this worker's work and returns the final state, as Kaocha wraps the run of a suite. Returns `[hs ran?]`: with `ran?`, the state `body` returned (plus what a hook threw after it, kept for `shutdown`); without, `hs` with `suite` marked unrun, or with the setup error when the hooks did not resolve or one threw first.
(wrap-suite? hs suite)True when suite still has to be wrapped by the wrap-run hooks in
this worker: there are some, and its first namespace has not run.
True when `suite` still has to be wrapped by the `wrap-run` hooks in this worker: there are some, and its first namespace has not run.
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 |