kaocha

Official support channel: https://clojureverse.org/c/projects/kaocha
lomin 2020-06-18T08:24:13.328300Z

Hi everyone! I tried to run a kaocha test in a nextjournal clojure notebook, but with no success. Does anybody have an example notebook that contains a running kaoacha test?

plexus 2020-06-18T08:25:14.328800Z

@lomin would you mind sharing the link to your notebook? how are you invoking kaocha?

lomin 2020-06-18T08:30:11.330500Z

I do not even know, how the test.edn should look like. What would the test path look like for a nextjournal notebook?

plexus 2020-06-18T08:32:46.331100Z

are you running tests that are defined in code cells?

plexus 2020-06-18T08:33:35.331700Z

those are not on the file system, they are sent to the runner directly, so Kaocha will not be able to find those.

plexus 2020-06-18T08:35:53.332700Z

it's actually an interesting case... never thought it about it much before. You would want to build up a test plan solely based on defined vars, without scanning the file system.

lomin 2020-06-18T08:36:13.333200Z

yes, the test are in the code cells

plexus 2020-06-18T08:36:16.333400Z

doable with a bit of custom code + kaocha.repl/`kaocha.api`

plexus 2020-06-18T08:36:45.333900Z

do you need kaocha? seems like a use case where a simple clojure.test/run-all-tests might suffice?

lomin 2020-06-18T08:40:09.334600Z

Since I wanted to write about kaocha, running kaocha would come in handy 😉

plexus 2020-06-18T08:40:38.335Z

in that case I would use code listings and mount them on the file system

borkdude 2020-06-18T08:41:18.335600Z

I think clojure is installed in nextjournal right? Can't one just run clojure -Sdeps '{:deps {kaocha ...}}' -m ...?

plexus 2020-06-18T08:42:03.336100Z

yes, that's not the problem. The problem is that kaocha doesn't "see" any of the code that's defined in code cells.

borkdude 2020-06-18T08:42:17.336500Z

right

plexus 2020-06-18T08:42:44.337Z

@lomin are you familiar with the mount functionality? if you go into runtime settings you can "mount" a code listing at a certain path on the filesystem

lomin 2020-06-18T08:43:50.337300Z

Let me check ...

lomin 2020-06-18T08:45:11.337800Z

... I can mount files but no clojure code cells

plexus 2020-06-18T08:45:35.338100Z

yeah you can't mount code cells, only listings

lomin 2020-06-18T08:48:29.339500Z

ok, this seems to be more cumbersome than I thought. I was hoping that I was doing something wrong 😉 I try to come with a workaround. Thanks for your help.

lomin 2020-06-18T08:58:44.340200Z

cool, thanks! I can work with that.