instrument all test reporters

This commit is contained in:
jem 2019-05-29 19:26:32 +02:00
parent ce093d4cbf
commit d8c3ee5573
3 changed files with 22 additions and 1 deletions

View file

@ -41,6 +41,7 @@
:test-data-spec *data-test-report-context*}))) :test-data-spec *data-test-report-context*})))
(defmethod t/report :default [m] (defmethod t/report :default [m]
(when *data-test-report-context* (write-data-test-output m))
(t/with-test-out (prn m))) (t/with-test-out (prn m)))
(defmethod t/report :pass [m] (defmethod t/report :pass [m]
@ -48,6 +49,7 @@
(t/with-test-out (t/inc-report-counter :pass))) (t/with-test-out (t/inc-report-counter :pass)))
(defmethod t/report :fail [m] (defmethod t/report :fail [m]
(when *data-test-report-context* (write-data-test-output m))
(t/with-test-out (t/with-test-out
(t/inc-report-counter :fail) (t/inc-report-counter :fail)
(println "\nFAIL in" (t/testing-vars-str m)) (println "\nFAIL in" (t/testing-vars-str m))
@ -57,6 +59,7 @@
(println " actual:" (pr-str (:actual m))))) (println " actual:" (pr-str (:actual m)))))
(defmethod t/report :error [m] (defmethod t/report :error [m]
(when *data-test-report-context* (write-data-test-output m))
(t/with-test-out (t/with-test-out
(t/inc-report-counter :error) (t/inc-report-counter :error)
(println "\nERROR in" (t/testing-vars-str m)) (println "\nERROR in" (t/testing-vars-str m))

View file

@ -17,7 +17,6 @@
(:require (:require
[clojure.test :refer :all] [clojure.test :refer :all]
[clojure.java.io :as io] [clojure.java.io :as io]
[schema.core :as s]
[data-test.loader :as sut])) [data-test.loader :as sut]))
(deftest should-read-test-data-spec (deftest should-read-test-data-spec

View file

@ -0,0 +1,19 @@
; Licensed to the Apache Software Foundation (ASF) under one
; or more contributor license agreements. See the NOTICE file
; distributed with this work for additional information
; regarding copyright ownership. The ASF licenses this file
; to you under the Apache License, Version 2.0 (the
; "License"); you may not use this file except in compliance
; with the License. You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
(ns data-test.reporter-test
(:require
[clojure.test :refer :all]
[data-test.reporter :as sut]))