{"id":18993075,"url":"https://github.com/redbadger/test-report-junit-xml","last_synced_at":"2025-10-26T12:36:02.069Z","repository":{"id":57713804,"uuid":"81438129","full_name":"redbadger/test-report-junit-xml","owner":"redbadger","description":"JUnit XML output for clojure.test","archived":false,"fork":false,"pushed_at":"2020-05-14T03:55:36.000Z","size":40,"stargazers_count":9,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-01T08:39:01.207Z","etag":null,"topics":["clojure","test-reporting"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redbadger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-09T10:22:58.000Z","updated_at":"2020-05-18T16:00:50.000Z","dependencies_parsed_at":"2022-08-25T12:52:00.842Z","dependency_job_id":null,"html_url":"https://github.com/redbadger/test-report-junit-xml","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/redbadger/test-report-junit-xml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Ftest-report-junit-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Ftest-report-junit-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Ftest-report-junit-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Ftest-report-junit-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redbadger","download_url":"https://codeload.github.com/redbadger/test-report-junit-xml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redbadger%2Ftest-report-junit-xml/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261392169,"owners_count":23151718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","test-reporting"],"created_at":"2024-11-08T17:19:47.021Z","updated_at":"2025-10-26T12:35:57.008Z","avatar_url":"https://github.com/redbadger.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# test-report-junit-xml\n\n[![CircleCI](https://circleci.com/gh/redbadger/test-report-junit-xml.svg?style=svg)](https://circleci.com/gh/redbadger/test-report-junit-xml)\n\ntest-report-junit-xml is a tool for producing JUnit XML reports from clojure.test test suites.\n\n## Motivation\n\nJUnit XML test reports are the de-facto standard for machine-readable test metadata.\nContinuous integration tools like [Jenkins](https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Plugin) and [CircleCI](https://circleci.com/docs/test-metadata/) use it to produce test summaries.\n\nThere is already a [plugin](https://github.com/ruedigergad/test2junit) available for [Leiningen](https://github.com/technomancy/leiningen) to produce JUnit XML.\nWe ran into an [issue](https://github.com/ruedigergad/test2junit/issues/10) with the output that made it more difficult to trace back to the source of failures in CI.\nWe therefore have rolled our own which aims to:\n\n* produce comprehensive output, including context provided by [`clojure.test/testing`](https://clojure.github.io/clojure/clojure.test-api.html#clojure.test/testing) statements;\n* hook into the existing `lein test` task, rather than creating a separate task;\n* preserve the default test output written to stdout; and\n* allow customization of the output.\n\n## Installation\n\nThe easiest way to get started is to add the lein-test-report-junit-xml plugin to your Leiningen project map.\nAs it's only used in tests, it's best to add it only to the `:test` profile:\n\n```clojure\n:profiles {:test {:plugins [[lein-test-report-junit-xml \"0.2.0\"]]}}\n```\n\n## Usage\n\ntest-report-junit-xml is built on top of [test-report](https://github.com/redbadger/test-report), which hooks into the [`clojure.test/run-tests`](https://clojure.github.io/clojure/clojure.test-api.html#clojure.test/run-tests) function, so will automatically be included when running `lein test`.\n\nAn example project demonstrating usage with CircleCI is available [here](https://github.com/redbadger/test-report-junit-xml-example).\n\n### Output location\n\nBy default, reports are written to a directory called `test-reports` created in the `target` directory.\nThis location can be overridden by specifying the `:output-dir` option under `:test-report-junit-xml` in the project map (again, this should probably go under the `:test` profile):\n\n```clojure\n:test-report-junit-xml {:output-dir \"somewhere/else\"}\n```\n\nThe environment variable `TEST_REPORT_JUNIT_XML_OUTPUT_DIR`, if present, takes precedence over the value specified in the project.\n\nThe directory (and its parents) will be created if they do not already exist.\n\n### Customizing output\n\nYou can customize the formatting of stacktraces by specifying the `:format-stacktrace` option:\n\n```clojure\n:test-report-junit-xml {:format-stacktrace custom/format-stacktrace}\n```\n\nThe given function should accept a `Throwable` and return a string with the formatted stacktrace.\nThe default is to capture the output of [`clojure.stacktrace/print-cause-trace`](https://clojure.github.io/clojure/clojure.stacktrace-api.html#clojure.stacktrace/print-cause-trace).\n\nFor more extensive customization, you can specify the `:format-result` option instead:\n\n```clojure\n:test-report-junit-xml {:format-stacktrace custom/format-result}\n```\n\nThe given function should accept a result message (as passed to [`clojure.test/report`](https://clojure.github.io/clojure/clojure.test-api.html#clojure.test/report)) and return a map representing the emitted XML element, for example:\n\n```clojure\n{:tag :failure\n :attrs {:message \"Denied!\"}\n :content \"Your test failed :(\"}\n```\n\nMessages with `{:type :pass}` should usually be ignored by returning `nil` from the function.\n\n## License\n\nCopyright © 2017 Red Badger\n\nDistributed under the Eclipse Public License either version 1.0 or (at your option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbadger%2Ftest-report-junit-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredbadger%2Ftest-report-junit-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredbadger%2Ftest-report-junit-xml/lists"}