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?
@lomin would you mind sharing the link to your notebook? how are you invoking kaocha?
I do not even know, how the test.edn should look like. What would the test path look like for a nextjournal notebook?
are you running tests that are defined in code cells?
those are not on the file system, they are sent to the runner directly, so Kaocha will not be able to find those.
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.
yes, the test are in the code cells
doable with a bit of custom code + kaocha.repl
/`kaocha.api`
do you need kaocha? seems like a use case where a simple clojure.test/run-all-tests
might suffice?
Since I wanted to write about kaocha, running kaocha would come in handy 😉
in that case I would use code listings and mount them on the file system
I think clojure
is installed in nextjournal right? Can't one just run clojure -Sdeps '{:deps {kaocha ...}}' -m ...
?
yes, that's not the problem. The problem is that kaocha doesn't "see" any of the code that's defined in code cells.
right
@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
Let me check ...
... I can mount files but no clojure code cells
yeah you can't mount code cells, only listings
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 here's an example https://nextjournal.com/a/MfUjr1Upau7WsWcCojTVp?token=9SZHk4uw3Um5bLnu8wfRwA
cool, thanks! I can work with that.