This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (4)
- # babashka (2)
- # beginners (8)
- # calva (2)
- # chlorine-clover (7)
- # cider (3)
- # clj-kondo (1)
- # cljs-dev (2)
- # clojure (21)
- # clojure-dev (2)
- # clojure-europe (5)
- # clojure-spec (17)
- # clojuredesign-podcast (7)
- # clojurescript (8)
- # conjure (4)
- # cursive (3)
- # datomic (1)
- # defnpodcast (5)
- # esprit (51)
- # fulcro (7)
- # jobs (1)
- # luminus (3)
- # news-and-articles (1)
- # off-topic (2)
- # other-lisps (3)
- # pathom (8)
- # portal (3)
- # re-frame (3)
- # re-ops (1)
- # shadow-cljs (26)
- # testing (15)
- # tools-deps (34)
- # xtdb (1)
Hello, which tool will you recommend to see the diff in test assertions when they fail?
Paul Stadig's Humane Test Output is fairly good for that (although there are some caveats around using it with Leiningen, since both tools try to modify the test reporting machinery -- so check the docs).
Is it possible to integrate it with clojure cli? I'm not familiar with lein :injections, it seems like you have to call the
(pjstadig.humane-test-output/activate!) in every test namespace?
No, you only need to call that once, so you can use a
:main-opts in your alias to do that.
(if you use
expectations/clojure-test it does that automatically for you, but I assume you're working with
clojure.test and Cognitect's
My approach is invoking https://github.com/lambdaisland/deep-diff2 or its predecessor, by hand, whenever I need it I'd understand the natural instict to automate this altogether but I don't think it has been accomplished in a clean and universal manner yet. IME, one truly wants a diff 1-3% of the time (which is still a lot!) so it's not particularly worth it to automate much.
@vemv I agree to some extent. I do find that HTO makes some failures harder to read, but overall it makes many failures a lot better.
@seancorfield I'm using clojure.test and running the test using intellij plugin cursive, it has a command to run the current deftest.
that diff is only available if the test failure follows a certain format. eg. it expects
(is (= ... in the failure output. https://github.com/clojure-expectations/clojure-test prints
(is (?= ... and that won't be recognized, so you won't see the Show diff... link
:thinking_face: For this test failure, I think it should show the "show diff link" right?
@jaime.sangcap I was just about to say: I thought Cursive already did that for you? Maybe ask in #cursive ?
(I use Atom/Chlorine and I can run a single
deftest too but rely on the REPL output window)