This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-01
Channels
- # announcements (1)
- # aws (3)
- # beginners (150)
- # boot (12)
- # calva (7)
- # carry (3)
- # cider (1)
- # clara (51)
- # cljdoc (17)
- # cljs-dev (17)
- # cljsrn (1)
- # clojure (64)
- # clojure-austin (2)
- # clojure-india (1)
- # clojure-italy (10)
- # clojure-nl (4)
- # clojure-spec (42)
- # clojure-uk (63)
- # clojurescript (24)
- # core-async (23)
- # cursive (6)
- # datascript (7)
- # datomic (5)
- # figwheel-main (43)
- # fulcro (74)
- # hoplon (7)
- # kaocha (30)
- # leiningen (32)
- # mount (51)
- # nrepl (34)
- # off-topic (29)
- # re-frame (6)
- # reagent (10)
- # reitit (13)
- # shadow-cljs (66)
- # slack-help (3)
- # spacemacs (2)
- # specter (5)
- # sql (2)
- # tools-deps (51)
- # yada (13)
Hi @plexus, thanks for the junit plugin! I was able to get it to work on the command-line, but when I try to configure it via tests.edn I'm not seeing any output.
So this is working: clojure -A:test -m kaocha.runner --plugin kaocha.plugin/junit-xml --junit-xml-file target/junit.xml
...but then when I use this as my tests.edn I'm getting no output:
;; koacha test config - see
#kaocha/v1
{:tests
[{:id :unit
:test-paths ["src/test/clj"]
:src-paths ["src/main/clj"]}]
:plugins
[:kaocha.plugin/junit-xml]
:kaocha.plugin.junit-xml/junit-xml-file
"target/junit.xml"}
Thanks! I wasn't sure whether there was some mapping between the CLI and the config file for these options
...but this code looks to me like it's only reading from the CLI, if not: https://github.com/lambdaisland/kaocha-junit-xml/blob/master/src/kaocha/plugin/junit_xml.clj#L113
...er, oh, never mind, I see what it's doing now
yeah the general pattern is that plugins check for CLI arguments, then update the config
Oh, my cinfig up there is wrong, the key should be :kaocha.plugin.junit-xml/target-file
(config [config]
(if-let [target (get-in config [:kaocha/cli-options :junit-xml-file])]
(assoc config ::target-file target)
config))
Oh. I do get the same results with the correct key in there. But yeah, that makes sense that it overwrites with nil
from the CLI options
Awesome, thanks so much. In the meantime I'll try it out with the CLI options on CircleCI.
Sweet, 0.0-13 works. I'll let you know if circleci gives me any static from the results
I did notice another potential gotcha with the config, which is that when I had both the config file settings present and I used the command-line arguments, I got an exception out of clojure.tools.cli:
% clojure -A:test -m kaocha.runner --plugin kaocha.plugin/junit-xml --junit-xml-file target/junit.xml
Exception in thread "main" java.lang.AssertionError: Assert failed: (distinct?* (remove nil? (map :long-opt %)))
at clojure.tools.cli$compile_option_specs.invokeStatic(cli.cljc:268)
at clojure.tools.cli$compile_option_specs.invoke(cli.cljc:268)
at clojure.tools.cli$parse_opts.invokeStatic(cli.cljc:677)
at clojure.tools.cli$parse_opts.doInvoke(cli.cljc:532)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at kaocha.runner$_main_STAR_.invokeStatic(runner.clj:79)
at kaocha.runner$_main_STAR_.doInvoke(runner.clj:72)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.core$apply.invoke(core.clj:652)
at kaocha.runner$_main.invokeStatic(runner.clj:139)
at kaocha.runner$_main.doInvoke(runner.clj:137)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:702)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.main$main_opt.invokeStatic(main.clj:317)
at clojure.main$main_opt.invoke(main.clj:313)
at clojure.main$main.invokeStatic(main.clj:424)
at clojure.main$main.doInvoke(main.clj:387)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:702)
at clojure.main.main(main.java:37)
I'm assuming it's because the merged config has essentially --plugin foo --plugin foo
in it
Anyways, kaocha seems great so far, nice job
Will do
oh yeah I see what's going, the plugin gets registered twice, so its adds its CLI options twice
Sweet, that works for me for both the with command-line and no command-line cases