Fork me on GitHub
#kaocha
<
2021-03-08
>
defa08:03:12

Kaocha stopped working for no obvious reason. No error, just stuck:

% ./scripts/kaocha.sh        
[(.)
… and then nothing. Process does not terminate. With no tests, kaocha terminates but with even the most trivial test:
(deftest simple
  (testing "never fails"
    (is true)))
it gets stuck. Same if I let the test fail (is false). Any ideas what is happening here. Did work flawlessly before.

defa08:03:49

This is my kaocha.sh:

#!/usr/bin/env bash
clojure -A:test "$@"

defa08:03:50

Typing ctr-c in terminal terminates kaocha and prints the expected result.

defa08:03:20

Have not found anything that allows verbose output.

defa08:03:05

My tests.edn is this:

;; tests.edn
#kaocha/v1
    {:tests [{:id                             :unit-cljs
              :type                           :kaocha.type/cljs
              :src-paths                      ["src/main"]
              :test-paths                     ["src/test"]
              :ns-patterns                    ["-test$"]}]}

plexus09:03:37

Could you, once it has gotten stuck - use jcmd to find the process id of the kaocha process - use jstack to get the stack traces of that process - share those (via http://gist.github.com/) ? That way we can see exactly where it's stuck.

plexus09:03:51

please also share your deps.edn so we get the exact version you're using.

plexus09:03:02

and if you could then put all of the above into https://github.com/lambdaisland/kaocha/issues that would be 🙏:skin-tone-2: 🙏:skin-tone-2: 🙏:skin-tone-2: thanks2 🎉

plexus09:03:41

it's probably also a good idea to add :capture-output? false to your tests.edn, to make sure there aren't any warnings or other relevant output that's getting hidden.

plexus09:03:16

You could also use :reporter :kaocha.report/debug to get more verbose output, not sure how much that will tell us but it can't hurt.

defa10:03:31

Thanks @U07FP7QJ0, I will try later and let you know. If it still persists I’ll open an issue. Still have the feeling that it is something stupid on my side that I don’t see yet 😉

defa10:03:39

Okay, I found the troublemaker… I recently added some code to collect runtime stats in my re-frame based react native app with something like:

(defonce stats (atom {:counter 0}))

(defonce condition-eval-stats-timer
         (js/setInterval (fn []
                           (swap! stats update :counter inc))
                         1000))
When removing the js/setInverval kaocha behaves as expected. When isolating the problem in a minimal project I get this error after a while:
% ./bin/kaocha 
WARNING: When invoking clojure.main, use -M
[(.)E]
Randomized with --seed 1001458186

ERROR in unit-cljs (main.java:40)
Unexpected error executing kaocha-cljs test suite.
Exception: clojure.lang.ExceptionInfo: Failed cleaning up ClojureScript runtime
{:cljs/last-val "nil", :ws/disconnected? true, :ws/connected? false}
 at kaocha.type.cljs$eval6734$fn__6736$fn__6758.invoke (cljs.clj:302)
    kaocha.type.cljs$queue_consumer.invokeStatic (cljs.clj:181)
    kaocha.type.cljs$queue_consumer.invoke (cljs.clj:173)
    kaocha.type.cljs$eval6734$fn__6736.invoke (cljs.clj:298)
    ...
    kaocha.plugin.capture_output$capture_output_wrap_run_hook$fn__2618$fn__2619.invoke (capture_output.clj:83)
    ...
    kaocha.plugin.capture_output$capture_output_wrap_run_hook$fn__2618.doInvoke (capture_output.clj:83)
    ...
    kaocha.testable$run.invokeStatic (testable.clj:128)
    kaocha.testable$run.invoke (testable.clj:119)
    kaocha.testable$run_testable.invokeStatic (testable.clj:212)
    kaocha.testable$run_testable.invoke (testable.clj:157)
    kaocha.testable$run_testables.invokeStatic (testable.clj:225)
    kaocha.testable$run_testables.invoke (testable.clj:215)
    kaocha.api$run$fn__3124$fn__3125$fn__3126.invoke (api.clj:137)
    ...
    kaocha.api$run$fn__3124$fn__3125.invoke (api.clj:111)
    ...
    kaocha.api$run$fn__3124.invoke (api.clj:110)
    ...
    kaocha.api$run.invokeStatic (api.clj:96)
    kaocha.api$run.invoke (api.clj:83)
    kaocha.runner$run.invokeStatic (runner.clj:133)
    kaocha.runner$run.invoke (runner.clj:74)
    kaocha.runner$_main_STAR_.invokeStatic (runner.clj:172)
    kaocha.runner$_main_STAR_.doInvoke (runner.clj:145)
    ...
    kaocha.runner$_main.invokeStatic (runner.clj:183)
    kaocha.runner$_main.doInvoke (runner.clj:181)
    ...
0 tests, 1 assertions, 1 errors, 0 failures.
If opening an issue is still worth doing, please let me know and I will do so.

plexus14:03:33

Ok I missed that this is a kaocha-cljs issue, please mention that LOUD AND CLEAR next time, that's a completely different ball game than just plain kaocha

defa15:03:22

Okay. I promise. But is that behaviour expected or a bug? Should I raise an issue or not?

plexus15:03:47

When happens when you eval that code in a vanilla cljs repl?

plexus15:03:41

hmm seems to work fine, yeah please file an issue. You can find information in the kaocha-cljs repo for getting verbose output from kaocha-cljs

plexus15:03:04

I'm not sure we'll be able to do much about it, or if we'll even be able to really tell where it's going wrong. Kaocha-cljs is quite hard to troubleshoot. Kaocha-cljs2 is easier to pick apart but it's more work to put set up.

plexus15:03:57

but I'd still be interested to see your output with kaocha-cljs debugging turned on. Also please read the information in the kaocha-cljs README. kaocha-cljs works with a ClojureScript (p)repl under the hood, which is where most of its limitations stem from.