lambdaisland / lambdaisland/kaocha
Duplicated entries in config when using both #kaocha/v1 and #include
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 860
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
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!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the configuration using the issue's tests.edn and tests-ci.edn examples, then trace how #kaocha/v1, #include, and #meta-merge are handled. Done means the combined configuration does not duplicate plugins and includes the JUnit plugin, or the documentation clearly explains the supported form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100