Fork me on GitHub
Aleh Atsman17:11:57

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?

Jivago Alves18:11:19

Hey @U4N27TADS, we use 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 for clojure.test/report. I’d recommend taking a look at it.

Aleh Atsman18:11:11

Hey thx for reply, I played around and extended report function next way:

(defmethod report :fail [m]
    (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)))))

Aleh Atsman18:11:50

It solved my problem