{"id":13617699,"url":"https://github.com/orta/danger-junit","last_synced_at":"2025-09-13T07:15:08.032Z","repository":{"id":45873428,"uuid":"64520030","full_name":"orta/danger-junit","owner":"orta","description":"Lets you report your test suite problems back to the PR elegantly","archived":false,"fork":false,"pushed_at":"2021-11-30T19:01:29.000Z","size":216,"stargazers_count":59,"open_issues_count":5,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T20:21:09.356Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-30T01:35:36.000Z","updated_at":"2024-11-13T17:40:24.000Z","dependencies_parsed_at":"2022-09-14T12:11:30.695Z","dependency_job_id":null,"html_url":"https://github.com/orta/danger-junit","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/orta/danger-junit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Fdanger-junit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Fdanger-junit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Fdanger-junit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Fdanger-junit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orta","download_url":"https://codeload.github.com/orta/danger-junit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orta%2Fdanger-junit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274932094,"owners_count":25376072,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T20:01:46.457Z","updated_at":"2025-09-13T07:15:07.981Z","avatar_url":"https://github.com/orta.png","language":"Ruby","funding_links":[],"categories":["Ruby","Plugins"],"sub_categories":["Ruby (danger)"],"readme":"# danger-junit\n\nThis Danger Plugin allows you to standardise the output for all of your testing runs. Most test runners include an ability to have a reporter that conforms to the JUnit XML standard. This plugin will understand that file and offer a way to introspect it, and to report on it.\n\n![](img/example.png)\n\n## Installation\n\n    $ gem install danger-junit\n\n## Usage\n\n### Ruby\n\nFor Rspec, add the gem `rspec_junit_formatter` to your project. Then use a `.rspec` file to configure your tests to have multiple reporters. This file looks like:\n\n``` sh\n...\n--format documentation\n--format RspecJunitFormatter --out junit-results.xml\n...\n```\n\nThen you can pass the `junit-results.xml` file to the plugin in your `Dangerfile`.\n\n### JS\n\nIn a Jasmine, or Jest testing project, you want to install the module `jasmine-reporters`. Then as you are setting up your Jasmine runner, [add the following](https://github.com/larrymyers/jasmine-reporters#basic-usage):\n\n```javascript\nvar junitReporter = new jasmineReporters.JUnitXmlReporter({\n    savePath: 'junit-results.xml',\n    consolidateAll: false\n});\njasmine.getEnv().addReporter(junitReporter);\n```\n\nThen you can pass the `junit-results.xml` file to the plugin in your `Dangerfile`.\n\n### iOS\n\nYou have a lot of options:\n\n* [trainer](https://github.com/krausefx/trainer) is the fastest way to generate the junit file.\n* [xcpretty](https://github.com/supermarin/xcpretty#reporters)  is used in both [fastlane](https://fastlane.tools), and a lot of standard setups.\n* [xctool](https://github.com/facebook/xctool#included-reporters) includes it's own reporter for creating the file.\n\n### JUnit\n\nReport, or inspect any JUnit XML formatted test suite report.\n\nTesting frameworks have standardized on the JUnit XML format for\nreporting results, this means that projects using Rspec, Jasmine, Mocha,\nXCTest and more - can all use the same Danger error reporting. Perfect.\n\nYou can see some examples on [this page from Circle CI](https://circleci.com/docs/test-metadata/) and on this [project's README](https://github.com/orta/danger-junit.git)\nabout how you can add JUnit XML output for your testing projects.\n\n\u003cblockquote\u003eParse the XML file, and let the plugin do your reporting\n  \u003cpre\u003e\njunit.parse \"/path/to/output.xml\"\njunit.report\u003c/pre\u003e\n\u003c/blockquote\u003e\n\n\u003cblockquote\u003eLet the plugin parse the XML file, and report yourself\n  \u003cpre\u003e\njunit.parse \"/path/to/output.xml\"\nfail(\"Tests failed\") unless junit.failures.empty?\u003c/pre\u003e\n\u003c/blockquote\u003e\n\n\u003cblockquote\u003eWarn on a report about skipped tests\n  \u003cpre\u003e\njunit.parse \"/path/to/output.xml\"\njunit.show_skipped_tests = true\njunit.skipped_headers = [:name, :file]\njunit.report\u003c/pre\u003e\n\u003c/blockquote\u003e\n\n\u003cblockquote\u003eOnly show specific parts of your results\n  \u003cpre\u003e\njunit.parse \"/path/to/output.xml\"\njunit.headers = [:name, :file]\njunit.report\u003c/pre\u003e\n\u003c/blockquote\u003e\n\n\u003cblockquote\u003eOnly show specific parts of your results\n  \u003cpre\u003e\njunit.parse \"/path/to/output.xml\"\nall_test = junit.tests.map(\u0026:attributes)\nslowest_test = sort_by { |attributes| attributes[:time].to_f }.last\nmessage \"#{slowest_test[:time]} took #{slowest_test[:time]} seconds\"\u003c/pre\u003e\n\u003c/blockquote\u003e\n\n\n\n#### Attributes\n\n`tests` - All the tests for introspection\n\n`passes` - An array of XML elements that represent passed tests.\n\n`failures` - An array of XML elements that represent failed tests.\n\n`errors` - An array of XML elements that represent passed tests.\n\n`skipped` - An array of XML elements that represent skipped tests.\n\n`show_skipped_tests` - An attribute to make the plugin show a warning on skipped tests.\n\n`headers` - An array of symbols that become the columns of your tests,\nif `nil`, the default, it will be all of the attributes.\n\n`skipped_headers` - An array of symbols that become the columns of your skipped tests, \nif `nil`, the default, it will be all of the attributes for a single parse \nor all of the common attributes between multiple files\n\n\n\n#### Methods\n\n`parse` - Parses an XML file, which fills all the attributes,\nwill `raise` for errors\n\n`report` - Causes a build fail if there are test failures,\nand outputs a markdown table of the results.\n\n\n## Development\n\n1. Clone this repo\n2. Run `bundle install` to setup dependencies.\n3. Run `bundle exec rake spec` to run the tests.\n4. Use `bundle exec guard` to automatically have tests run as you make changes.\n5. Make your changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forta%2Fdanger-junit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forta%2Fdanger-junit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forta%2Fdanger-junit/lists"}