Fork me on GitHub
#kaocha
<
2020-06-18
>
lomin08:06:13

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?

plexus08:06:14

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

lomin08:06:11

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

plexus08:06:46

are you running tests that are defined in code cells?

plexus08:06:35

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

plexus08:06:53

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.

lomin08:06:13

yes, the test are in the code cells

plexus08:06:16

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

plexus08:06:45

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

lomin08:06:09

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

plexus08:06:38

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

borkdude08:06:18

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

plexus08:06:03

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

plexus08:06:44

@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

lomin08:06:50

Let me check ...

lomin08:06:11

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

plexus08:06:35

yeah you can't mount code cells, only listings

lomin08:06:29

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.

lomin08:06:44

cool, thanks! I can work with that.