{"id":14984639,"url":"https://github.com/sj26/rspec_junit_formatter","last_synced_at":"2025-05-14T22:09:41.012Z","repository":{"id":1525064,"uuid":"1792346","full_name":"sj26/rspec_junit_formatter","owner":"sj26","description":"RSpec results that your CI can read","archived":false,"fork":false,"pushed_at":"2024-04-29T10:02:43.000Z","size":238,"stargazers_count":305,"open_issues_count":11,"forks_count":124,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-21T03:06:10.622Z","etag":null,"topics":["buildkite","circleci","jenkins","junit","rspec"],"latest_commit_sha":null,"homepage":"http://rubygems.org/gems/rspec_junit_formatter","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/sj26.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-05-24T08:08:15.000Z","updated_at":"2025-04-04T21:41:08.000Z","dependencies_parsed_at":"2024-06-18T11:15:31.325Z","dependency_job_id":"a806cc0a-7f14-497a-9b87-d22f2f42c4d6","html_url":"https://github.com/sj26/rspec_junit_formatter","commit_stats":{"total_commits":181,"total_committers":24,"mean_commits":7.541666666666667,"dds":0.2154696132596685,"last_synced_commit":"3f79074a9987d722976542d7d6e2ebb470ad47d1"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sj26%2Frspec_junit_formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sj26%2Frspec_junit_formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sj26%2Frspec_junit_formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sj26%2Frspec_junit_formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sj26","download_url":"https://codeload.github.com/sj26/rspec_junit_formatter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250366708,"owners_count":21418770,"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":["buildkite","circleci","jenkins","junit","rspec"],"created_at":"2024-09-24T14:09:26.667Z","updated_at":"2025-05-14T22:09:35.988Z","avatar_url":"https://github.com/sj26.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSpec JUnit Formatter\n\n[![Build results](https://github.com/sj26/rspec_junit_formatter/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sj26/rspec_junit_formatter/actions/workflows/ci.yml?branch=main) \n[![Gem version](http://img.shields.io/gem/v/rspec_junit_formatter.svg)](https://rubygems.org/gems/rspec_junit_formatter)\n\n[RSpec][rspec] 2 \u0026 3 results that your CI can read. [Jenkins][jenkins-junit], [Buildkite][buildkite-junit], [CircleCI][circleci-junit], [Gitlab][gitlab-junit], and probably more, too.\n\n  [rspec]: http://rspec.info/\n  [jenkins-junit]: https://jenkins.io/doc/pipeline/steps/junit/\n  [buildkite-junit]: https://github.com/buildkite/rspec-junit-example\n  [circleci-junit]: https://circleci.com/docs/2.0/collect-test-data/\n  [gitlab-junit]: https://docs.gitlab.com/ee/ci/unit_test_reports.html#ruby-example\n\n## Usage\n\nInstall the gem:\n\n```sh\ngem install rspec_junit_formatter\n```\n\nUse it:\n\n```sh\nrspec --format RspecJunitFormatter --out rspec.xml\n```\n\nYou'll get an XML file `rspec.xml` with your results in it.\n\nYou can use it in combination with other [formatters][rspec-formatters], too:\n\n```sh\nrspec --format progress --format RspecJunitFormatter --out rspec.xml\n```\n\n  [rspec-formatters]: https://rspec.info/features/3-12/rspec-core/formatters/\n\n### Using in your project with Bundler\n\nAdd it to your Gemfile if you're using [Bundler][bundler]. Put it in the same groups as rspec.\n\n```ruby\ngroup :test do\n  gem \"rspec\"\n  gem \"rspec_junit_formatter\", require: false\nend\n```\n\nPut the same arguments as the commands above in [your `.rspec`][rspec-file]:\n\n```sh\n--format RspecJunitFormatter\n--out rspec.xml\n```\n  [bundler]: https://bundler.io\n  [rspec-file]: https://rspec.info/features/3-12/rspec-core/configuration/read-options-from-file/\n\n### Parallel tests\n\nFor use with `parallel_tests`, add `$TEST_ENV_NUMBER` in the output file option (in `.rspec` or `.rspec_parallel`) to avoid concurrent process write conflicts.\n\n```sh\n--format RspecJunitFormatter\n--out tmp/rspec\u003c%= ENV[\"TEST_ENV_NUMBER\"] %\u003e.xml\n```\n\nThe formatter includes `$TEST_ENV_NUMBER` in the test suite name within the XML, too.\n\n### Capturing output\n\nIf you like, you can capture the standard output and error streams of each test into the `:stdout` and `:stderr` example metadata which will be added to the junit report, e.g.:\n\n```ruby\n# spec_helper.rb\n\nRSpec.configure do |config|\n  # register around filter that captures stdout and stderr\n  config.around(:each) do |example|\n    $stdout = StringIO.new\n    $stderr = StringIO.new\n\n    example.run\n\n    example.metadata[:stdout] = $stdout.string\n    example.metadata[:stderr] = $stderr.string\n\n    $stdout = STDOUT\n    $stderr = STDERR\n  end\nend\n```\n\nNote that this example captures all output from every example all the time, potentially interfering with local debugging. You might like to restrict this to only on CI, or by using [rspec filters](https://rspec.info/features/3-12/rspec-core/hooks/filtering/).\n\n## Caveats\n\n * XML can only represent a [limited subset of characters][xml-charsets] which excludes null bytes and most control characters. This gem will use character entities where possible and fall back to replacing invalid characters with Ruby-like escape codes otherwise. For example, the null byte becomes `\\0`.\n\n  [xml-charsets]: https://www.w3.org/TR/xml/#charsets\n\n## Development\n\nRun the specs with `bundle exec rake`, which uses [Appraisal][appraisal] to run the specs against all supported versions of rspec.\n\n  [appraisal]: https://github.com/thoughtbot/appraisal\n\n## Releasing\n\nBump the gem version in the gemspec, and commit. Then `bundle exec rake build` to build a gem package, `bundle exec rake install` to install and test it locally, then `bundle exec rake release` to tag and push the commits and gem.\n\n## License\n\nThe MIT License, see [LICENSE](./LICENSE).\n\n## Thanks\n\nInspired by the work of [Diego Souza][dgvncsz0f] on [RSpec Formatters][dgvncsz0f/rspec_formatters] after frustration with [CI Reporter][ci_reporter].\n\n  [dgvncsz0f]: https://github.com/dgvncsz0f\n  [dgvncsz0f/rspec_formatters]: https://github.com/dgvncsz0f/rspec_formatters\n  [ci_reporter]: https://github.com/nicksieger/ci_reporter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsj26%2Frspec_junit_formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsj26%2Frspec_junit_formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsj26%2Frspec_junit_formatter/lists"}