kaocha

Official support channel: https://clojureverse.org/c/projects/kaocha
plexus 2020-05-20T08:20:04.239300Z

That's a cool idea. We definitely want that on the namespace level, never thought about doing it on the function level.

nwjsmith 2020-05-20T14:13:03.240300Z

That would be awesome, I've heard of this as "Test Impact Analysis": https://martinfowler.com/articles/rise-test-impact-analysis.html

nwjsmith 2020-05-20T14:13:36.241200Z

@plexus do you happen to know if all the hooks are their to do make that kind of thing work with plugins?

nwjsmith 2020-05-20T14:14:15.242100Z

I could see it being especially useful for property-based tests, which tend to (necessarily) take a while to run

plexus 2020-05-20T14:26:28.242600Z

you should be able to do this with plugins just fine, just a matter of figuring out which tests should be skipped

Sean Poulter 2020-05-20T15:54:08.247200Z

Jest does something similar. It will check what files have been modified in version control and trace the dependency graph to decide what files to rerun. I’m not sure what level it walks the dependency graph at though — if it is namespace or function level.

plexus 2020-05-20T15:55:58.248Z

Midje does this as well in its autotest features, it just uses the dependency graph to limit the namespaces to run. There's a branch somewhere with a PoC for Kaocha https://nextjournal.com/lambdaisland/kaocha-autotest

👍 1
plexus 2020-05-20T15:56:29.248700Z

this is one of the projects we proposed for RGSoC, but not that likely we'll have a team this year so it's up for grabs if anyone is interested to have a go at it.

Sean Poulter 2020-05-20T16:50:08.249Z

Oh neat.

zane 2020-05-20T19:21:01.249800Z

For kaocha-cljs, is the right thing to try here to simply bump up the timeout?

Exception: clojure.lang.ExceptionInfo: Failed initializing ClojureScript runtime {:kaocha.testable/id :cljs, :cljs/repl-env cljs.repl.node/repl-env, :cljs/compiler-options {:target :nodejs}, :eval-done? true, :ws/connected? true}

zane 2020-05-20T19:40:37.249900Z

I’ll give the instructions under “https://github.com/lambdaisland/kaocha-cljs#debugging” a shot first, but it’s a bit gnarly because it’s only happening in CI.

borkdude 2020-05-20T19:43:36.250900Z

When using kaocha, is there an equivalent to -n from the cognitect test runner or :only from leiningen, from the command line?

borkdude 2020-05-20T19:47:56.251900Z

I'm trying to port this:

clojure -A:test -n babashka.pods.jvm-test
;;=>
clojure -A:test:kaocha --focus babashka.pods.jvm-test

clojure -A:sci:test -n babashka.pods.sci-test
;;=>
clojure -A:sci:test:kaocha --focus babashka.pods.sci-test

borkdude 2020-05-20T19:48:47.252800Z

This one:

clojure -A:test:kaocha --focus babashka.pods.jvm-test
doesn't work, since the sci library is (deliberately!) not available on the classpath. The code should run without the library, which is part of my test.

borkdude 2020-05-20T19:49:26.253300Z

With the Cognitest test runner or leiningen that works, but with kaocha it doesn't:

$ clojure -A:test:kaocha --focus babashka.pods.jvm-test
WARNING: :focus [:babashka.pods.jvm-test] did not match any tests.
[E]
Randomized with --seed 2027872620

ERROR in unit (babashka/pods/sci.clj:1)
Exception: clojure.lang.Compiler$CompilerException: Syntax error compiling at (babashka/pods/sci.clj:1:1).
#:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source "babashka/pods/sci.clj"}

borkdude 2020-05-20T19:51:13.253700Z

So my proposal would be that focus should not load files other than it needs.