diff --git a/doc/03_configuration.md b/doc/03_configuration.md index d7ee88bf..fce20040 100644 --- a/doc/03_configuration.md +++ b/doc/03_configuration.md @@ -20,7 +20,6 @@ Here's an example test configuration with a single test suite: :kaocha/source-paths ["src"] :kaocha/test-paths ["test/unit"]}] :kaocha/fail-fast? false - :kaocha/mute-zero-assertion? true :kaocha/color? true :kaocha/reporter [kaocha.report/dots] :kaocha/plugins [:kaocha.plugin/randomize diff --git a/doc/clojure_test/assertions.md b/doc/clojure_test/assertions.md index 40dddcb5..a0a2671f 100644 --- a/doc/clojure_test/assertions.md +++ b/doc/clojure_test/assertions.md @@ -36,9 +36,7 @@ Test ran without assertions. Did you forget an (is ...)? There are two ways to disable this detection: -* Enable `:mute-zero-assertion?` at `tests.edn`. -* Use `--mute-zero-assertion` in command line argument. - +* Add `:kaocha/warnings {:zero-assertions :silent}` into `tests.edn`. ## Detecting single argument `=` diff --git a/src/kaocha/api.clj b/src/kaocha/api.clj index 8570da66..db8d1f26 100644 --- a/src/kaocha/api.clj +++ b/src/kaocha/api.clj @@ -92,7 +92,7 @@ (let [config (plugin/run-hook :kaocha.hooks/config config) color? (:kaocha/color? config) fail-fast? (:kaocha/fail-fast? config) - mute-zero-assertion? (:kaocha/mute-zero-assertion? config) + warnings (:kaocha/warnings config) history (atom [])] (binding [*active?* true testable/*fail-fast?* fail-fast? @@ -103,7 +103,7 @@ (let [config (resolve-reporter config)] (let [test-plan (test-plan config)] - (when mute-zero-assertion? + (when (= (:zero-assertions warnings) :silent) (hierarchy/underive! :kaocha.type.var/zero-assertions :kaocha/known-key) (hierarchy/underive! :kaocha.type.var/zero-assertions :kaocha/fail-type)) diff --git a/src/kaocha/config.clj b/src/kaocha/config.clj index 12b9201f..f55490c7 100644 --- a/src/kaocha/config.clj +++ b/src/kaocha/config.clj @@ -78,7 +78,7 @@ reporter color? fail-fast? - mute-zero-assertion? + warnings diff-style randomize? capture-output? @@ -89,15 +89,15 @@ tests (assoc :kaocha/tests (vary-meta tests assoc :replace true)) plugins (assoc :kaocha/plugins plugins) reporter (assoc :kaocha/reporter (vary-meta reporter assoc :replace true)) + warnings (assoc :kaocha/warnings warnings) bindings (assoc :kaocha/bindings bindings) (some? color?) (assoc :kaocha/color? color?) (some? fail-fast?) (assoc :kaocha/fail-fast? fail-fast?) - (some? mute-zero-assertion?) (assoc :kaocha/mute-zero-assertion? mute-zero-assertion?) (some? diff-style) (assoc :kaocha/diff-style diff-style) (some? watch?) (assoc :kaocha/watch? watch?) (some? randomize?) (assoc :kaocha.plugin.randomize/randomize? randomize?) (some? capture-output?) (assoc :kaocha.plugin.capture-output/capture-output? capture-output?) - :-> (merge (dissoc config :tests :plugins :reporter :color? :fail-fast? :mute-zero-assertion? :watch? :randomize?))))) + :-> (merge (dissoc config :tests :plugins :reporter :warnings :color? :fail-fast? :watch? :randomize?))))) (defmethod aero/reader 'kaocha [_opts _tag value] (output/warn (format "The #kaocha reader literal is deprecated, please change it to %s." current-reader)) @@ -200,7 +200,6 @@ (defn apply-cli-opts [config options] (cond-> config (some? (:fail-fast options)) (assoc :kaocha/fail-fast? (:fail-fast options)) - (some? (:mute-zero-assertion options)) (assoc :kaocha/mute-zero-assertion? (:mute-zero-assertion options)) (:reporter options) (assoc :kaocha/reporter (:reporter options)) (:watch options) (assoc :kaocha/watch? (:watch options)) (some? (:color options)) (assoc :kaocha/color? (:color options)) diff --git a/src/kaocha/runner.clj b/src/kaocha/runner.clj index 9599a524..f172ee4c 100644 --- a/src/kaocha/runner.clj +++ b/src/kaocha/runner.clj @@ -32,7 +32,6 @@ [nil "--print-test-plan" "Load tests, build up a test plan, then print out the test plan and exit."] [nil "--print-result" "Print the test result map as returned by the Kaocha API."] [nil "--[no-]fail-fast" "Stop testing after the first failure."] - [nil "--[no-]mute-zero-assertion" "Stop raising failure when there is no assertion in test."] [nil "--[no-]color" "Enable/disable ANSI color codes in output. Defaults to true."] [nil "--[no-]watch" "Watch filesystem for changes and re-run tests."] [nil "--reporter SYMBOL" "Change the test reporter, can be specified multiple times." diff --git a/src/kaocha/specs.clj b/src/kaocha/specs.clj index 669ba12b..9b2edab9 100644 --- a/src/kaocha/specs.clj +++ b/src/kaocha/specs.clj @@ -22,7 +22,7 @@ (spec/def :kaocha/fail-fast? boolean?) -(spec/def :kaocha/mute-zero-assertion? boolean?) +(spec/def :kaocha/warnings (spec/map-of #{:zero-assertions} #{:silent :error})) (spec/def :kaocha/watch? boolean?) @@ -36,7 +36,7 @@ (spec/keys :opt [:kaocha/reporter :kaocha/color? :kaocha/fail-fast? - :kaocha/mute-zero-assertion? + :kaocha/warnings :kaocha/watch? :kaocha/plugins]))