forked from lambdaisland/kaocha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.clj
31 lines (26 loc) · 1.01 KB
/
info.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(ns kaocha.plugin.alpha.info
(:require [kaocha.api :as api]
[kaocha.plugin :as plugin :refer [defplugin]]
[kaocha.testable :as testable]
[slingshot.slingshot :refer [throw+]]))
(def cli-opts
[[nil "--print-test-ids" "Print all known test ids"]
[nil "--print-env" "Print Clojure and Java version."]])
(defplugin kaocha.plugin.alpha/info
(cli-options [opts]
(into opts cli-opts))
(main [config]
(cond
(:print-test-ids (:kaocha/cli-options config))
(binding [api/*active?* true]
(let [test-plan (api/test-plan (plugin/run-hook :kaocha.hooks/config config))]
(doseq [test (testable/test-seq test-plan)]
(println (:kaocha.testable/id test)))
(throw+ {:kaocha/early-exit 0})))
(:print-env (:kaocha/cli-options config))
(do
(println "Clojure" (clojure-version))
(println (System/getProperty "java.runtime.name") (System/getProperty "java.runtime.version"))
config)
:else
config)))