kaocha

Official support channel: https://clojureverse.org/c/projects/kaocha
2020-08-07T14:48:57.028600Z

Hi, I am having an issue with kaocha-cljs. I get an Kaocha ClojureScript client failed connecting bac with {:kaocha.testable/id :unit-cljs, :cljs/repl-env cljs.repl.node/repl-env, :cljs/compiler-options {:target :nodejs}} when trying to run tests. I did npm install ws, clojure, clojurescript, kaocha & kaocha-cljs are in the classpath. My test.edn looks like this:

#kaocha/v1
    {:tests [{:id :unit-clj
              :source-paths ["src"]
              :test-paths ["test"]
              :ns-patterns ["-test$"]}

             {:id :unit-cljs
              :type :kaocha.type/cljs
              :source-paths ["src"]
              :test-paths ["test"]
              :ns-patterns ["-test$"]}]}
 
I am pretty sure I made some dumb mistake somewhere, I just can’t see where. Any ideas?

plexus 2020-08-07T16:39:15.029700Z

Hard to tell @jeremys, at first glance that looks ok. Are you a able to get a node repl with cljs.main?

2020-08-07T16:50:36.032200Z

@plexus Well here is where it gets weird, I started a clojure repl (nrepl + piggiback) and switched to cljs

(ns dev
  (:require
    [cljs.repl.node :as node]
    [cider.piggieback :as piggie]))

(defn start-node-repl []
  (piggie/cljs-repl (node/repl-env)))


(comment
  (start-node-repl))
ran the tests from there (they passed). Now if I run the test with kaocha-cljs it works... I made an observation that might be helpfull. If I start kaocha-cljs on a fresh repo, no .cljs_node_repl nor out directories present, kaocha will creates those. In this case the namespaces from my project aren’t compiled (no presence in .cljs_node_repl) and kaocha-cljs crashes. If run my tests from a repl first (clj repl -> cljs repl via piggie) my code get complied and is present in .cljs_node_repl . Running kaocha-cljs now works.