Skip to content

Commit c178ed0

Browse files
committed
change mute-zero-assertions to warnings
1 parent 87a30e8 commit c178ed0

File tree

6 files changed

+8
-13
lines changed

6 files changed

+8
-13
lines changed

doc/03_configuration.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Here's an example test configuration with a single test suite:
2020
:kaocha/source-paths ["src"]
2121
:kaocha/test-paths ["test/unit"]}]
2222
:kaocha/fail-fast? false
23-
:kaocha/mute-zero-assertion? true
2423
:kaocha/color? true
2524
:kaocha/reporter [kaocha.report/dots]
2625
:kaocha/plugins [:kaocha.plugin/randomize

doc/clojure_test/assertions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ Test ran without assertions. Did you forget an (is ...)?
3636

3737
There are two ways to disable this detection:
3838

39-
* Enable `:mute-zero-assertion?` at `tests.edn`.
40-
* Use `--mute-zero-assertion` in command line argument.
41-
39+
* Add `:kaocha/warnings {:zero-assertions :silent}` into `tests.edn`.
4240

4341
## Detecting single argument `=`
4442

src/kaocha/api.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
(let [config (plugin/run-hook :kaocha.hooks/config config)
9393
color? (:kaocha/color? config)
9494
fail-fast? (:kaocha/fail-fast? config)
95-
mute-zero-assertion? (:kaocha/mute-zero-assertion? config)
95+
warnings (:kaocha/warnings config)
9696
history (atom [])]
9797
(binding [*active?* true
9898
testable/*fail-fast?* fail-fast?
@@ -103,7 +103,7 @@
103103
(let [config (resolve-reporter config)]
104104
(let [test-plan (test-plan config)]
105105

106-
(when mute-zero-assertion?
106+
(when (= (:zero-assertions warnings) :silent)
107107
(hierarchy/underive! :kaocha.type.var/zero-assertions :kaocha/known-key)
108108
(hierarchy/underive! :kaocha.type.var/zero-assertions :kaocha/fail-type))
109109

src/kaocha/config.clj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
reporter
7979
color?
8080
fail-fast?
81-
mute-zero-assertion?
81+
warnings
8282
diff-style
8383
randomize?
8484
capture-output?
@@ -89,15 +89,15 @@
8989
tests (assoc :kaocha/tests (vary-meta tests assoc :replace true))
9090
plugins (assoc :kaocha/plugins plugins)
9191
reporter (assoc :kaocha/reporter (vary-meta reporter assoc :replace true))
92+
warnings (assoc :kaocha/warnings warnings)
9293
bindings (assoc :kaocha/bindings bindings)
9394
(some? color?) (assoc :kaocha/color? color?)
9495
(some? fail-fast?) (assoc :kaocha/fail-fast? fail-fast?)
95-
(some? mute-zero-assertion?) (assoc :kaocha/mute-zero-assertion? mute-zero-assertion?)
9696
(some? diff-style) (assoc :kaocha/diff-style diff-style)
9797
(some? watch?) (assoc :kaocha/watch? watch?)
9898
(some? randomize?) (assoc :kaocha.plugin.randomize/randomize? randomize?)
9999
(some? capture-output?) (assoc :kaocha.plugin.capture-output/capture-output? capture-output?)
100-
:-> (merge (dissoc config :tests :plugins :reporter :color? :fail-fast? :mute-zero-assertion? :watch? :randomize?)))))
100+
:-> (merge (dissoc config :tests :plugins :reporter :warnings :color? :fail-fast? :watch? :randomize?)))))
101101

102102
(defmethod aero/reader 'kaocha [_opts _tag value]
103103
(output/warn (format "The #kaocha reader literal is deprecated, please change it to %s." current-reader))
@@ -200,7 +200,6 @@
200200
(defn apply-cli-opts [config options]
201201
(cond-> config
202202
(some? (:fail-fast options)) (assoc :kaocha/fail-fast? (:fail-fast options))
203-
(some? (:mute-zero-assertion options)) (assoc :kaocha/mute-zero-assertion? (:mute-zero-assertion options))
204203
(:reporter options) (assoc :kaocha/reporter (:reporter options))
205204
(:watch options) (assoc :kaocha/watch? (:watch options))
206205
(some? (:color options)) (assoc :kaocha/color? (:color options))

src/kaocha/runner.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
[nil "--print-test-plan" "Load tests, build up a test plan, then print out the test plan and exit."]
3333
[nil "--print-result" "Print the test result map as returned by the Kaocha API."]
3434
[nil "--[no-]fail-fast" "Stop testing after the first failure."]
35-
[nil "--[no-]mute-zero-assertion" "Stop raising failure when there is no assertion in test."]
3635
[nil "--[no-]color" "Enable/disable ANSI color codes in output. Defaults to true."]
3736
[nil "--[no-]watch" "Watch filesystem for changes and re-run tests."]
3837
[nil "--reporter SYMBOL" "Change the test reporter, can be specified multiple times."

src/kaocha/specs.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
(spec/def :kaocha/fail-fast? boolean?)
2424

25-
(spec/def :kaocha/mute-zero-assertion? boolean?)
25+
(spec/def :kaocha/warnings (spec/map-of #{:zero-assertions} #{:silent :error}))
2626

2727
(spec/def :kaocha/watch? boolean?)
2828

@@ -36,7 +36,7 @@
3636
(spec/keys :opt [:kaocha/reporter
3737
:kaocha/color?
3838
:kaocha/fail-fast?
39-
:kaocha/mute-zero-assertion?
39+
:kaocha/warnings
4040
:kaocha/watch?
4141
:kaocha/plugins]))
4242

0 commit comments

Comments
 (0)