Skip to content

Commit a46c713

Browse files
committedJan 31, 2019
Allow plugins under kaocha.plugin to be configured without the prefix
Just like on the command line you can write `--plugin notifier`, this lets you configure in `tests.edn`: `:plugins [:notifier]`.
1 parent 76460da commit a46c713

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed
 

‎CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
## Changed
88

9+
- Built in plugins in the `kaocha.plugin` can now be specified as simple (rather
10+
than namespaced) keywords.
11+
912
# 0.0-389 (2019-01-29 / 152db39)
1013

1114
## Added

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ and source paths. Optionally set a reporter or load plugins.
142142
:source-paths ["src"]
143143
:ns-patterns ["-test$"]}]
144144
;; :reporter kaocha.report.progress/progress
145-
;; :plugins [:kaocha.plugin/profiling :kaocha.plugin/notifier]
145+
;; :plugins [:profiling :notifier]
146146
}
147147
```
148148

‎notes.org

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
- [ ] Output reporter output to file (?)
3737

3838
** Plugin ideas
39-
- [ ] Provide inspect plugin with e.g. --print-test-ids
4039
- [ ] Timing info of config/load/run steps
41-
- [ ] Provide extra dynamic var bindings
42-
- [X] Global pre/post hooks
4340
- [ ] test.check configuration
4441
- [ ] Detect side effects (see circleci.test)
4542

@@ -51,11 +48,10 @@
5148

5249
** ClojureScript
5350
- [ ] file/line not (always) correct
54-
- [ ] need to manually add test dir to classpath
55-
- [ ] automatically pick a free port for the websocket
51+
- [ ] |need to manually add test dir to classpath
52+
- [ ] |automatically pick a free port for the websocket
5653

5754
** JUnit.xml
58-
- [ ] Print non-leaf failures ([[https://github.com/lambdaisland/kaocha-junit-xml/issues/3][#1]])
5955

6056
** Internal
6157
- [ ] Add smoke tests for all reporters and plugins (anything that is loaded conditionally)
@@ -72,6 +68,10 @@
7268
- ::caputer/buffer
7369

7470
** Done
71+
- [X] Print non-leaf failures ([[https://github.com/lambdaisland/kaocha-junit-xml/issues/3][#1]])
72+
- [X] Provide inspect plugin with e.g. --print-test-ids
73+
- [X] Provide extra dynamic var bindings
74+
- [X] Global pre/post hooks
7575
- [X] min/max clojure/java version
7676
- [X] Run config hooks when doing --print-config
7777
- [X] Define hooks directly in tests.edn

‎src/kaocha/config.clj

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@
4646
" (" (name (:kaocha.testable/type $)) ")")}
4747
$))))
4848

49+
(defn normalize-plugin-names [plugins]
50+
(mapv (fn [p]
51+
(cond
52+
(qualified-keyword? p) p
53+
(simple-keyword? p) (keyword "kaocha.plugin" (name p))
54+
:else
55+
(throw (ex-info "Plugin name must be a keyword" {:plugins plugins}))))
56+
plugins))
57+
4958
(defn normalize [config]
5059
(let [default-config (default-config)
5160
{:keys [tests

‎test/unit/kaocha/config_test.clj

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
(is (match? {:kaocha.testable/desc "foo (clojure.test)"}
7070
(c/normalize-test-suite {:type :kaocha.type/clojure.test :id :foo})))))
7171

72+
(deftest normalize-plugin-names-test
73+
(is (= [:kaocha.plugin/foo :foo/bar]
74+
(c/normalize-plugin-names [:foo :foo/bar])))
75+
76+
(is (thrown? clojure.lang.ExceptionInfo (c/normalize-plugin-names '[foo]))))
77+
7278
(deftest normalize-test
7379
(testing "normalizes keys"
7480
(is (match? {:kaocha/color? false}

0 commit comments

Comments
 (0)
Please sign in to comment.