Public API for apollo-test — composable building blocks for incremental test running.
This namespace re-exports the key functions from apollo-test's internal modules so advanced users can compose the test pipeline programmatically without depending on internal namespaces.
Typical usage: (require '[apollo-test.api :as at]) (let [cache-dir ".apollo-test" ;; or any custom path cache (at/read-cache cache-dir) tests (at/discover-test-files ["test"]) graph (at/build-graph ["src"] ["test"]) changes (at/detect-changes cache tests) affected (at/affected-test-nss graph changed-syms test-syms) summary (at/run-tests affected {:verbose false})] summary)
Public API for apollo-test — composable building blocks for
incremental test running.
This namespace re-exports the key functions from apollo-test's
internal modules so advanced users can compose the test pipeline
programmatically without depending on internal namespaces.
Typical usage:
(require '[apollo-test.api :as at])
(let [cache-dir ".apollo-test" ;; or any custom path
cache (at/read-cache cache-dir)
tests (at/discover-test-files ["test"])
graph (at/build-graph ["src"] ["test"])
changes (at/detect-changes cache tests)
affected (at/affected-test-nss graph changed-syms test-syms)
summary (at/run-tests affected {:verbose false})]
summary)(affected-test-nss graph changed-ns-syms test-ns-syms)Given the dependency graph, a set of changed namespace symbols, and
a set of known test namespace symbols, returns the set of test
namespaces that are transitively affected by the changes.
See apollo-test.graph/affected-test-nss for details.
Given the dependency graph, a set of changed namespace symbols, and a set of known test namespace symbols, returns the set of test namespaces that are transitively affected by the changes. See `apollo-test.graph/affected-test-nss` for details.
(build-graph src-dirs test-dirs)Scans all .clj files in the given source and test directories,
parses ns forms statically, and returns a DependencyGraph:
{:nodes #{ns-symbols...} :edges {ns-sym #{dep-ns-sym...}}}.
See apollo-test.graph/build-graph for details.
Scans all .clj files in the given source and test directories,
parses ns forms statically, and returns a DependencyGraph:
{:nodes #{ns-symbols...} :edges {ns-sym #{dep-ns-sym...}}}.
See `apollo-test.graph/build-graph` for details.(build-graph-from-parsed parsed-seq)Builds a DependencyGraph from a seq of pre-parsed ns-form maps
({:ns-sym <symbol> :deps #{<dep-symbols>}}).
See apollo-test.graph/build-graph-from-parsed for details.
Builds a DependencyGraph from a seq of pre-parsed ns-form maps
({:ns-sym <symbol> :deps #{<dep-symbols>}}).
See `apollo-test.graph/build-graph-from-parsed` for details.(detect-changes cache files)Given a RunCache and discovered files, classifies each file as
:changed, :unchanged, or :new using two-stage detection (mtime + SHA-256).
Returns {:changed [...] :unchanged [...] :new [...] :updated-entries {path -> entry}}.
See apollo-test.changes/detect-changes for details.
Given a RunCache and discovered files, classifies each file as
:changed, :unchanged, or :new using two-stage detection (mtime + SHA-256).
Returns {:changed [...] :unchanged [...] :new [...] :updated-entries {path -> entry}}.
See `apollo-test.changes/detect-changes` for details.(discover-clj-files dirs)Discovers all .clj/.cljc files under the given directories.
Returns a vec of {:path <string> :ns-sym <symbol>}.
See apollo-test.discovery/discover-clj-files for details.
Discovers all .clj/.cljc files under the given directories.
Returns a vec of {:path <string> :ns-sym <symbol>}.
See `apollo-test.discovery/discover-clj-files` for details.(discover-cljs-files dirs)Discovers all .cljs/.cljc files under the given directories.
Returns a vec of {:path <string> :ns-sym <symbol>}.
See apollo-test.discovery/discover-cljs-files for details.
Discovers all .cljs/.cljc files under the given directories.
Returns a vec of {:path <string> :ns-sym <symbol>}.
See `apollo-test.discovery/discover-cljs-files` for details.(discover-files-for-platform dirs platform)Discovers source files for the given platform (:clj or :cljs).
Returns a vec of {:path <string> :ns-sym <symbol>}.
See apollo-test.discovery/discover-files-for-platform for details.
Discovers source files for the given platform (:clj or :cljs).
Returns a vec of {:path <string> :ns-sym <symbol>}.
See `apollo-test.discovery/discover-files-for-platform` for details.(discover-test-files test-dirs)Discovers all .clj test files under the given test directories.
Returns a seq of {:path <string> :ns-sym <symbol>}.
See apollo-test.discovery/discover-test-files for details.
Discovers all .clj test files under the given test directories.
Returns a seq of {:path <string> :ns-sym <symbol>}.
See `apollo-test.discovery/discover-test-files` for details.(empty-cache)Returns a fresh, empty cache map with the current version.
Returns a fresh, empty cache map with the current version.
(file-hash path)Computes the SHA-256 hash of the file contents at the given path. Returns a lowercase hex string.
Computes the SHA-256 hash of the file contents at the given path. Returns a lowercase hex string.
(read-cache cache-dir)Reads the run cache from the given cache directory.
Returns nil if the cache does not exist, is unreadable, or has a
version mismatch. See apollo-test.cache/read-cache for details.
Reads the run cache from the given cache directory. Returns nil if the cache does not exist, is unreadable, or has a version mismatch. See `apollo-test.cache/read-cache` for details.
(reconcile-deleted cache)Removes cache entries for files that no longer exist on disk.
Returns the updated cache with deleted entries silently removed.
See apollo-test.changes/reconcile-deleted for details.
Removes cache entries for files that no longer exist on disk. Returns the updated cache with deleted entries silently removed. See `apollo-test.changes/reconcile-deleted` for details.
(run-tests test-ns-syms opts)Requires and runs the given test namespace symbols using clojure.test. Returns a RunSummary map with :total, :passed, :failed, :errored, :skipped-unchanged, :duration-ms, :failed-nss, :executed-nss, and :fail-fast-halted.
Options: :verbose — if true, also emit EDN for passing tests :skipped — count of skipped test namespaces (for summary line) :fail-fast — if true, stop after the first namespace with failures :ns-paths — map of {ns-string -> file-path} for actual discovered paths :timeout-ms — per-namespace timeout in milliseconds (nil = no timeout)
See apollo-test.exec/run-tests for details.
Requires and runs the given test namespace symbols using clojure.test.
Returns a RunSummary map with :total, :passed, :failed, :errored,
:skipped-unchanged, :duration-ms, :failed-nss, :executed-nss,
and :fail-fast-halted.
Options:
:verbose — if true, also emit EDN for passing tests
:skipped — count of skipped test namespaces (for summary line)
:fail-fast — if true, stop after the first namespace with failures
:ns-paths — map of {ns-string -> file-path} for actual discovered paths
:timeout-ms — per-namespace timeout in milliseconds (nil = no timeout)
See `apollo-test.exec/run-tests` for details.(write-cache cache-dir cache)Writes the run cache to the given cache directory as EDN.
Creates the directory if it does not exist.
See apollo-test.cache/write-cache for details.
Writes the run cache to the given cache directory as EDN. Creates the directory if it does not exist. See `apollo-test.cache/write-cache` for details.
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 |