As mentioned on Clojurians neither of these is currently there. But as always Kaocha is flexible enough to do it yourself.
The first one is pretty easy. You can configure Kaocha to have multiple reporters, so you can add an extra reporter that only does the clear-screen.
Having a better look I’m afraid the reporter approach for clearing the screen won’t work, because we don’t have a reporter event that happens exactly once at the start. The closest we have is :kaocha/begin-suite
, but if you run a test run which contains multiple suites then that will be a problem.
But we do have a :pre-run
plugin hook, so you can either write a plugin with a pre-run hook, or use the hooks plugin and define it directly in tests.edn.
#kaocha/v1
{:plugins [:hooks]
:hooks/pre-run [(fn [test-plan] (print "\u001b[2J\u001b[H") test-plan)]}
Or if you only want it in watch mode: (when (:kaocha/watch? test-plan) (print ...))
The second part is slightly less trivial, since the way we handle stacktraces is baked into our reporters. Might be interesting to consider making that pluggable, but as things stand I think making a reporter that reimplements :summarize
is the way to go.
Note that we already split the reporters into one that handles general assertions, and one that handles :summarize
. So for instance the dots
reporter consists of dots*
and result
. You only need to replace result
.
(defn my-result [m]
(when (= :summarize (:type m))
,,,copy-and-modify whatever you need from kaocha.report/result,,,
))
#kaocha/v1
{:reporter [kaocha.report/dots* my.kaocha.stuff/my-result]}
I hope that makes sense! Good luck and let me know if you get stuck!