clojuretest.checkclojure.test

How to suppress/capture the output of defspec for use in clojure.test?


I've been a fan of test.check since the beginning. However, I've never found a convenient way to capture the output when using defspec. When used with clojure.test, one gets output that looks like:

Testing tst.tupelo.y64 
{:result true, :num-tests 999, :seed 1722976402694, :time-elapsed-ms 53, :test-var "dospec-line-53"} 
{:result true, :num-tests 999, :seed 1722976402747, :time-elapsed-ms 36, :test-var "dospec-line-44"}

somewhat polluting the unit test output. How can one capture and/or suppress this output?


Solution

  • OK, I found the answer. Just add the following to the top of each unit test file:

    (alter-var-root (var tst/*report-completion*) (constantly false))