|
138 | 138 | (deftest handling-of-tests-with-throwing-fixtures
|
139 | 139 | (require 'cider.nrepl.middleware.test-with-throwing-fixtures)
|
140 | 140 | (testing "If a given deftest's fixture throw an exception, those are gracefully handled"
|
141 |
| - (let [{{{[{:keys [error]}] :cider.nrepl.middleware.test/unknown} :cider.nrepl.middleware.test-with-throwing-fixtures} :results |
142 |
| - :keys [summary status] |
143 |
| - :as test-result} |
144 |
| - (session/message {:op "test" |
145 |
| - :ns "cider.nrepl.middleware.test-with-throwing-fixtures"})] |
146 |
| - (testing (pr-str test-result) |
147 |
| - (is (= error |
148 |
| - "clojure.lang.ExceptionInfo: I'm an exception inside a fixture! {:data 42}")) |
149 |
| - (is (= summary |
150 |
| - {:error 1, :fail 0, :ns 1, :pass 0, :test 0, :var 0})) |
151 |
| - (is (= status #{"done"})))))) |
| 141 | + (let [orig-fn cider.nrepl.middleware.test/report-fixture-error] |
| 142 | + (with-redefs [cider.nrepl.middleware.test/report-fixture-error |
| 143 | + (fn [ns ^Throwable e] |
| 144 | + (when-not (= (:data (ex-data e)) 42) |
| 145 | + ;; Caught wrong exception here, print stacktrace to |
| 146 | + ;; assist in debugging this. |
| 147 | + (.printStackTrace e)) |
| 148 | + (orig-fn ns e))] |
| 149 | + (let [{{{[{:keys [error]}] :cider.nrepl.middleware.test/unknown} :cider.nrepl.middleware.test-with-throwing-fixtures} :results |
| 150 | + :keys [summary status] |
| 151 | + :as test-result} |
| 152 | + (session/message {:op "test" |
| 153 | + :ns "cider.nrepl.middleware.test-with-throwing-fixtures"})] |
| 154 | + (testing (pr-str test-result) |
| 155 | + (is (= "clojure.lang.ExceptionInfo: I'm an exception inside a fixture! {:data 42}" |
| 156 | + error)) |
| 157 | + (is (= {:error 1, :fail 0, :ns 1, :pass 0, :test 0, :var 0} |
| 158 | + summary)) |
| 159 | + (is (= #{"done"} status)))))))) |
152 | 160 |
|
153 | 161 | (deftest run-test-with-map-as-documentation-message
|
154 | 162 | (testing "documentation message map is returned as string"
|
|
0 commit comments