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
update: this worked great 🙂 i wrote a pre-run hook and it worked like a charm
hell yeah, that's so cool
can you do that with kaocha hooks?
https://cljdoc.org/d/lambdaisland/kaocha/1.91.1392/doc/10-hooks
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
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
ooo https://cljdoc.org/d/lambdaisland/kaocha/1.91.1392/doc/10-hooks#suite-level-hooks looks very promising
thank you!
yeah it's really powerful, it's the thing i miss the most in the test framework i wrote lol
glad to help
(I'm still secretly hoping kaocha and lazytest can be consolidated)
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.
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}}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.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-reportNevermind, my mistake was in quoting the function symbol in edn. Passing :custom-report myusername.mynewapp/custom-report works fine.
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.