Fork me on GitHub
#kaocha
<
2023-02-14
>
Matt Ielusic21:02:35

I have a plugin that adds shared Cloverage configuration to the config map. How can I ensure that its config hook runs before Cloverage’s, so that the plugin config overrides the Cloverage defaults but not the contents of tests.edn?

Matt Ielusic00:02:32

What’s weird is that I think my plugin is being run twice… once with the plugins run in the order they’re declared in the config — this generates the config that --print-config returns — and then a second time, where somehow the Cloverage plugin’s config hook is always running before my plugin’s config hook.

Matt Ielusic16:02:25

I solved the problem. For posterity: the main hook was complicating things: for some reason, the configuration is generated twice. The config hooks do run before the tests are loaded; once the tests are loaded, that configuration is discarded, all the main hooks are run, and then the config hooks are run a second time. I had to add a main hook to my plugin so it could set default Cloverage options, before Cloverage’s main hook could run and set its own default options. (Aside: this means that the configuration output by kaocha --print-config is not necessarily the configuration that gets loaded when actually running Kaocha.)