Hey! Does anyone know a way to expect standard diff function of clojure.test/is
macro with lambdaisland.deep-diff2
in order to be able to do nice diffing and quickly see what is wrong?
Hey @aleh_atsman, we use https://github.com/weavejester/eftest at our projects. It provides a decent pretty diff. I’m not sure but by looking at its code, it looks like eftest
defines a custom https://github.com/weavejester/eftest/blob/master/eftest/src/eftest/runner.clj#L211 for clojure.test/report
. I’d recommend taking a look at it.
Hey thx for reply, I played around and extended report
function next way:
(defmethod report :fail [m]
(with-test-out
(inc-report-counter :fail)
(println "\nFAIL in" (testing-vars-str m))
(when (seq *testing-contexts*) (println (testing-contexts-str)))
(when-let [message (:message m)] (println message))
;(println "expected:" (pr-str (:expected m)))
;(println " actual:" (pr-str (:actual m)))
(let [[expected actual] (as-> m m
(m :actual)
(nth m 1)
(vec m)
(drop 1 m))]
(ddiff/pretty-print (ddiff/diff expected actual)))))
It solved my problem
cool!