This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-14
Channels
- # announcements (7)
- # babashka (13)
- # beginners (98)
- # biff (20)
- # calva (3)
- # clj-kondo (5)
- # clj-otel (6)
- # cljs-dev (96)
- # clojure (22)
- # clojure-austin (30)
- # clojure-conj (4)
- # clojure-europe (53)
- # clojure-nl (2)
- # clojure-norway (63)
- # clojure-uk (3)
- # clojurescript (18)
- # cursive (10)
- # data-science (11)
- # datalevin (2)
- # datomic (7)
- # deps-new (1)
- # fulcro (3)
- # graphql (1)
- # gratitude (4)
- # hyperfiddle (43)
- # kaocha (4)
- # malli (15)
- # pathom (6)
- # polylith (2)
- # reagent (3)
- # reitit (2)
- # releases (6)
- # remote-jobs (1)
- # rewrite-clj (45)
- # ring (4)
- # shadow-cljs (47)
- # sql (5)
- # xtdb (8)
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?
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.
The Cloverage plugin https://github.com/lambdaisland/kaocha-cloverage/blob/e5f5697ddeaa0784d5a18448af84d87d402a71be/src/kaocha/plugin/cloverage.clj#L168, does that maybe complicate things?
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.)