Skip to content

kaocha.repl/run Doesn't Pick Up Test Changes In The REPL Like clojure.test/run-tests #460

Description

@GAumala

When running tests via kaocha.repl/run in a REPL, changes to test files aren't detected on subsequent runs unless I use watch mode. Here's my workflow:

  1. First run (works as expected):
(require '[kaocha.repl :as kaocha])
(kaocha/run 'com.gaumala.myapp.login-test)
  1. After modifying a test assertion (effectively breaking the test) and re-running:
;; Still shows old results - no change detection
(kaocha/run 'com.gaumala.myapp.login-test) 

Expected behavior

Should behave like clojure.test, which picks up changes immediately:

(require '[clojure.test :as clj-test])
(clj-test/run-tests 'com.gaumala.myapp.login-test)

Workarounds

If I use watch mode (kaocha.watch/run (kaocha/config))), it also picks up changes correctly, but I'm not sure if I really want to use it because:

  • It takes a single parameter, the configuration can't pass a single namespace to run.
  • Once it starts I have no way to stop watch mode. My REPL is now hijacked by watch mode. I can't find any relevant function in the watch namespace.

I ended up using clojure.test for running individual namespaces in the REPL.

Additional context

I'm using kaocha version "1.91.1392". This is my config:

{:kaocha/tests                       [{:kaocha.testable/type :kaocha.type/clojure.test
                                       :kaocha.testable/id   :unit
                                       :kaocha/ns-patterns   ["-test$"]
                                       :kaocha/source-paths  ["src"]
                                       :kaocha/test-paths    ["test"]}]
 :kaocha/fail-fast?                  true
 :kaocha/color?                      true
 :kaocha/reporter                    [kaocha.report/dots]
 :kaocha/plugins                     [:kaocha.plugin/randomize
                                      :kaocha.plugin/filter
                                      :kaocha.plugin/capture-output]
 :kaocha.plugin.randomize/randomize? true}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions