This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-26
Channels
- # announcements (17)
- # babashka (68)
- # beginners (8)
- # biff (14)
- # calva (25)
- # cherry (10)
- # clj-kondo (1)
- # clj-on-windows (12)
- # cljsrn (6)
- # clojure (134)
- # clojure-berlin (1)
- # clojure-europe (33)
- # clojure-nl (4)
- # clojure-norway (6)
- # clojure-uk (10)
- # clojurescript (9)
- # datalevin (8)
- # datomic (34)
- # docker (1)
- # emacs (31)
- # fulcro (6)
- # honeysql (8)
- # java (7)
- # joyride (14)
- # kaocha (7)
- # malli (11)
- # nbb (4)
- # off-topic (11)
- # pedestal (14)
- # rdf (53)
- # re-frame (6)
- # reagent (39)
- # reitit (2)
- # releases (9)
- # rewrite-clj (14)
- # shadow-cljs (97)
- # specter (1)
- # testing (5)
- # tools-deps (12)
- # vim (4)
- # xtdb (9)
In clojure.test you can rebind the reporter to a regular function or a multimethod. If you rebind to a regular function you do have to make sure you do it after any code that assumes it's a multimethod. If you use kaocha you can supply multiple reporters, so you can have one that simply checks for (= (:type m) :fail)
and does nothing for other events
Thanks for the tip! Unfortunately not using Kaocha, but having multiple reporters support out of the box sounds great. Might have to explore Kaocha more 🙂
Would you rebind the reporter via binding
or something else?
you can also do some hackery to re-define the clojure.test/report
multimethod and still call to the original implementation as well
capture the old impl: https://gist.github.com/philomates/32f8e1f7a2a4e746ac0186964aaaa2d3#file-flow-clj-L12
override the original, do custom logic, and then call the original to preserve existing behavior:
https://gist.github.com/philomates/32f8e1f7a2a4e746ac0186964aaaa2d3#file-flow-clj-L32-L34