Fork me on GitHub
#kaocha
<
2020-05-20
>
plexus08:05:04

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

nwjsmith14:05:03

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

nwjsmith14:05:36

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

nwjsmith14:05:15

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

plexus14:05:28

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

Sean Poulter15:05:08

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.

plexus15:05:58

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

👍 4
plexus15:05:29

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.

zane19:05:01

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}

zane19:05:37

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.

borkdude19:05:36

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

borkdude19:05:56

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

borkdude19:05:47

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.

borkdude19:05:26

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"}

borkdude19:05:13

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