Fork me on GitHub
#kaocha
<
2021-12-12
>
practicalli-johnny12:12:51

Kaocha watcher issue: I can run the Kaocha watcher for a new deps.edn project using the clojure.main approach, however, I cannot seem to trigger the watcher when using the clojure.exec approach I created a project using clj-new using the app template, which has one failing test by default. I did not add a test.edn config as I just wanted a minimal setup to run kaocha across any deps.edn project. (I could perhaps add a generic test.edn in the ~/.clojure/ directory and point to that) I created a user wide alias in ~/.clojure/deps.edn with both clojure.main and clojure.exec configuration. The clojure.exec with the :watch? true config does a test run, but then ends, so I assume the :watch? config (and it seems :randomise too) is being ignored somewhere This is the alias I am using

:test/kaocha-watch
  {:extra-paths ["test"]
   :extra-deps  {lambdaisland/kaocha {:mvn/version "1.60.945"}}
   :main-opts   ["-m" "kaocha.runner" "--watch"]
   :exec-fn kaocha.runner/exec-fn
   :exec-args {:watch? true
               :randomize? false
               :fail-fast? true}}
I get the same issue if I add clojure.exec arguments on the command line clojure -X:test/kaocha-watch "{:watch? true}" I'll add a screenshot as a thread.

practicalli-johnny12:12:28

clojure.exec doesnt start the watcher, but clojure.main does

practicalli-johnny12:12:47

I added a second test to the Clojure project, this time a passing test and re-ran the clojure.exec approach with command line arguments

clojure -X:test/kaocha-watch "{:watch? true}"
This did one test run and then ended, so it seems none of the arguments are being used

practicalli-johnny13:12:23

Even when I include a test.edn in the root of the Clojure project, using the clojure.exec method to run kaocha does not use the watch? true configuration In my tests.edn file

#kaocha/v1 {:watch? true
            :kaocha/fail-fast? true
            :kaocha.plugin.randomize/randomize? false}
If I call Kaocha with the clojure.main config, it does pick up the tests.edn configuration and run the watcher. So something in the path of the clojure.exec call the configuration is not being applied it seems.

practicalli-johnny02:01:45

Excellent, I will try this tomorrow. Thanks for the fix and letting me know.

Alys Brooks21:01:21

You're welcome!