kaocha

Matt Ielusic 2023-02-14T21:22:35.511309Z

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 Ielusic 2023-02-15T00:09:32.443509Z

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 Ielusic 2023-02-15T00:25:51.402919Z

The Cloverage plugin https://github.com/lambdaisland/kaocha-cloverage/blob/e5f5697ddeaa0784d5a18448af84d87d402a71be/src/kaocha/plugin/cloverage.clj#L168, does that maybe complicate things?

Matt Ielusic 2023-02-17T16:44:25.786379Z

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.)