This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-15
Channels
- # announcements (8)
- # architecture (9)
- # autochrome-github (1)
- # babashka (48)
- # beginners (55)
- # calva (36)
- # cider (16)
- # clj-commons (1)
- # clj-kondo (38)
- # cljs-dev (44)
- # cljsrn (1)
- # clojure (164)
- # clojure-europe (35)
- # clojure-nl (2)
- # clojure-norway (10)
- # clojure-uk (23)
- # clojurescript (50)
- # conjure (24)
- # core-async (1)
- # cryogen (2)
- # cursive (38)
- # datalevin (11)
- # datascript (2)
- # datomic (13)
- # duct (1)
- # emacs (16)
- # events (12)
- # exercism (3)
- # figwheel-main (7)
- # fulcro (26)
- # honeysql (5)
- # integrant (1)
- # jobs (3)
- # kaocha (6)
- # lsp (72)
- # malli (22)
- # nextjournal (35)
- # nrepl (1)
- # off-topic (34)
- # pathom (5)
- # polylith (8)
- # portal (40)
- # re-frame (14)
- # reagent (42)
- # reitit (1)
- # releases (1)
- # remote-jobs (1)
- # reveal (9)
- # sci (2)
- # shadow-cljs (13)
- # sql (3)
- # tools-deps (33)
- # vim (25)
Is there a (built-in) way to make kaocha detect :source-paths
and :test-paths
automatically? Or take them from deps.edn
?
I have split my code into multiple sub-projects and would like to run all tests. For that, my :test
alias has all sub/x/test
directories in :extra-paths
. I do not want to repeat all these paths in tests.edn
.
there's nothing built in for that, you could make a plugin for that or do it through a hook
OK, thanks!
Just wanted to come back here to share the quick and dirty solution I came up with, and to say thank you @U07FP7QJ0 for making Kaocha awesome and extensible. I was surprised how easy that was! 💪
Here is the gist of my pre-load
hook:
(require '[clojure.java.classpath :as cp])
(defn- classpath-test-paths
"Finds all 'test' directories on the classpath."
[]
(into []
(comp (filter #(= "test" (.getName %)))
(map #(.getPath %)))
(cp/classpath-directories)))
(defn pre-load-classpath-test-paths
"Kaocha pre-load hook to set test-paths from the classpath."
[config]
;; Quick and dirty -- YMMV
(assoc-in config [:kaocha/tests 0 :kaocha/test-paths] (classpath-test-paths)))
…and then this line in tests.edn
and done:
:kaocha.hooks/pre-load [my.kaocha.hooks/pre-load-classpath-test-paths]