File tree Expand file tree Collapse file tree 5 files changed +18
-3
lines changed Expand file tree Collapse file tree 5 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ Here's an example test configuration with a single test suite:
20
20
:kaocha/source-paths [" src" ]
21
21
:kaocha/test-paths [" test/unit" ]}]
22
22
:kaocha/fail-fast? false
23
+ :kaocha/mute-zero-assertion? true
23
24
:kaocha/color? true
24
25
:kaocha/reporter [kaocha.report/dots]
25
26
:kaocha/plugins [:kaocha.plugin/randomize
Original file line number Diff line number Diff line change 92
92
(let [config (plugin/run-hook :kaocha.hooks/config config)
93
93
color? (:kaocha/color? config)
94
94
fail-fast? (:kaocha/fail-fast? config)
95
+ mute-zero-assertion? (:kaocha/mute-zero-assertion? config)
95
96
history (atom [])]
96
97
(binding [*active?* true
97
98
testable/*fail-fast?* fail-fast?
102
103
(let [config (resolve-reporter config)]
103
104
(let [test-plan (test-plan config)]
104
105
106
+ (when mute-zero-assertion?
107
+ (hierarchy/underive! :kaocha.type.var/zero-assertions :kaocha/known-key )
108
+ (hierarchy/underive! :kaocha.type.var/zero-assertions :kaocha/fail-type ))
109
+
105
110
(when-not (some #(or (hierarchy/leaf? %)
106
111
(::testable/load-error %))
107
112
(testable/test-seq test-plan))
112
117
(count (testable/test-seq-with-skipped test-plan))))
113
118
(output/warn (str " No tests were found. This may be an issue in your Kaocha test configuration."
114
119
" To investigate, check the :test-paths and :ns-patterns keys in tests.edn." )))
115
- (throw+ {:kaocha/early-exit 0 }))
120
+ (throw+ {:kaocha/early-exit 0 }))
116
121
117
122
(when (find-ns 'matcher-combinators.core)
118
123
(require 'kaocha.matcher-combinators))
129
134
; ; been interrupted, output capturing may
130
135
; ; still be in effect.
131
136
(System/setOut
132
- orig-out)
137
+ orig-out)
133
138
(binding [history/*history* history]
134
139
(t/do-report (history/clojure-test-summary )))
135
140
(catch Throwable t
Original file line number Diff line number Diff line change 78
78
reporter
79
79
color?
80
80
fail-fast?
81
+ mute-zero-assertion?
81
82
diff-style
82
83
randomize?
83
84
capture-output?
91
92
bindings (assoc :kaocha/bindings bindings)
92
93
(some? color?) (assoc :kaocha/color? color?)
93
94
(some? fail-fast?) (assoc :kaocha/fail-fast? fail-fast?)
95
+ (some? mute-zero-assertion?) (assoc :kaocha/mute-zero-assertion? mute-zero-assertion?)
94
96
(some? diff-style) (assoc :kaocha/diff-style diff-style)
95
97
(some? watch?) (assoc :kaocha/watch? watch?)
96
98
(some? randomize?) (assoc :kaocha.plugin.randomize/randomize? randomize?)
97
99
(some? capture-output?) (assoc :kaocha.plugin.capture-output/capture-output? capture-output?)
98
- :-> (merge (dissoc config :tests :plugins :reporter :color? :fail-fast? :watch? :randomize? )))))
100
+ :-> (merge (dissoc config :tests :plugins :reporter :color? :fail-fast? :mute-zero-assertion? : watch? :randomize? )))))
99
101
100
102
(defmethod aero /reader 'kaocha [_opts _tag value]
101
103
(output/warn (format " The #kaocha reader literal is deprecated, please change it to %s." current-reader))
198
200
(defn apply-cli-opts [config options]
199
201
(cond-> config
200
202
(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))
201
204
(:reporter options) (assoc :kaocha/reporter (:reporter options))
202
205
(:watch options) (assoc :kaocha/watch? (:watch options))
203
206
(some? (:color options)) (assoc :kaocha/color? (:color options))
Original file line number Diff line number Diff line change 8
8
[tag parent]
9
9
(alter-var-root #'hierarchy derive tag parent))
10
10
11
+ (defn underive!
12
+ " Add a parent/child relationship to kaocha's keyword hierarchy."
13
+ [tag parent]
14
+ (alter-var-root #'hierarchy underive tag parent))
15
+
11
16
(derive! :fail :kaocha/fail-type )
12
17
(derive! :error :kaocha/fail-type )
13
18
Original file line number Diff line number Diff line change 32
32
[nil " --print-test-plan" " Load tests, build up a test plan, then print out the test plan and exit." ]
33
33
[nil " --print-result" " Print the test result map as returned by the Kaocha API." ]
34
34
[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." ]
35
36
[nil " --[no-]color" " Enable/disable ANSI color codes in output. Defaults to true." ]
36
37
[nil " --[no-]watch" " Watch filesystem for changes and re-run tests." ]
37
38
[nil " --reporter SYMBOL" " Change the test reporter, can be specified multiple times."
You can’t perform that action at this time.
0 commit comments