Hey friends!
I was a little confused about how to best write a tests.edn config that uses #include while also relying on the #kaocha/v1 transformer.
Given tests.edn:
#kaocha/v1
{:capture-output? true
:color? true
:plugins [:capture-output :filter :randomize]
:reporter [kaocha.report/dots]
:tests [{:id :all
:ns-patterns ["-test$"]
:source-paths ["src"]
:test-paths ["test"]}]}
The docs recommend writing a tests-ci.edn like:
#kaocha/v1
#meta-merge
[{:color? false
:kaocha.plugin.junit-xml/target-file "junit.xml"
:plugins ^:append [:kaocha.plugin/junit-xml]}
#include "tests.edn"]
which then prints a config with:
{:kaocha/tests
[{:kaocha.testable/desc "all (clojure.test)",
:kaocha.testable/type :kaocha.type/clojure.test,
:kaocha.testable/id :all,
:kaocha/ns-patterns ["-test$"],
:kaocha/source-paths ["src"],
:kaocha/test-paths ["test"],
:kaocha.filter/skip-meta [:kaocha/skip]}],
:kaocha.plugin.junit-xml/target-file "junit.xml",
:kaocha/fail-fast? false,
:kaocha/color? true,
:kaocha/cli-options {:config-file "tests-ci.edn", :print-config true},
:kaocha.plugin.randomize/seed 997097312,
:kaocha.plugin.randomize/randomize? true,
:kaocha/plugins
[:kaocha.plugin/randomize
:kaocha.plugin/filter
:kaocha.plugin/capture-output
:kaocha.plugin/randomize
:kaocha.plugin/filter
:kaocha.plugin/capture-output
:capture-output
:filter
:randomize],
:kaocha.plugin.capture-output/capture-output? true,
:kaocha/reporter [kaocha.report/dots],
:capture-output? true}
Note that the :kaocha/plugins list has duplicates and is missing the junit plugin.
After much trial and error, this tests-ci.edn works (leave off #kaocha/v1 and qualify all of the keywords):
#meta-merge
[#include "tests.edn"
{:kaocha/color? false
:kaocha.plugin.junit-xml/target-file "junit.xml"
:kaocha/plugins ^:append [:kaocha.plugin/junit-xml]}]
which produces this config:
{:kaocha/tests
[{:kaocha.testable/desc "all (clojure.test)",
:kaocha.testable/type :kaocha.type/clojure.test,
:kaocha.testable/id :all,
:kaocha/ns-patterns ["-test$"],
:kaocha/source-paths ["src"],
:kaocha/test-paths ["test"],
:kaocha.filter/skip-meta [:kaocha/skip]}],
:kaocha.plugin.junit-xml/target-file "junit.xml",
:kaocha/fail-fast? false,
:kaocha/color? false,
:kaocha/cli-options {:config-file "tests-ci.edn", :print-config true},
:kaocha.plugin.randomize/seed 1405326847,
:kaocha.plugin.randomize/randomize? true,
:kaocha/plugins
[:kaocha.plugin/randomize
:kaocha.plugin/filter
:kaocha.plugin/capture-output
:capture-output
:filter
:randomize
:kaocha.plugin/junit-xml],
:kaocha.plugin.capture-output/capture-output? true,
:kaocha/reporter [kaocha.report/dots],
:capture-output? true}
I don't know exactly how exactly the meta-merge works or when/how the conversion of plain keywords to qualified keywords works, but it seems that there's something funky happening and the docs should probably be updated.
Thanks so much!
Hey friends!
I was a little confused about how to best write a
tests.ednconfig that uses#includewhile also relying on the#kaocha/v1transformer.Given
tests.edn:#kaocha/v1 {:capture-output? true :color? true :plugins [:capture-output :filter :randomize] :reporter [kaocha.report/dots] :tests [{:id :all :ns-patterns ["-test$"] :source-paths ["src"] :test-paths ["test"]}]}The docs recommend writing a
tests-ci.ednlike:#kaocha/v1 #meta-merge [{:color? false :kaocha.plugin.junit-xml/target-file "junit.xml" :plugins ^:append [:kaocha.plugin/junit-xml]} #include "tests.edn"]which then prints a config with:
{:kaocha/tests [{:kaocha.testable/desc "all (clojure.test)", :kaocha.testable/type :kaocha.type/clojure.test, :kaocha.testable/id :all, :kaocha/ns-patterns ["-test$"], :kaocha/source-paths ["src"], :kaocha/test-paths ["test"], :kaocha.filter/skip-meta [:kaocha/skip]}], :kaocha.plugin.junit-xml/target-file "junit.xml", :kaocha/fail-fast? false, :kaocha/color? true, :kaocha/cli-options {:config-file "tests-ci.edn", :print-config true}, :kaocha.plugin.randomize/seed 997097312, :kaocha.plugin.randomize/randomize? true, :kaocha/plugins [:kaocha.plugin/randomize :kaocha.plugin/filter :kaocha.plugin/capture-output :kaocha.plugin/randomize :kaocha.plugin/filter :kaocha.plugin/capture-output :capture-output :filter :randomize], :kaocha.plugin.capture-output/capture-output? true, :kaocha/reporter [kaocha.report/dots], :capture-output? true}Note that the
:kaocha/pluginslist has duplicates and is missing thejunitplugin.After much trial and error, this
tests-ci.ednworks (leave off#kaocha/v1and qualify all of the keywords):which produces this config:
{:kaocha/tests [{:kaocha.testable/desc "all (clojure.test)", :kaocha.testable/type :kaocha.type/clojure.test, :kaocha.testable/id :all, :kaocha/ns-patterns ["-test$"], :kaocha/source-paths ["src"], :kaocha/test-paths ["test"], :kaocha.filter/skip-meta [:kaocha/skip]}], :kaocha.plugin.junit-xml/target-file "junit.xml", :kaocha/fail-fast? false, :kaocha/color? false, :kaocha/cli-options {:config-file "tests-ci.edn", :print-config true}, :kaocha.plugin.randomize/seed 1405326847, :kaocha.plugin.randomize/randomize? true, :kaocha/plugins [:kaocha.plugin/randomize :kaocha.plugin/filter :kaocha.plugin/capture-output :capture-output :filter :randomize :kaocha.plugin/junit-xml], :kaocha.plugin.capture-output/capture-output? true, :kaocha/reporter [kaocha.report/dots], :capture-output? true}I don't know exactly how exactly the meta-merge works or when/how the conversion of plain keywords to qualified keywords works, but it seems that there's something funky happening and the docs should probably be updated.
Thanks so much!