kaocha

Official support channel: https://clojureverse.org/c/projects/kaocha
defa 2019-11-14T14:28:44.006800Z

I need some help with kaocha and ClojureScript… my test.edn looks like this:

#kaocha/v1
{:tests [{:id          :unit-cljs
          :type :kaocha.type/cljs
          :test-paths  ["test"]
          }]}
and I try to run the tests with:
lein kaocha unit-cljs

defa 2019-11-14T14:29:04.007100Z

Error:

No such suite: :unit-cljs, valid options: :unit.
Error encountered performing task 'run' with profile(s): 'base,system,user,provided,dev,kaocha'
Suppressed exit

miikka 2019-11-14T14:41:13.007500Z

@defa try renaming test.edn to tests.edn

defa 2019-11-14T14:42:37.008100Z

Thanks man, what a stupid mistake of me! Didn’t notice the s

plexus 2019-11-14T14:44:27.008500Z

not the first person this happens to... maybe we should have a warning for that 🙂

defa 2019-11-14T14:49:55.008900Z

@plexus good idea :thumbsup:

defa 2019-11-14T14:50:13.009300Z

Next problem:

Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: PrintWriter-on in this context, compiling:(kaocha/cljs/queue_eval_loop.clj:59:38)
        at clojure.lang.Compiler.analyze(Compiler.java:6792)
        at clojure.lang.Compiler.analyze(Compiler.java:6729)

defa 2019-11-14T14:50:35.009800Z

BTW: I’m trying to add ClojureScript tests to a re-natal based project.

plexus 2019-11-14T14:53:57.010300Z

that looks like a version mismatch, not sure of which project but I'm guessing clojurescript

plexus 2019-11-14T14:54:06.010500Z

make sure you're on the latest version

defa 2019-11-14T15:00:17.011500Z

Okay, makes a difference, but 🙈 next problem:

$ lein kaocha unit-cljs

[E]
Randomized with --seed 510488758

ERROR in unit-cljs (analyzer.cljc:3849)
Exception: clojure.lang.ExceptionInfo: null
#:clojure.error{:source #object[java.io.File 0x3f498899 "test/foo/core_test.cljs"], :line 1, :column 1, :phase :compilation}
 at cljs.analyzer$analyze_seq_STAR__wrap.invokeStatic (analyzer.cljc:3849)
    cljs.analyzer$analyze_seq_STAR__wrap.invoke (analyzer.cljc:3848)

defa 2019-11-14T15:00:56.012100Z

core_test.cljs:

(ns foo.core-test
  (:require [clojure.test :refer :all]
            ))

(deftest a-test
  (testing "FIXME, I fail."
    (is (= 0 1))))

defa 2019-11-14T15:01:45.012400Z

Caused by: clojure.lang.ExceptionInfo: Don't know how to create ISeq from: clojure.lang.Keyword at line 1 test/foo/core_test.cljs

miikka 2019-11-14T15:04:32.012800Z

ClojureScript doesn't support :refer :all

miikka 2019-11-14T15:04:43.013200Z

try :refer [deftest testing is]

defa 2019-11-14T15:04:43.013300Z

oops.

defa 2019-11-14T15:06:42.014Z

… copy paste error I didn’t notice. Sorry and thanks a lot @miikka & @plexus!