Fork me on GitHub
#kaocha
<
2021-09-20
>
imre16:09:01

One more question, apologies if this is also covered in the docs but I couldn't find it. I'm looking to create a plugin that adds some default configuration that are common to projects our team works on, including some common plugins. I tried doing this in the config hook by updating the :kaocha/plugins value but the plugins inserted this way don't seem to be initialized. Is this doable some way?

Alys Brooks23:09:48

It's kind of circular problem—you want your plugin to happen before initialization so the plugins it adds are initialized but if your plugin isn't initialized it can't do anything, so you want it to happen after initialization as well.

Alys Brooks23:09:41

Since we use https://cljdoc.org/d/aero/aero/1.1.6/doc/readme to process tests.edn you could use its #include to include a default config you share across all projects. You might also be able to create your own reader literal like we did for #kaocha/v1 (https://github.com/lambdaisland/kaocha/blob/a401d2a41ebf2440bc61c83ad782fcdeaaa3fe93/src/kaocha/config.clj#L97). The tricky thing is that I'm pretty sure your reader literal would have to be loaded by Clojure prior to it starting Kaocha and loading the configuration. So you might need a custom runner function. Using #include seems like the easier and more reliable way.