Fork me on GitHub
Tim Robinson10:01:52

Hi all. I've just written my first clojure.test test 🙂 but I've noticed than using (run-all-tests) in the repl lists out "Testing xxx" for every namespace, so I have to wade through 500 lines of irrelevant output to find out the test that failed. Is there any simple way to get round that? It's just a small one-man project so I don't want to set up any complicated CI


(clojure.core/->> (clojure.core/all-ns)
                  (clojure.core/filter (clojure.core/fn [n]
                                         (clojure.core/->> n
                                                           (clojure.core/some (clojure.core/fn [var-ref]
                                                                                {:pre [(clojure.core/var? var-ref)]}
                                                                                (clojure.core/-> var-ref clojure.core/meta :test))))))
                  (clojure.core/sort-by clojure.core/pr-str)
                  (clojure.core/apply clojure.test/run-tests))
I have this as a IDE snippet (e.g yasnippet) that I can expand in the repl

Tim Robinson18:01:24

thanks I'll try that out 🙂


I've used weavejester/eftest on a few projects, it's a fairly minimal test runner, you might want to take a look at that.


I have hot keys bound to a) essentially (clojure.test/run-tests *ns*) to run all the tests in the current namespace and b) code that constructs a test ns name from the current ns (e.g., by sticking -test on it), requiring it, and then running tests in that ns.

seancorfield21:01:47 -- it tries -test first and then -expectations because we have a lot of tests at work that use (because I prefer that syntax, but wanted it to be compatible with all the clojure.test tooling).