shadow-cljs as the ClojureScript TEST RUNNER: which build runs the tests, how
THIS machine invokes shadow-cljs, and the exact argv that runs a narrowed
selection. A *_test.cljs never loads on the JVM, so clojure -M:test can no
more run it than node can run a .clj — the build is not a preference here,
it is the only runtime that exists.
Three facts decide the command, and each has its own honest refusal instead of a guess:
node_modules/.bin/shadow-cljs (npm) wins
because it is what the project's own npm test runs; a
thheller/shadow-cljs dependency in deps.edn runs as
clojure -M[:alias] -m shadow.cljs.devtools.cli — the SAME project may
carry it either way, and an alias-only dependency needs that alias on the
command line or the classpath lacks the namespace being -m'd. Declared in
package.json but not installed is answered as npm install, not as
"no ClojureScript runner".--config-merge carries namespace focus and
disables Node autorun. Compile first, then run Node separately: shadow's
autorun does not propagate the child exit status. Print overrides with
pr-str; hand-built regexp escapes can make shadow print help and exit
ZERO without compiling anything.shadow-cljs as the ClojureScript TEST RUNNER: which build runs the tests, how THIS machine invokes shadow-cljs, and the exact argv that runs a narrowed selection. A `*_test.cljs` never loads on the JVM, so `clojure -M:test` can no more run it than `node` can run a `.clj` — the build is not a preference here, it is the only runtime that exists. Three facts decide the command, and each has its own honest refusal instead of a guess: 1. HOW shadow-cljs is installed. `node_modules/.bin/shadow-cljs` (npm) wins because it is what the project's own `npm test` runs; a `thheller/shadow-cljs` dependency in `deps.edn` runs as `clojure -M[:alias] -m shadow.cljs.devtools.cli` — the SAME project may carry it either way, and an alias-only dependency needs that alias on the command line or the classpath lacks the namespace being `-m`'d. Declared in `package.json` but not installed is answered as `npm install`, not as "no ClojureScript runner". 2. WHICH build runs tests. Resolve an explicit build or the sole test build; never guess between suites. :node-test runs headless, :karma drives its own browser, and :browser-test needs a browser RUNTIME that this runner cannot supply. Compiling alone is never evidence of passing tests. 3. WHAT the run is narrowed to. `--config-merge` carries namespace focus and disables Node autorun. Compile first, then run Node separately: shadow's autorun does not propagate the child exit status. Print overrides with `pr-str`; hand-built regexp escapes can make shadow print help and exit ZERO without compiling anything.
(config root)Read the project's shadow-cljs.edn without loading shadow or evaluating code. Normalize its documented map/vector build spellings for both tests and REPLs.
Read the project's shadow-cljs.edn without loading shadow or evaluating code. Normalize its documented map/vector build spellings for both tests and REPLs.
(launcher root)Use the project's npm launcher when installed (it interprets its own config). Direct library launches preserve :deps aliases or :lein profile exactly as shadow-cljs.edn declares. Vis never installs or depends on shadow-cljs.
Use the project's npm launcher when installed (it interprets its own config). Direct library launches preserve :deps aliases or :lein profile exactly as shadow-cljs.edn declares. Vis never installs or depends on shadow-cljs.
(ns-regexp nses)The :ns-regexp that selects EXACTLY nses. shadow-cljs re-finds this
against every compiled namespace, so the anchors are what stop a.core-test
from also dragging in a.core-test-helpers.
The `:ns-regexp` that selects EXACTLY `nses`. shadow-cljs `re-find`s this against every compiled namespace, so the anchors are what stop `a.core-test` from also dragging in `a.core-test-helpers`.
(run-steps root {:keys [nses build output-root]})The commands that RUN the ClojureScript tests of root, in order, as
{:build :target :kind :steps [{:argv [...]}]} — or {:error ...} when this
project cannot run them, which is data the caller reports, never an exception.
:nses narrows the run; an empty selection leaves the configured suite untouched. :build
is required when more than one test build is configured.
:node-test disables autorun, verifies compilation, then runs Node separately
to retain its exit status. The caller supplies a unique :output-root for
Node artifacts (including :dev overrides) and owns its cleanup; no project
config is written. :karma keeps its configured output and single-shot binary.
The commands that RUN the ClojureScript tests of `root`, in order, as
`{:build :target :kind :steps [{:argv [...]}]}` — or `{:error ...}` when this
project cannot run them, which is data the caller reports, never an exception.
`:nses` narrows the run; an empty selection leaves the configured suite untouched. `:build`
is required when more than one test build is configured.
`:node-test` disables autorun, verifies compilation, then runs Node separately
to retain its exit status. The caller supplies a unique `:output-root` for
Node artifacts (including :dev overrides) and owns its cleanup; no project
config is written. :karma keeps its configured output and single-shot binary.(test-build cfg requested)Resolve an explicit test build or the sole test target. Different builds may use different runtimes, dependencies and filters; alphabetical order is not evidence that one of them is the requested suite.
Resolve an explicit test build or the sole test target. Different builds may use different runtimes, dependencies and filters; alphabetical order is not evidence that one of them is the requested suite.
(test-namespace? cfg requested ns-str)Does a JS/shared source namespace match a configured test build? This is for file discovery, not build selection: multiple matching builds still require an explicit build at execution. No filename convention replaces :ns-regexp.
Does a JS/shared source namespace match a configured test build? This is for file discovery, not build selection: multiple matching builds still require an explicit build at execution. No filename convention replaces :ns-regexp.
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 |