mardi 4 juin 2019

How do I deactivate logs in a Clojure test?

Question

I would like to black hole print like behaviors within my test bodies in order to keep my log output looking clean and tidy.

(deftest some-test
   (testing "something"
      (logless 
         (is (= 22 (test-thing 14))))))

I expect test-thing to call println and other similar calls to *out* and would like those to stop polluting my test output.

Is there a recognized way to do this in general?

I found this guy (with-out-str) but it's capturing the string, not quite what I'm looking for.

Background

I'm fairly new to Clojure, coming largely from a javascript world. Having a blast so far! But there's lots left for me to learn.

In Clojure, not Clojure.script (if it matters)

Aucun commentaire:

Enregistrer un commentaire