Fork me on GitHub
Alexander Kouznetsov16:04:32

I’m investigating how test results are printed in different environments and noticed that Calva outputs them differently than the default nrepl or CLI. We also have our own test message printing overrides which work in repl but don’t in Calva:

(.. ^clojure.lang.MultiFn clojure.test/report
      (addMethod :fail report-fail)
      (addMethod :error report-error))
Here is a test case:
(deftest is=-test
  (is (= {:a "a" :b "b" :c "c"}
         {:d "d" :b "b" :c "c"})))
Output in Calva:
; FAIL in calva-test/is=-test (calva_test.clj:350):
; expected:
{:a "a", :b "b", :c "c"}

; actual:
{:d "d", :b "b", :c "c"}
Output in nrepl without overrides:
FAIL in (is=-test) (calva_test.clj:350)
expected: (= {:a "a", :b "b", :c "c"} {:d "d", :b "b", :c "c"})
  actual: (not (= {:a "a", :b "b", :c "c"} {:d "d", :b "b", :c "c"}))
How can I disable calva custom test output (basically to see the same output as in the last snippet, and possibly make our overrides shown in the first snippet work with calva)?


You could make yourself some Custom REPL snippets that run tests for you, instead of using Calva’s commands for it. Running something like (clojure.test/run-tests) should give you the same output in Calva’s REPL as with any REPL.

🙌 2