Watch mode as pure functions: no I/O, clocks or atoms.
changes compares two modification-time snapshots.update-infos and affected-by turn the changes into the test
namespaces to rerun, through volley.deps-graph.select-plan narrows a volley.select/plan to a rerun selection and the
user's filters.step is the UI state machine: keys, file changes, ticks and finished
runs in, {:state :effects} out, in the style of volley.engine.Effects step returns, for volley.shell.watch to carry out:
{:effect :start-run :selection sel} ; build a plan from sel and run it
{:effect :cancel-run} ; kill the running run's workers
{:effect :print :lines [str]}
{:effect :prompt :label str :buffer str-or-nil} ; nil closes the prompt
{:effect :quit}
A selection is {:all? bool :failed? bool :namespaces #{ns} :reload-config? bool :reload-deps? bool :ns-pattern str-or-nil :test-pattern str-or-nil}. :reload-deps? asks for the worker classpath
to be computed again, after deps.edn or bb.edn changed.
Without :all?, it names the namespaces to run: :namespaces plus, with
:failed?, the ones that failed last time (only their failed vars when
they are not also in :namespaces).
Watch mode as pure functions: no I/O, clocks or atoms.
* `changes` compares two modification-time snapshots.
* `update-infos` and `affected-by` turn the changes into the test
namespaces to rerun, through `volley.deps-graph`.
* `select-plan` narrows a `volley.select/plan` to a rerun selection and the
user's filters.
* `step` is the UI state machine: keys, file changes, ticks and finished
runs in, `{:state :effects}` out, in the style of `volley.engine`.
Effects `step` returns, for `volley.shell.watch` to carry out:
{:effect :start-run :selection sel} ; build a plan from sel and run it
{:effect :cancel-run} ; kill the running run's workers
{:effect :print :lines [str]}
{:effect :prompt :label str :buffer str-or-nil} ; nil closes the prompt
{:effect :quit}
A selection is `{:all? bool :failed? bool :namespaces #{ns}
:reload-config? bool :reload-deps? bool :ns-pattern str-or-nil
:test-pattern str-or-nil}`. `:reload-deps?` asks for the worker classpath
to be computed again, after deps.edn or bb.edn changed.
Without `:all?`, it names the namespaces to run: `:namespaces` plus, with
`:failed?`, the ones that failed last time (only their failed vars when
they are not also in `:namespaces`).(affected-by suites old-infos new-infos {:keys [added modified deleted]})Test namespaces affected by changes: added and modified files are
looked up in the new graph, deleted ones in the old graph (the new one no
longer knows them). Files the graph cannot place, such as resources,
affect every test namespace, as in volley.deps-graph/affected.
Test namespaces affected by `changes`: added and modified files are looked up in the new graph, deleted ones in the old graph (the new one no longer knows them). Files the graph cannot place, such as resources, affect every test namespace, as in `volley.deps-graph/affected`.
(cancel-action {:keys [elapsed waiting killed?]})What a cancel does next, elapsed ms after it asked the run's workers to
stop, with waiting the ones whose exit has not arrived: :done,
:wait, :kill (once the grace period is over, unless killed?) or
:give-up (the kills were not enough either).
What a cancel does next, `elapsed` ms after it asked the run's workers to stop, with `waiting` the ones whose exit has not arrived: `:done`, `:wait`, `:kill` (once the grace period is over, unless `killed?`) or `:give-up` (the kills were not enough either).
How long a cancelled run's workers get to stop, and run their shutdown hooks, before they are killed.
How long a cancelled run's workers get to stop, and run their shutdown hooks, before they are killed.
(changed-paths {:keys [added modified deleted]})All paths in a changes result, sorted.
All paths in a `changes` result, sorted.
(changes prev snapshot)What happened between two snapshots ({path mtime}): paths present only
in snapshot are :added, paths in both with a different mtime are
:modified, paths only in prev are :deleted. Each is a sorted vector.
What happened between two snapshots (`{path mtime}`): paths present only
in `snapshot` are `:added`, paths in both with a different mtime are
`:modified`, paths only in `prev` are `:deleted`. Each is a sorted vector.(compile-pattern s)A regex for the non-blank string s, or nil when s is blank or not a
valid pattern.
A regex for the non-blank string `s`, or nil when `s` is blank or not a valid pattern.
A burst of changes fires one rerun once this long passes without a new
change. It is longer than poll-ms, so changes seen by consecutive polls
merge.
A burst of changes fires one rerun once this long passes without a new change. It is longer than `poll-ms`, so changes seen by consecutive polls merge.
(deps-file? path)True for a snapshot path that is one of deps-files.
True for a snapshot path that is one of `deps-files`.
The project files that decide the classpath, relative to the project directory. The shell watches them, and a change to one recomputes the worker classpath.
The project files that decide the classpath, relative to the project directory. The shell watches them, and a change to one recomputes the worker classpath.
(due? pending at)True when pending has been quiet for debounce-ms at time at.
True when `pending` has been quiet for `debounce-ms` at time `at`.
(init {:keys [keys? config-file color?]})Initial state. opts: :keys? (the shell reads the keyboard), :config-file
(a change to it reruns everything with a fresh config), :color?.
Initial state. opts: `:keys?` (the shell reads the keyboard), `:config-file` (a change to it reruns everything with a fresh config), `:color?`.
(merge-outcome prev {:keys [ran failed skipped]})The picture after a run: failures of namespaces the run did not cover
carry over, those of namespaces it did cover are replaced, except for
vars the run's filters skipped (:skipped), whose earlier failures are
kept. Unreadable files are re-reported by every run, so they are never
carried over. prev may be nil. Returns {:ok? bool :failures n :failed {key #{var}}}.
The picture after a run: failures of namespaces the run did not cover
carry over, those of namespaces it did cover are replaced, except for
vars the run's filters skipped (`:skipped`), whose earlier failures are
kept. Unreadable files are re-reported by every run, so they are never
carried over. `prev` may be nil. Returns `{:ok? bool :failures n :failed
{key #{var}}}`.(merge-selection a b)The selection that covers both a and b.
The selection that covers both `a` and `b`.
(outcome run)What the UI needs to remember about a finished run (a volley.run-state
value): {:ran #{ns} :failed {key #{var}} :skipped {ns #{var}}}. A key is
a namespace, or the path of an unreadable test file. A key whose failure
is not tied to a var (load error, crash, not run, unreadable file) has an
empty set, meaning "all of it". A namespace whose vars the filters all
skipped, some by a :skip filter, is left out of :ran, so its earlier
failures carry over. One that finished with no vars at all, or whose
vars no filter focused, still counts as run, which clears an earlier
failure of the whole namespace (a load error that is now fixed).
:skipped holds the vars a filter did not focus, so merge-outcome can
keep their earlier failures.
What the UI needs to remember about a finished run (a `volley.run-state`
value): `{:ran #{ns} :failed {key #{var}} :skipped {ns #{var}}}`. A key is
a namespace, or the path of an unreadable test file. A key whose failure
is not tied to a var (load error, crash, not run, unreadable file) has an
empty set, meaning "all of it". A namespace whose vars the filters all
skipped, some by a `:skip` filter, is left out of `:ran`, so its earlier
failures carry over. One that finished with no vars at all, or whose
vars no filter focused, still counts as run, which clears an earlier
failure of the whole namespace (a load error that is now fixed).
`:skipped` holds the vars a filter did not focus, so `merge-outcome` can
keep their earlier failures.(plan-empty? plan)True when plan has no namespace to run.
True when `plan` has no namespace to run.
How often the shell compares modification times.
How often the shell compares modification times.
(run-opts engine-opts config run)The volley.engine/init options of a watch run under config, the
current one (reloaded when tests.edn changes): the session's
engine-opts with the options volley.config/engine-opts takes from
the config (given run's JUnit :timestamp and :cwd). The reporter
and colour keep their startup values. Without a :seed the run is not
randomized.
The `volley.engine/init` options of a watch run under `config`, the current one (reloaded when tests.edn changes): the session's `engine-opts` with the options `volley.config/engine-opts` takes from the config (given `run`'s JUnit `:timestamp` and `:cwd`). The reporter and colour keep their startup values. Without a `:seed` the run is not randomized.
(select-plan config
infos
cli-suites
{:keys [all? failed? namespaces ns-pattern test-pattern]}
failed)The plan for a watch run. Starts from volley.select/plan (so the config's
suites, patterns and Kaocha filters always apply) and keeps only entries
that
:all?, else :namespaces and,
with :failed?, the keys of failed ({ns #{var}}; an empty set means
the whole namespace);:ns-pattern (a regex searched in the namespace name).:test-pattern prunes no namespace: any of them may hold a
macro-defined test whose name matches, so it goes into each select spec
as :var-pattern and the worker applies it to the real vars.
A namespace selected only as failed with known failed vars runs just those vars.
The plan for a watch run. Starts from `volley.select/plan` (so the config's
suites, patterns and Kaocha filters always apply) and keeps only entries
that
* are in the selection: everything with `:all?`, else `:namespaces` and,
with `:failed?`, the keys of `failed` (`{ns #{var}}`; an empty set means
the whole namespace);
* match `:ns-pattern` (a regex searched in the namespace name).
`:test-pattern` prunes no namespace: any of them may hold a
macro-defined test whose name matches, so it goes into each select spec
as `:var-pattern` and the worker applies it to the real vars.
A namespace selected only as failed with known failed vars runs just
those vars.(status-lines {:keys [last keys?] :as state})The lines printed after a run: PASS or FAIL, what to do next, and the active filters.
The lines printed after a run: PASS or FAIL, what to do next, and the active filters.
(step state {:keys [event at paths] :as input})Fold one input into the watch state. Inputs:
{:event :start} ; first run
{:event :key :char c}
{:event :files-changed :paths [p ...] :affected #{ns} :at ms}
{:event :tick :at ms}
{:event :run/finished :outcome o :empty? bool}
A change to :config-file (or :config? true on the input) reruns
everything with a fresh config; a change to deps.edn or bb.edn
(deps-file?) also recomputes the classpath. Once the state is :quit,
inputs are ignored. Returns {:state :effects}.
Fold one input into the watch state. Inputs:
{:event :start} ; first run
{:event :key :char c}
{:event :files-changed :paths [p ...] :affected #{ns} :at ms}
{:event :tick :at ms}
{:event :run/finished :outcome o :empty? bool}
A change to `:config-file` (or `:config? true` on the input) reruns
everything with a fresh config; a change to deps.edn or bb.edn
(`deps-file?`) also recomputes the classpath. Once the state is `:quit`,
inputs are ignored. Returns `{:state :effects}`.(update-infos infos {:keys [added modified deleted]} texts)Apply changes to infos ({path ns-info}). texts maps each added
or modified path to its new contents (nil when it could not be read).
Only Clojure files are parsed (volley.discover/ns-info).
Apply `changes` to `infos` (`{path ns-info}`). `texts` maps each added
or modified path to its new contents (nil when it could not be read).
Only Clojure files are parsed (`volley.discover/ns-info`).(watched-file? path)False for editor droppings and anything under a dot directory: hidden
files, foo~, #foo#, .swp files. The shell skips these when it
takes a snapshot.
False for editor droppings and anything under a dot directory: hidden files, `foo~`, `#foo#`, `.swp` files. The shell skips these when it takes a snapshot.
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 |