Question

Trying to get Timbre to load in my test project along with clojure.test. My first attempt is

(ns foo.core-test
  (:require [clojure.test :refer :all]
            [taoensso.timbre :as timbre]
            [foo.core :refer :all]))

which compiles until I follow the next step in the Timbre documentation, adding

(timbre/refer-timbre) ; Provides useful Timbre aliases in this ns

I now get the following compile error

IllegalStateException report already refers to #'clojure.test/report in namespace foo.core-test
clojure.lang.Namespace.warnOrFailOnReplace (Namespace.java:88)

ok, groovy, I'll try

(ns foo.core-test ; ------vvvvvvvvvvvvvvvv-----
  (:require [clojure.test :exclude [report]]
            [taoensso.timbre :as timbre]
            [foo.core :refer :all]))

mmmm, nope. I notice that clojure has a report, too. How about

(ns foo.core-test
  (:refer-clojure :exclude [report])
  (:require [clojure.test :refer :all]
            [taoensso.timbre :as timbre]
            [foo.core :refer :all]))

mmmmm, nope.

I hacked around for a while till I got tired of combinatorial trial-and-error. I haven't found a way to make them coexist. Any clues, please & thanks?

Was it helpful?

Solution

There's no report in clojure.core. In your second ns form you seem to be missing :refer :all for clojure.test. Try the following form:

(ns foo.core-test
  (:require [clojure.test :refer :all :exclude [report]]
            [taoensso.timbre :as timbre]
            [foo.core :refer :all]))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top