This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-09
Channels
- # asami (10)
- # babashka (11)
- # beginners (24)
- # braveandtrue (1)
- # cider (4)
- # cljs-dev (4)
- # clojure (88)
- # clojure-europe (19)
- # clojurescript (6)
- # code-reviews (7)
- # conjure (2)
- # core-async (2)
- # css (3)
- # cursive (11)
- # expound (81)
- # fulcro (2)
- # hoplon (1)
- # off-topic (42)
- # pathom (1)
- # re-frame (5)
- # shadow-cljs (17)
- # spacemacs (25)
- # testing (6)
- # tools-deps (3)
- # xtdb (12)
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/ns-publics
clojure.core/vals
(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 replthanks 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. https://github.com/weavejester/eftest
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.
https://github.com/seancorfield/vscode-clover-setup/blob/develop/config.cljs#L112-L117 -- it tries -test
first and then -expectations
because we have a lot of tests at work that use https://github.com/clojure-expectations/clojure-test (because I prefer that syntax, but wanted it to be compatible with all the clojure.test
tooling).