├── .github └── workflows │ └── ci.yml ├── .gitignore ├── Appraisals ├── CHANGELOG.md ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md ├── Rakefile ├── example ├── .rspec ├── spec │ ├── example_spec.rb │ ├── shared_examples.rb │ └── spec_helper.rb └── tmp │ └── .keep ├── gemfiles ├── .bundle │ └── config ├── rspec_2_x.gemfile ├── rspec_2_x.gemfile.lock ├── rspec_3_0.gemfile ├── rspec_3_0.gemfile.lock ├── rspec_3_1.gemfile ├── rspec_3_1.gemfile.lock ├── rspec_3_10.gemfile ├── rspec_3_10.gemfile.lock ├── rspec_3_2.gemfile ├── rspec_3_2.gemfile.lock ├── rspec_3_3.gemfile ├── rspec_3_3.gemfile.lock ├── rspec_3_4.gemfile ├── rspec_3_4.gemfile.lock ├── rspec_3_5.gemfile ├── rspec_3_5.gemfile.lock ├── rspec_3_6.gemfile ├── rspec_3_6.gemfile.lock ├── rspec_3_7.gemfile ├── rspec_3_7.gemfile.lock ├── rspec_3_8.gemfile ├── rspec_3_8.gemfile.lock ├── rspec_3_9.gemfile └── rspec_3_9.gemfile.lock ├── lib ├── rspec_junit_formatter.rb └── rspec_junit_formatter │ ├── rspec2.rb │ └── rspec3.rb ├── reference └── JUnit.xsd ├── rspec_junit_formatter.gemspec └── spec └── rspec_junit_formatter_spec.rb /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | test: 11 | strategy: 12 | matrix: 13 | ruby-version: ["2.6", "2.7", "3.0", "3.1"] 14 | rspec-version: ["2_x", "3_0", "3_1", "3_2", "3_3", "3_4", "3_5", "3_6", "3_7", "3_8", "3_9", "3_10"] 15 | 16 | runs-on: ubuntu-latest 17 | 18 | env: 19 | BUNDLE_GEMFILE: gemfiles/rspec_${{ matrix.rspec-version }}.gemfile 20 | 21 | steps: 22 | - uses: actions/checkout@v2 23 | 24 | - uses: ruby/setup-ruby@v1 25 | with: 26 | ruby-version: ${{ matrix.ruby-version }} 27 | bundler-cache: true 28 | 29 | - name: Run tests 30 | run: bundle exec rake 31 | 32 | - name: Upload test artifacts 33 | uses: actions/upload-artifact@v2 34 | if: always() 35 | with: 36 | name: test-artifacts 37 | path: tmp 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /doc/ 3 | /example/tmp/ 4 | /pkg/ 5 | /tmp/ 6 | -------------------------------------------------------------------------------- /Appraisals: -------------------------------------------------------------------------------- 1 | appraise "rspec-2-x" do 2 | gem "rspec", "~> 2.14", "< 2.99" 3 | gem "rake", "~> 10.0" # Rake.last_comment 4 | end 5 | 6 | appraise "rspec-3-0" do 7 | gem "rspec", "~> 3.0.0" 8 | gem "rake", "~> 10.0" # Rake.last_comment 9 | end 10 | 11 | appraise "rspec-3-1" do 12 | gem "rspec", "~> 3.1.0" 13 | gem "rake", "~> 10.0" # Rake.last_comment 14 | end 15 | 16 | appraise "rspec-3-2" do 17 | gem "rspec", "~> 3.2.0" 18 | gem "rake", "~> 10.0" # Rake.last_comment 19 | end 20 | 21 | appraise "rspec-3-3" do 22 | gem "rspec", "~> 3.3.0" 23 | gem "rake", "~> 10.0" # Rake.last_comment 24 | end 25 | 26 | appraise "rspec-3-4" do 27 | gem "rspec", "~> 3.4.0" 28 | end 29 | 30 | appraise "rspec-3-5" do 31 | gem "rspec", "~> 3.5.0" 32 | end 33 | 34 | appraise "rspec-3-6" do 35 | gem "rspec", "~> 3.6.0" 36 | end 37 | 38 | appraise "rspec-3-7" do 39 | gem "rspec", "~> 3.7.0" 40 | end 41 | 42 | appraise "rspec-3-8" do 43 | gem "rspec", "~> 3.8.0" 44 | end 45 | 46 | appraise "rspec-3-9" do 47 | gem "rspec", "~> 3.9.0" 48 | end 49 | 50 | appraise "rspec-3-10" do 51 | gem "rspec", "~> 3.10.0" 52 | end 53 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog] and this project adheres to [Semantic Versioning]. 6 | 7 | [Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ 8 | [Semantic Versioning]: http://semver.org/spec/v2.0.0.html 9 | 10 | ## [Unreleased] 11 | 12 | [Unreleased]: https://github.com/sj26/rspec_junit_formatter/compare/v0.6.0...main 13 | 14 | ## [v0.6.0] 15 | ### Changed 16 | - Restrict to Ruby 2.3+ 17 | ### Fixed 18 | - Fix handling of nil durations 19 | 20 | [v0.6.0]: https://github.com/sj26/rspec_junit_formatter/compare/v0.5.1...v0.6.0 21 | 22 | ## [v0.5.1] - 2022-01-06 23 | ### Fixed 24 | - Fixed compatibility with older rubies 25 | 26 | [v0.5.1]: https://github.com/sj26/rspec_junit_formatter/compare/v0.5.0...v0.5.1 27 | 28 | ## [v0.5.0] - 2022-01-04 29 | ### Added 30 | - Added support to read outside error count returned from XML formatter (#86) 31 | ### Changed 32 | - Moved to GitHub Actions for CI 33 | - Test on current Ruby and RSpec versions 34 | 35 | [v0.5.0]: https://github.com/sj26/rspec_junit_formatter/compare/v0.4.1...v0.5.0 36 | 37 | ## [v0.4.1] - 2018-05-26 38 | ### Fixed 39 | - Diff ANSI stripping now works for codes with multiple tags, too 40 | 41 | [v0.4.1]: https://github.com/sj26/rspec_junit_formatter/compare/v0.4.0...v0.4.1 42 | 43 | ## [v0.4.0] - 2018-05-26 44 | ### Added 45 | - Add support for including STDOUT and STDERR from tests in the JUnit output (see ["Capturing output"] in the readme for details) 46 | ### Fixed 47 | - When RSpec includes a diff in its output, strip out ANSI escape codes used to color it for shell display 48 | 49 | [v0.4.0]: https://github.com/sj26/rspec_junit_formatter/compare/v0.3.0...v0.4.0 50 | ["Capturing output"]: https://github.com/sj26/rspec_junit_formatter#capturing-output 51 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gemspec 4 | 5 | gem "rspec" 6 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.8.0) 17 | nokogiri (1.13.4) 18 | mini_portile2 (~> 2.8.0) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (13.0.6) 22 | rspec (3.10.0) 23 | rspec-core (~> 3.10.0) 24 | rspec-expectations (~> 3.10.0) 25 | rspec-mocks (~> 3.10.0) 26 | rspec-core (3.10.1) 27 | rspec-support (~> 3.10.0) 28 | rspec-expectations (3.10.1) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.10.0) 31 | rspec-mocks (3.10.2) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.10.0) 34 | rspec-support (3.10.3) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake 46 | rspec 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2022 Samuel Cochran 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RSpec JUnit Formatter 2 | 3 | [](https://github.com/sj26/rspec_junit_formatter/actions/workflows/ci.yml?branch=main) 4 | [](https://rubygems.org/gems/rspec_junit_formatter) 5 | 6 | [RSpec][rspec] 2 & 3 results that your CI can read. [Jenkins][jenkins-junit], [Buildkite][buildkite-junit], [CircleCI][circleci-junit], [Gitlab][gitlab-junit], and probably more, too. 7 | 8 | [rspec]: http://rspec.info/ 9 | [jenkins-junit]: https://jenkins.io/doc/pipeline/steps/junit/ 10 | [buildkite-junit]: https://github.com/buildkite/rspec-junit-example 11 | [circleci-junit]: https://circleci.com/docs/2.0/collect-test-data/ 12 | [gitlab-junit]: https://docs.gitlab.com/ee/ci/unit_test_reports.html#ruby-example 13 | 14 | ## Usage 15 | 16 | Install the gem: 17 | 18 | ```sh 19 | gem install rspec_junit_formatter 20 | ``` 21 | 22 | Use it: 23 | 24 | ```sh 25 | rspec --format RspecJunitFormatter --out rspec.xml 26 | ``` 27 | 28 | You'll get an XML file `rspec.xml` with your results in it. 29 | 30 | You can use it in combination with other [formatters][rspec-formatters], too: 31 | 32 | ```sh 33 | rspec --format progress --format RspecJunitFormatter --out rspec.xml 34 | ``` 35 | 36 | [rspec-formatters]: https://rspec.info/features/3-12/rspec-core/formatters/ 37 | 38 | ### Using in your project with Bundler 39 | 40 | Add it to your Gemfile if you're using [Bundler][bundler]. Put it in the same groups as rspec. 41 | 42 | ```ruby 43 | group :test do 44 | gem "rspec" 45 | gem "rspec_junit_formatter", require: false 46 | end 47 | ``` 48 | 49 | Put the same arguments as the commands above in [your `.rspec`][rspec-file]: 50 | 51 | ```sh 52 | --format RspecJunitFormatter 53 | --out rspec.xml 54 | ``` 55 | [bundler]: https://bundler.io 56 | [rspec-file]: https://rspec.info/features/3-12/rspec-core/configuration/read-options-from-file/ 57 | 58 | ### Parallel tests 59 | 60 | For use with `parallel_tests`, add `$TEST_ENV_NUMBER` in the output file option (in `.rspec` or `.rspec_parallel`) to avoid concurrent process write conflicts. 61 | 62 | ```sh 63 | --format RspecJunitFormatter 64 | --out tmp/rspec<%= ENV["TEST_ENV_NUMBER"] %>.xml 65 | ``` 66 | 67 | The formatter includes `$TEST_ENV_NUMBER` in the test suite name within the XML, too. 68 | 69 | ### Capturing output 70 | 71 | If 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.: 72 | 73 | ```ruby 74 | # spec_helper.rb 75 | 76 | RSpec.configure do |config| 77 | # register around filter that captures stdout and stderr 78 | config.around(:each) do |example| 79 | $stdout = StringIO.new 80 | $stderr = StringIO.new 81 | 82 | example.run 83 | 84 | example.metadata[:stdout] = $stdout.string 85 | example.metadata[:stderr] = $stderr.string 86 | 87 | $stdout = STDOUT 88 | $stderr = STDERR 89 | end 90 | end 91 | ``` 92 | 93 | Note 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/). 94 | 95 | ## Caveats 96 | 97 | * 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`. 98 | 99 | [xml-charsets]: https://www.w3.org/TR/xml/#charsets 100 | 101 | ## Development 102 | 103 | Run the specs with `bundle exec rake`, which uses [Appraisal][appraisal] to run the specs against all supported versions of rspec. 104 | 105 | [appraisal]: https://github.com/thoughtbot/appraisal 106 | 107 | ## Releasing 108 | 109 | Bump 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. 110 | 111 | ## License 112 | 113 | The MIT License, see [LICENSE](./LICENSE). 114 | 115 | ## Thanks 116 | 117 | Inspired by the work of [Diego Souza][dgvncsz0f] on [RSpec Formatters][dgvncsz0f/rspec_formatters] after frustration with [CI Reporter][ci_reporter]. 118 | 119 | [dgvncsz0f]: https://github.com/dgvncsz0f 120 | [dgvncsz0f/rspec_formatters]: https://github.com/dgvncsz0f/rspec_formatters 121 | [ci_reporter]: https://github.com/nicksieger/ci_reporter 122 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require "appraisal" 3 | require "rspec/core/rake_task" 4 | 5 | RSpec::Core::RakeTask.new(:spec) 6 | 7 | task :default => :spec 8 | 9 | if !ENV["APPRAISAL_INITIALIZED"] && !ENV["CI"] 10 | task :default => :appraisal 11 | end 12 | -------------------------------------------------------------------------------- /example/.rspec: -------------------------------------------------------------------------------- 1 | --format RspecJunitFormatter 2 | --out tmp/rspec.xml 3 | -------------------------------------------------------------------------------- /example/spec/example_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | require_relative "shared_examples" 3 | 4 | describe "some example specs" do 5 | it "should succeed" do 6 | expect(true).to be(true) 7 | end 8 | 9 | it "should fail" do 10 | expect(false).to be(true) 11 | end 12 | 13 | it "should raise" do 14 | raise ArgumentError 15 | end 16 | 17 | it "should be pending" do 18 | if defined? skip 19 | skip 20 | else 21 | pending 22 | end 23 | end 24 | 25 | it "shows diffs cleanly" do 26 | expect({a: "b", c: "d"}).to eql({a: 2, c: 4}) 27 | end 28 | 29 | it "replaces naughty \0 and \e characters, \x01 and \uFFFF too" do 30 | expect("\0\0\0").to eql("emergency services") 31 | end 32 | 33 | it "escapes controlling \u{7f} characters" do 34 | expect("\u{7f}").to eql("pacman om nom nom") 35 | end 36 | 37 | it "can include unicodes 😁" do 38 | expect("🚀").to eql("🔥") 39 | end 40 | 41 | it %{escapes } do 42 | expect("
This is important
").to eql("This is very important
") 43 | end 44 | 45 | it_should_behave_like "shared examples" 46 | 47 | it "can capture stdout and stderr" do 48 | $stdout.puts "Test" 49 | $stderr.puts "Bar" 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /example/spec/shared_examples.rb: -------------------------------------------------------------------------------- 1 | shared_examples "shared examples" do 2 | context "in a shared example" do 3 | it "succeeds" do 4 | expect(true).to be(true) 5 | end 6 | 7 | it "also fails" do 8 | expect(false).to be(true) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /example/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | RSpec.configure do |config| 2 | # register around filter that captures stderr and stdout 3 | config.around(:each) do |example| 4 | $stdout = StringIO.new 5 | $stderr = StringIO.new 6 | 7 | example.run 8 | 9 | example.metadata[:stdout] = $stdout.string 10 | example.metadata[:stderr] = $stderr.string 11 | 12 | $stdout = STDOUT 13 | $stderr = STDERR 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /example/tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sj26/rspec_junit_formatter/3f79074a9987d722976542d7d6e2ebb470ad47d1/example/tmp/.keep -------------------------------------------------------------------------------- /gemfiles/.bundle/config: -------------------------------------------------------------------------------- 1 | --- 2 | BUNDLE_RETRY: "1" 3 | BUNDLE_WITHOUT: "development,test" 4 | -------------------------------------------------------------------------------- /gemfiles/rspec_2_x.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 2.14", "< 2.99" 6 | gem "rake", "~> 10.0" 7 | 8 | gemspec path: "../" 9 | -------------------------------------------------------------------------------- /gemfiles/rspec_2_x.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (10.5.0) 22 | rspec (2.14.1) 23 | rspec-core (~> 2.14.0) 24 | rspec-expectations (~> 2.14.0) 25 | rspec-mocks (~> 2.14.0) 26 | rspec-core (2.14.8) 27 | rspec-expectations (2.14.5) 28 | diff-lcs (>= 1.1.3, < 2.0) 29 | rspec-mocks (2.14.6) 30 | thor (1.1.0) 31 | 32 | PLATFORMS 33 | ruby 34 | 35 | DEPENDENCIES 36 | appraisal 37 | bundler 38 | coderay 39 | nokogiri (~> 1.8, >= 1.8.2) 40 | rake (~> 10.0) 41 | rspec (~> 2.14, < 2.99) 42 | rspec_junit_formatter! 43 | 44 | BUNDLED WITH 45 | 2.2.26 46 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_0.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.0.0" 6 | gem "rake", "~> 10.0" 7 | 8 | gemspec path: "../" 9 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_0.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (10.5.0) 22 | rspec (3.0.0) 23 | rspec-core (~> 3.0.0) 24 | rspec-expectations (~> 3.0.0) 25 | rspec-mocks (~> 3.0.0) 26 | rspec-core (3.0.4) 27 | rspec-support (~> 3.0.0) 28 | rspec-expectations (3.0.4) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.0.0) 31 | rspec-mocks (3.0.4) 32 | rspec-support (~> 3.0.0) 33 | rspec-support (3.0.4) 34 | thor (1.1.0) 35 | 36 | PLATFORMS 37 | ruby 38 | 39 | DEPENDENCIES 40 | appraisal 41 | bundler 42 | coderay 43 | nokogiri (~> 1.8, >= 1.8.2) 44 | rake (~> 10.0) 45 | rspec (~> 3.0.0) 46 | rspec_junit_formatter! 47 | 48 | BUNDLED WITH 49 | 2.2.26 50 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_1.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.1.0" 6 | gem "rake", "~> 10.0" 7 | 8 | gemspec path: "../" 9 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_1.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (10.5.0) 22 | rspec (3.1.0) 23 | rspec-core (~> 3.1.0) 24 | rspec-expectations (~> 3.1.0) 25 | rspec-mocks (~> 3.1.0) 26 | rspec-core (3.1.7) 27 | rspec-support (~> 3.1.0) 28 | rspec-expectations (3.1.2) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.1.0) 31 | rspec-mocks (3.1.3) 32 | rspec-support (~> 3.1.0) 33 | rspec-support (3.1.2) 34 | thor (1.1.0) 35 | 36 | PLATFORMS 37 | ruby 38 | 39 | DEPENDENCIES 40 | appraisal 41 | bundler 42 | coderay 43 | nokogiri (~> 1.8, >= 1.8.2) 44 | rake (~> 10.0) 45 | rspec (~> 3.1.0) 46 | rspec_junit_formatter! 47 | 48 | BUNDLED WITH 49 | 2.2.26 50 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_10.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.10.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_10.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (13.0.6) 22 | rspec (3.10.0) 23 | rspec-core (~> 3.10.0) 24 | rspec-expectations (~> 3.10.0) 25 | rspec-mocks (~> 3.10.0) 26 | rspec-core (3.10.1) 27 | rspec-support (~> 3.10.0) 28 | rspec-expectations (3.10.1) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.10.0) 31 | rspec-mocks (3.10.2) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.10.0) 34 | rspec-support (3.10.3) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake 46 | rspec (~> 3.10.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_2.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.2.0" 6 | gem "rake", "~> 10.0" 7 | 8 | gemspec path: "../" 9 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_2.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (10.5.0) 22 | rspec (3.2.0) 23 | rspec-core (~> 3.2.0) 24 | rspec-expectations (~> 3.2.0) 25 | rspec-mocks (~> 3.2.0) 26 | rspec-core (3.2.3) 27 | rspec-support (~> 3.2.0) 28 | rspec-expectations (3.2.1) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.2.0) 31 | rspec-mocks (3.2.1) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.2.0) 34 | rspec-support (3.2.2) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake (~> 10.0) 46 | rspec (~> 3.2.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_3.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.3.0" 6 | gem "rake", "~> 10.0" 7 | 8 | gemspec path: "../" 9 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_3.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (10.5.0) 22 | rspec (3.3.0) 23 | rspec-core (~> 3.3.0) 24 | rspec-expectations (~> 3.3.0) 25 | rspec-mocks (~> 3.3.0) 26 | rspec-core (3.3.2) 27 | rspec-support (~> 3.3.0) 28 | rspec-expectations (3.3.1) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.3.0) 31 | rspec-mocks (3.3.2) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.3.0) 34 | rspec-support (3.3.0) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake (~> 10.0) 46 | rspec (~> 3.3.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_4.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.4.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_4.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (13.0.6) 22 | rspec (3.4.0) 23 | rspec-core (~> 3.4.0) 24 | rspec-expectations (~> 3.4.0) 25 | rspec-mocks (~> 3.4.0) 26 | rspec-core (3.4.4) 27 | rspec-support (~> 3.4.0) 28 | rspec-expectations (3.4.0) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.4.0) 31 | rspec-mocks (3.4.1) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.4.0) 34 | rspec-support (3.4.1) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake 46 | rspec (~> 3.4.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_5.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.5.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_5.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (13.0.6) 22 | rspec (3.5.0) 23 | rspec-core (~> 3.5.0) 24 | rspec-expectations (~> 3.5.0) 25 | rspec-mocks (~> 3.5.0) 26 | rspec-core (3.5.4) 27 | rspec-support (~> 3.5.0) 28 | rspec-expectations (3.5.0) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.5.0) 31 | rspec-mocks (3.5.0) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.5.0) 34 | rspec-support (3.5.0) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake 46 | rspec (~> 3.5.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_6.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.6.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_6.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (13.0.6) 22 | rspec (3.6.0) 23 | rspec-core (~> 3.6.0) 24 | rspec-expectations (~> 3.6.0) 25 | rspec-mocks (~> 3.6.0) 26 | rspec-core (3.6.0) 27 | rspec-support (~> 3.6.0) 28 | rspec-expectations (3.6.0) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.6.0) 31 | rspec-mocks (3.6.0) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.6.0) 34 | rspec-support (3.6.0) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake 46 | rspec (~> 3.6.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_7.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.7.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_7.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (13.0.6) 22 | rspec (3.7.0) 23 | rspec-core (~> 3.7.0) 24 | rspec-expectations (~> 3.7.0) 25 | rspec-mocks (~> 3.7.0) 26 | rspec-core (3.7.1) 27 | rspec-support (~> 3.7.0) 28 | rspec-expectations (3.7.0) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.7.0) 31 | rspec-mocks (3.7.0) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.7.0) 34 | rspec-support (3.7.1) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake 46 | rspec (~> 3.7.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_8.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.8.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_8.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (13.0.6) 22 | rspec (3.8.0) 23 | rspec-core (~> 3.8.0) 24 | rspec-expectations (~> 3.8.0) 25 | rspec-mocks (~> 3.8.0) 26 | rspec-core (3.8.2) 27 | rspec-support (~> 3.8.0) 28 | rspec-expectations (3.8.6) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.8.0) 31 | rspec-mocks (3.8.2) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.8.0) 34 | rspec-support (3.8.3) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake 46 | rspec (~> 3.8.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_9.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "rspec", "~> 3.9.0" 6 | 7 | gemspec path: "../" 8 | -------------------------------------------------------------------------------- /gemfiles/rspec_3_9.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: .. 3 | specs: 4 | rspec_junit_formatter (0.6.0) 5 | rspec-core (>= 2, < 4, != 2.12.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | appraisal (2.4.1) 11 | bundler 12 | rake 13 | thor (>= 0.14.0) 14 | coderay (1.1.3) 15 | diff-lcs (1.5.0) 16 | mini_portile2 (2.6.1) 17 | nokogiri (1.12.5) 18 | mini_portile2 (~> 2.6.1) 19 | racc (~> 1.4) 20 | racc (1.6.0) 21 | rake (13.0.6) 22 | rspec (3.9.0) 23 | rspec-core (~> 3.9.0) 24 | rspec-expectations (~> 3.9.0) 25 | rspec-mocks (~> 3.9.0) 26 | rspec-core (3.9.3) 27 | rspec-support (~> 3.9.3) 28 | rspec-expectations (3.9.4) 29 | diff-lcs (>= 1.2.0, < 2.0) 30 | rspec-support (~> 3.9.0) 31 | rspec-mocks (3.9.1) 32 | diff-lcs (>= 1.2.0, < 2.0) 33 | rspec-support (~> 3.9.0) 34 | rspec-support (3.9.4) 35 | thor (1.1.0) 36 | 37 | PLATFORMS 38 | ruby 39 | 40 | DEPENDENCIES 41 | appraisal 42 | bundler 43 | coderay 44 | nokogiri (~> 1.8, >= 1.8.2) 45 | rake 46 | rspec (~> 3.9.0) 47 | rspec_junit_formatter! 48 | 49 | BUNDLED WITH 50 | 2.2.26 51 | -------------------------------------------------------------------------------- /lib/rspec_junit_formatter.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "socket" 4 | require "time" 5 | 6 | require "rspec/core" 7 | require "rspec/core/formatters/base_formatter" 8 | 9 | # Dumps rspec results as a JUnit XML file. 10 | # Based on XML schema: http://windyroad.org/dl/Open%20Source/JUnit.xsd 11 | class RSpecJUnitFormatter < RSpec::Core::Formatters::BaseFormatter 12 | # rspec 2 and 3 implements are in separate files. 13 | 14 | private 15 | 16 | def xml_dump 17 | output << %{\n} 18 | output << %{