![]() |
Photo by Genaro Servín from Pexels |
The standard way to do this is to have the test runner create a XUnit compatible XML file and have the CI tool consume this file to produce the reports. Unfortunately, the junit.xml file created by the default Clojure test runner creates a junit.xml that does not follow the spec and Bitbucket doesn't report which tests failed.
After some research, I found that Kaocha does a much better job of creating a junit.xml that Bitbucket Pipeline can grok. In addition, it also supports code coverage which is a great bonus.
Here is the stanza for deps.edn to make it work:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:kaocha {:extra-paths ["test"] | |
:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-529"} | |
lambdaisland/kaocha-junit-xml {:mvn/version "0.0-70"} | |
lambdaisland/kaocha-cloverage {:mvn/version "0.0-32"} | |
cloverage {:mvn/version "RELEASE"} | |
} | |
:main-opts ["-m" "kaocha.runner" | |
"--plugin" "kaocha.plugin/junit-xml" | |
"--plugin" "cloverage" "--no-cov-summary" | |
"--junit-xml-file" "target/test-results/junit.xml"]} |
No comments:
Post a Comment