# Kaocha - Clearer reporting

**URL:** https://clojureverse.org/t/kaocha-clearer-reporting/5761
**Category:** Kaocha
**Created:** [April 10, 2020, 12:52pm UTC](https://clojureverse.org/t/kaocha-clearer-reporting/5761 "2020-04-10T12:52:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![grierson](https://clojureverse.org/user_avatar/clojureverse.org/grierson/32/857_2.png) [@grierson](https://clojureverse.org/u/grierson)
#### Post date: [April 10, 2020, 12:52pm UTC](https://clojureverse.org/t/kaocha-clearer-reporting/5761/1 "2020-04-10T12:52:31Z")

</div>

Are there any options/reporters that…

1. Clear output before tests run in --watch mode?  
1.1 So that old outputs don’t interfere with the latest output
2. Use [aviso/pretty](https://github.com/AvisoNovate/pretty) with Kaocha? For pretty stacktraces?  
2.1 Clear, shorter stacktraces so that I don’t have to keep scrolling up to see the exception

---

<div class="post-metadata">

### Author: ![plexus](https://clojureverse.org/user_avatar/clojureverse.org/plexus/32/6_2.png) [@plexus](https://clojureverse.org/u/plexus)
#### Post date: [April 11, 2020, 8:16am UTC](https://clojureverse.org/t/kaocha-clearer-reporting/5761/2 "2020-04-11T08:16:45Z")

</div>

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.

```auto
#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`.

```auto
(defn my-result [m]
  (when (= :summarize (:type m))
  ,,,copy-and-modify whatever you need from kaocha.report/result,,,
  ))

```

```auto
#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!

---

<div class="post-metadata">

### Author: ![mardukbp](https://clojureverse.org/user_avatar/clojureverse.org/mardukbp/32/4403_2.png) [@mardukbp](https://clojureverse.org/u/mardukbp)
#### Post date: [August 22, 2025, 8:23pm UTC](https://clojureverse.org/t/kaocha-clearer-reporting/5761/3 "2025-08-22T20:23:13Z")

</div>

With the current versions of kaocha (1.91.1392) and pretty (3.6.3) getting colorized stack traces is as simple as creating the following file in your project:

kaocha/stacktrace.clj

```clojure
(ns kaocha.stacktrace
  (:require [clj-commons.pretty.repl :as pretty]))

(defn print-cause-trace
  "Like print-stack-trace but prints chained exceptions (causes)."
  ([tr]
   (pretty/pretty-print-stack-trace tr))
  ([tr n]
   (pretty/pretty-print-stack-trace tr n)))

```
