kaocha

jyn 2025-09-25T14:23:08.469649Z

Is there a way to hook into kaocha's live reloads? I'm writing a snapshot test library and I want to have a global atom that gets reset on each reload of the caller, not just the reload of the library itself

jyn 2025-09-26T14:09:36.841329Z

update: this worked great 🙂 i wrote a pre-run hook and it worked like a charm

🎉 1
2025-09-26T14:20:17.644639Z

hell yeah, that's so cool

2025-09-25T14:25:48.935709Z

can you do that with kaocha hooks?

2025-09-25T14:28:58.950849Z

at a previous job (2 years ago now), i wrote a https://cljdoc.org/d/lambdaisland/kaocha/1.91.1392/doc/9-extending#plugins that modified the suites. i remember that it worked even through --watch reloads, so you should be able to do similar

2025-09-25T14:29:52.491329Z

yeah, https://cljdoc.org/d/lambdaisland/kaocha/1.91.1392/doc/9-extending#tips-for-developing-plugins specifically using --watch to develop your plugin, so you should be able to do whatever you want in there

jyn 2025-09-25T14:29:58.044199Z

ooo https://cljdoc.org/d/lambdaisland/kaocha/1.91.1392/doc/10-hooks#suite-level-hooks looks very promising

jyn 2025-09-25T14:30:02.219019Z

thank you!

2025-09-25T14:30:30.723549Z

yeah it's really powerful, it's the thing i miss the most in the test framework i wrote lol

2025-09-25T14:30:36.604209Z

glad to help

imre 2025-09-25T17:19:44.888599Z

(I'm still secretly hoping kaocha and lazytest can be consolidated)

👍 1
monkey sees 2025-09-25T20:51:49.820509Z

How do I pass custom-report function for kaocha-cloverage? I'm getting a FileNotFoundException exception when trying to pass a function symbol. I'm sharing my config in the thread. UPD: the issue is resolved.

monkey sees 2025-09-25T20:52:53.118429Z

tests.edn

#kaocha/v1
{:plugins [:kaocha.plugin/cloverage]
 :cloverage/opts
 {:ns-exclude-regex [],
  :text? false,
  :lcov? false,
  :high-watermark 80,
  :fail-threshold 0,
  :output "target/coverage",
  :low-watermark 50,
  :ns-regex [],
  :summary? true,
  :coveralls? false,
  :emma-xml? false,
  :html? true,
  :nop? false,
  :codecov? false,
  :custom-report 'myusername.mynewapp/custom-report}}

monkey sees 2025-09-25T20:53:19.518889Z

The error I get:

Execution error (FileNotFoundException) at cloverage.coverage/resolve-var (coverage.clj:189).
Could not locate 'myusername/mynewapp__init.class, 'myusername/mynewapp.clj or 'myusername/mynewapp.cljc on classpath.

monkey sees 2025-09-25T20:54:09.726119Z

But I'm able to use this function when running cloverage directly:

clj -Sdeps '{:deps {cloverage {:mvn/version "RELEASE"}}}' -m cloverage.coverage -p src --custom-report myusername.mynewapp/custom-report

monkey sees 2025-09-25T21:03:06.769689Z

Nevermind, my mistake was in quoting the function symbol in edn. Passing :custom-report myusername.mynewapp/custom-report works fine.

monkey sees 2025-09-25T21:03:12.730199Z

Can't believe I spent a couple hours trying to understand it before posting here. Anyway leaving the thread for posterity, in case someone will stumble upon the same thing.