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:
2020 :kaocha/source-paths [" src" ]
2121 :kaocha/test-paths [" test/unit" ]}]
2222 :kaocha/fail-fast? false
23+ :kaocha/mute-zero-assertion? true
2324 :kaocha/color? true
2425 :kaocha/reporter [kaocha.report/dots]
2526 :kaocha/plugins [:kaocha.plugin/randomize
Original file line number Diff line number Diff line change 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)
9596 history (atom [])]
9697 (binding [*active?* true
9798 testable/*fail-fast?* fail-fast?
102103 (let [config (resolve-reporter config)]
103104 (let [test-plan (test-plan config)]
104105
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+
105110 (when-not (some #(or (hierarchy/leaf? %)
106111 (::testable/load-error %))
107112 (testable/test-seq test-plan))
112117 (count (testable/test-seq-with-skipped test-plan))))
113118 (output/warn (str " No tests were found. This may be an issue in your Kaocha test configuration."
114119 " 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 }))
116121
117122 (when (find-ns 'matcher-combinators.core)
118123 (require 'kaocha.matcher-combinators))
129134 ; ; been interrupted, output capturing may
130135 ; ; still be in effect.
131136 (System/setOut
132- orig-out)
137+ orig-out)
133138 (binding [history/*history* history]
134139 (t/do-report (history/clojure-test-summary )))
135140 (catch Throwable t
Original file line number Diff line number Diff line change 7878 reporter
7979 color?
8080 fail-fast?
81+ mute-zero-assertion?
8182 diff-style
8283 randomize?
8384 capture-output?
9192 bindings (assoc :kaocha/bindings bindings)
9293 (some? color?) (assoc :kaocha/color? color?)
9394 (some? fail-fast?) (assoc :kaocha/fail-fast? fail-fast?)
95+ (some? mute-zero-assertion?) (assoc :kaocha/mute-zero-assertion? mute-zero-assertion?)
9496 (some? diff-style) (assoc :kaocha/diff-style diff-style)
9597 (some? watch?) (assoc :kaocha/watch? watch?)
9698 (some? randomize?) (assoc :kaocha.plugin.randomize/randomize? randomize?)
9799 (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? )))))
99101
100102(defmethod aero /reader 'kaocha [_opts _tag value]
101103 (output/warn (format " The #kaocha reader literal is deprecated, please change it to %s." current-reader))
198200(defn apply-cli-opts [config options]
199201 (cond-> config
200202 (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))
201204 (:reporter options) (assoc :kaocha/reporter (:reporter options))
202205 (:watch options) (assoc :kaocha/watch? (:watch options))
203206 (some? (:color options)) (assoc :kaocha/color? (:color options))
Original file line number Diff line number Diff line change 88 [tag parent]
99 (alter-var-root #'hierarchy derive tag parent))
1010
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+
1116(derive! :fail :kaocha/fail-type )
1217(derive! :error :kaocha/fail-type )
1318
Original file line number Diff line number Diff line change 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." ]
3536 [nil " --[no-]color" " Enable/disable ANSI color codes in output. Defaults to true." ]
3637 [nil " --[no-]watch" " Watch filesystem for changes and re-run tests." ]
3738 [nil " --reporter SYMBOL" " Change the test reporter, can be specified multiple times."
You can’t perform that action at this time.
0 commit comments