Fork me on GitHub

We can pick this up after any vacations 🙂 ----- Hi! After hitting some friction working on tests for neil dep upgrade, I figured that all I really wanted was to be able to run a few tests of my choice, not the whole test suite. So I gave it a shot. Example invocation:

bb test-only tests/dep-search-help-test tests/dep-search-test
I've got an implementation that looks like it's working well.
;; bb.edn task:

         test-only {:depends [gen-script]
                    :requires ([babashka.neil.test-runner])
                    :task (exec 'babashka.neil.test-runner/run-only)}

;; new function in babashka.neil.test-runner:

(defn run-only
  {:org.babashka/cli {:coerce {:only [:symbol]}
                      :args->opts (repeat :only)}}
  [{:keys [only]}]
  (doseq [test-sym only]
    (let [t (requiring-resolve test-sym)]
      (assert t)
WIP branch:


unrelated babashka/cli comment: exec seems a bit arbitrarily mapped to something that relates to :org.babashka/cli. I would perhaps expect something like this in tasks.edn:

:tasks {:requires ([babashka.fs :as fs]
                    [clojure.string :as str]
                    [selmer.parser :as p]
                    [selmer.util :refer [without-escaping]]
                    [babashka/cli :as cli])
test-only {:depends [gen-script]
                    :requires ([babashka.neil.test-runner])
                    :task (cli/exec 'babashka.neil.test-runner/run-only)}
. But now there's a public API, so keeping it as-is might be better. Not sure, others can be the judge of that.


Just creating a new test namespace would also kind of solve the problem. Depends on how we want to encourage people working with tests, I guess.


If this is an addition we want, I can add it to the neil dep upgrade PR, or create a separate PR.


@teodorlu I think that's ok, but we could also just use the cognitect test runner for this maybe


Makes sense - accidentally inventing a test runner cli is probably not something we want to do if we can use a tool made for the job.