diff --git a/src/clojure/lazytest/config.clj b/src/clojure/lazytest/config.clj index 1e9eb69..559d60f 100644 --- a/src/clojure/lazytest/config.clj +++ b/src/clojure/lazytest/config.clj @@ -33,7 +33,7 @@ (if (:lazytest.runner/depth config) config (let [reporter (resolve-reporter - (or (:reporter config) 'lazytest.reporters/nested))] + (or (:output config) 'lazytest.reporters/nested))] (-> config (assoc :lazytest.runner/depth 1) (assoc :lazytest.runner/suite-history []) diff --git a/src/clojure/lazytest/main.clj b/src/clojure/lazytest/main.clj index b9fdc4d..639e75f 100644 --- a/src/clojure/lazytest/main.clj +++ b/src/clojure/lazytest/main.clj @@ -47,8 +47,7 @@ nses)) (defn run-impl [{:keys [dir output] :as config}] - (let [output (or (not-empty output) ['lazytest.reporters/nested]) - config (->config (assoc config :output output :reporter output)) + (let [config (->config (assoc config :output (not-empty output))) nses (require-dirs config dir)] (run-tests nses config))) diff --git a/src/clojure/lazytest/repl.clj b/src/clojure/lazytest/repl.clj index 4d5007e..c475501 100644 --- a/src/clojure/lazytest/repl.clj +++ b/src/clojure/lazytest/repl.clj @@ -6,10 +6,11 @@ [lazytest.runner :as runner])) (def repl-config - {:reporter [r/focused r/results r/summary]}) + {:output [r/focused r/results r/summary]}) (defn run-tests "Runs tests defined in the given namespaces." + {:arglists '([namespaces] [namespaces {:keys [output] :as config}])} ([namespaces] (run-tests namespaces repl-config)) ([namespaces config] (if (sequential? namespaces) @@ -18,11 +19,14 @@ (defn run-all-tests "Run tests defined in all namespaces." + {:arglists '([] [{:keys [output] :as config}])} ([] (run-all-tests repl-config)) ([config] (summarize (runner/run-all-tests (->config config))))) (defn run-test-var + "Run test var." + {:arglists '([var] [var {:keys [output] :as config}])} ([v] (run-test-var v repl-config)) ([v config] (summarize (runner/run-test-var v (->config config))))) diff --git a/src/clojure/lazytest/runner.clj b/src/clojure/lazytest/runner.clj index cab6652..a82efe5 100644 --- a/src/clojure/lazytest/runner.clj +++ b/src/clojure/lazytest/runner.clj @@ -5,7 +5,7 @@ run-afters run-before-eachs run-befores]] [lazytest.filter :refer [filter-tree]] [lazytest.find :refer [find-suite find-var-test-value]] - [lazytest.reporters :as r :refer [nested report]] + [lazytest.reporters :as r :refer [report]] [lazytest.suite :as s :refer [suite suite-result suite?]] [lazytest.test-case :refer [try-test-case]])) @@ -109,7 +109,7 @@ (defn run-tests "Runs tests defined in the given namespaces. Applies filters in config." - ([namespaces] (run-tests namespaces (->config {:reporter nested}))) + ([namespaces] (run-tests namespaces (->config nil))) ([namespaces config] (-> (apply find-suite namespaces) (filter-and-run config)))) diff --git a/test/clojure/lazytest/libs_test.clj b/test/clojure/lazytest/libs_test.clj index 46c94ac..b61e41c 100644 --- a/test/clojure/lazytest/libs_test.clj +++ b/test/clojure/lazytest/libs_test.clj @@ -29,4 +29,4 @@ (match? {:total 80 :pass 80 :fail 0} (summarize (lr/run-tests [(the-ns honeysql-ns)] - (->config {:reporter ['lazytest.reporters/quiet]}))))))))) + (->config {:output ['lazytest.reporters/quiet]}))))))))) diff --git a/test/clojure/lazytest/reporters_test.clj b/test/clojure/lazytest/reporters_test.clj index 79e7950..c22ae19 100644 --- a/test/clojure/lazytest/reporters_test.clj +++ b/test/clojure/lazytest/reporters_test.clj @@ -35,7 +35,7 @@ (defn ->passing [& {:as extra}] (-> (tc/test-case {:doc "example test-case" :body (fn [] true)}) - (runner/run-tree (->config {:reporter [(constantly nil)]})) + (runner/run-tree (->config {:output [(constantly nil)]})) (merge extra))) (defn ->failing [& {:as extra}] @@ -43,7 +43,7 @@ :body (fn [] (expect (= 1 2) (if (contains? extra :message) (:message extra) "failing")))}) - (runner/run-tree (->config {:reporter [(constantly nil)]})) + (runner/run-tree (->config {:output [(constantly nil)]})) (assoc :file "example.clj") (assoc :line 1) (merge (dissoc extra :message)))) @@ -55,7 +55,7 @@ :line 1})] (-> (tc/test-case {:doc "example test-case" :body (fn [] (throw thrown))}) - (runner/run-tree (->config {:reporter [(constantly nil)]}))))) + (runner/run-tree (->config {:output [(constantly nil)]}))))) (defn stub-stack-trace [_ex] @@ -348,7 +348,7 @@ (suite {:type :lazytest/ns :nses [*ns*] :children [test-suite]}) - (->config {:reporter (constantly nil)})) + (->config {:output (constantly nil)})) suite-results (assoc test-suite :type :end-test-run :results results)] (expect (match? (re-compile "Top 1 slowest test namespaces.*Top 1 slowest test vars" :dotall) (-> (sut/profile nil suite-results) @@ -361,10 +361,10 @@ (it "uses the var if given no doc string" (expect (= " defdescribe-no-doc\n √ works\n\n" (-> (runner/run-test-var #'defdescribe-no-doc - (->config {:reporter sut/nested*})) + (->config {:output sut/nested*})) (with-out-str-no-color))))) (it "uses the doc string when available" (expect (= " cool docs\n √ works\n\n" (-> (runner/run-test-var #'defdescribe-with-doc - (->config {:reporter sut/nested*})) + (->config {:output sut/nested*})) (with-out-str-no-color)))))) diff --git a/test/clojure/lazytest/runner_test.clj b/test/clojure/lazytest/runner_test.clj index 40edb9f..fbfa8c6 100644 --- a/test/clojure/lazytest/runner_test.clj +++ b/test/clojure/lazytest/runner_test.clj @@ -20,7 +20,7 @@ "" ""]) (-> (sut/run-test-suite test-suite - (->config {:reporter reporters/nested*})) + (->config {:output reporters/nested*})) (with-out-str-no-color))))))) (defdescribe run-test-var-test @@ -32,5 +32,5 @@ "" ""]) (-> (sut/run-test-var #'run-test-suite-test - (->config {:reporter reporters/nested*})) + (->config {:output reporters/nested*})) (with-out-str-no-color))))))