Clojurians
#kaocha
<
2019-01-01
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

hmaurer13:01:27

Hi! I just started using Kaocha and I’ve a quick question: I would like to run some setup code (specifically (st/instrument)) before all tests (once). As far as I can see the only way to do this is write a plugin?

plexus15:01:42

Yes, although that doesn't sound as heavyweight as it is.

plexus15:01:59

I've considered adding the ability to add any plugin hooks directly in your config, so you could say #kaocha/v1 {:kaocha.hooks/pre-run [my.pre-run/function]}, but at the moment that's not there yet.

plexus15:01:15

thanks for trying out Kaocha!

hmaurer18:01:32

@ thanks to you for writing it! I am loving it so far :slightly_smiling_face:

hmaurer18:01:07

Also: if I am using Kaocha as a lein alias, how should I load the plugin?

plexus09:01:40

Configure it in tests.edn, :plugins [my.plugin/name], or you can add it on the command line, --plugin :my.plugin/name. You might have to use -- as a separator between leiningen arguments and kaocha arguments, lein kaocha -- --plugin ...

plexus09:01:29

Apologies for the slow response, I was traveling the last few days

hmaurer20:01:55

I am also having an issue similar to this one: https://dev.clojure.org/jira/browse/TCHECK-113. Is there a similar work around for Kaocha?

plexus15:01:10

glad you managed to fix it. In general make sure things get loaded before Kaocha kicks in, we try to override clojure.test/report at the last possible moment (and after all tests are loaded) to prevent this kind of issue.