sj26/rspec_junit_formatter

NoMethodError while using rspec_junit_formatter

JuanitoFatas opened this issue · 9 comments

Hello!

I'm using rspec_junit_formatter version: 0.2.3 with Ruby 2.3.1. But it raises a NoMethodError when running specs.

My .rspec file:

--format RspecJunitFormatter --out junit-results.xml

When I do $ rspec, failed with following log:

$ rspec
/home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:29:in `block in xml_dump_examples': undefined method `xml_dump_' for #<RSpecJUnitFormatter:0x00000002ee2030> (NoMethodError)
Did you mean?  xml_dump
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:28:in `each'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:28:in `xml_dump_examples'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:23:in `block in xml_dump'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:20:in `xml_dump'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter/rspec3.rb:19:in `dump_summary'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/reporter.rb:201:in `block in notify'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/reporter.rb:200:in `each'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/reporter.rb:200:in `notify'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/reporter.rb:179:in `block in finish'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/reporter.rb:187:in `close_after'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/reporter.rb:168:in `finish'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/reporter.rb:79:in `ensure in report'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/reporter.rb:79:in `report'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:111:in `run_specs'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:87:in `run'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:71:in `run'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:45:in `invoke'
    from /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/exe/rspec:4:in `<main>'
/home/travis/.rvm/rubies/ruby-2.3.1/bin/ruby -I/home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/lib:/home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-support-3.5.0/lib /home/travis/build/danger/danger/bundle/ruby/2.3.0/gems/rspec-core-3.5.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
The command "bundle exec rake spec" exited with 1.

Build log available.

Any idea what went wrong? Thanks!!!

Same issue.

Here is the gem list that led to this error:

Gems included by the bundle:

  • addressable (2.4.0)
  • artifactory (2.5.0)
  • ast (2.3.0)
  • aws-sdk (2.6.5)
  • aws-sdk-core (2.6.5)
  • aws-sdk-resources (2.6.5)
  • backports (3.6.8)
  • berkshelf (5.1.0)
  • berkshelf-api-client (3.0.0)
  • buff-config (2.0.0)
  • buff-extensions (2.0.0)
  • buff-ignore (1.2.0)
  • buff-ruby_engine (1.0.0)
  • buff-shell_out (1.1.0)
  • builder (3.2.2)
  • bundler (1.12.5)
  • celluloid (0.16.0)
  • celluloid-io (0.16.2)
  • chef (12.14.89)
  • chef-config (12.14.89)
  • chef-dk (0.18.30)
  • chef-provisioning (2.0.0)
  • chef-vault (2.9.0)
  • chef-zero (5.1.0)
  • cheffish (4.0.0)
  • chefspec (5.2.0)
  • chronic (0.10.2)
  • chronic_duration (0.10.6)
  • cleanroom (1.0.0)
  • cookbook-omnifetch (0.2.3)
  • cookbook-release (1.1.3)
  • crack (0.4.3)
  • cucumber-core (2.0.0)
  • diff-lcs (1.2.5)
  • erubis (2.7.0)
  • excon (0.53.0)
  • faraday (0.9.2)
  • fauxhai (3.9.0)
  • ffi (1.9.14)
  • ffi-yajl (2.3.0)
  • foodcritic (8.0.0)
  • fuzzyurl (0.9.0)
  • gherkin (4.0.0)
  • gssapi (1.2.0)
  • gyoku (1.3.1)
  • hashdiff (0.3.0)
  • hashie (3.4.6)
  • highline (1.7.8)
  • hitimes (1.2.4)
  • httpclient (2.8.2.4)
  • inifile (3.0.0)
  • iniparse (1.4.2)
  • ipaddress (0.8.3)
  • jmespath (1.3.1)
  • json (2.0.2)
  • kitchen-ec2 (1.2.0 23896c1)
  • kitchen-transport-speedy (0.1.0)
  • kitchen-vagrant (0.20.0)
  • knife-supermarket (0.3.0)
  • libyajl2 (1.2.0)
  • little-plugger (1.1.4)
  • logging (2.1.0)
  • mini_portile2 (2.1.0)
  • minitar (0.5.4)
  • mixlib-archive (0.2.0)
  • mixlib-authentication (1.4.1)
  • mixlib-cli (1.7.0)
  • mixlib-config (2.2.4)
  • mixlib-install (1.2.3)
  • mixlib-log (1.7.1)
  • mixlib-shellout (2.2.7)
  • mixlib-versioning (1.1.0)
  • molinillo (0.5.1)
  • multi_json (1.12.1)
  • multipart-post (2.0.0)
  • net-scp (1.2.1)
  • net-sftp (2.1.2)
  • net-ssh (3.2.0)
  • net-ssh-gateway (1.2.0)
  • net-ssh-multi (1.2.1)
  • net-telnet (0.1.1)
  • nio4r (1.2.1)
  • nokogiri (1.6.8)
  • nori (2.6.0)
  • numerizer (0.1.1)
  • octokit (4.3.0)
  • ohai (8.20.0)
  • paint (1.0.1)
  • parser (2.3.1.4)
  • pkg-config (1.1.7)
  • plist (3.2.0)
  • polyglot (0.3.5)
  • powerpack (0.1.1)
  • proxifier (1.0.3)
  • rack (2.0.1)
  • rainbow (2.1.0)
  • rake (11.3.0)
  • rb-readline (0.5.3)
  • retryable (2.0.4)
  • ridley (5.1.0)
  • rspec (3.5.0)
  • rspec-core (3.5.4)
  • rspec-expectations (3.5.0)
  • rspec-its (1.2.0)
  • rspec-mocks (3.5.0)
  • rspec-support (3.5.0)
  • rspec_junit_formatter (0.2.3)
  • rubocop (0.42.0)
  • rubocop-junit-formatter (0.1.3)
  • ruby-progressbar (1.8.1)
  • rubyntlm (0.6.1)
  • rubyzip (1.2.0)
  • rufus-lru (1.1.0)
  • safe_yaml (1.0.4)
  • sawyer (0.7.0)
  • semantic (1.4.1)
  • semverse (2.0.0)
  • serverspec (2.36.1)
  • sfl (2.2)
  • solve (3.0.1)
  • specinfra (2.63.1)
  • syslog-logger (1.6.8)
  • systemu (2.6.5)
  • test-kitchen (1.13.2)
  • thor (0.19.1)
  • timers (4.0.4)
  • treetop (1.6.8)
  • unicode-display_width (1.1.1)
  • uuidtools (2.1.5)
  • vagrant-wrapper (2.0.3)
  • varia_model (0.6.0)
  • webmock (2.1.0)
  • winrm (1.8.1)
  • winrm-elevated (0.4.0)
  • winrm-fs (0.4.3)
  • wmi-lite (1.0.0)
  • yajl-ruby (1.2.1)

The stack locks like the rspec notification returns nil for the status of the example. Browsing the rspec issues a bit shows stuff like rspec/rspec-core#2290, but that should be shipped in the versions mentioned above already so ☹️

We are running into the same issue too. Any idea if this has been fixed or any known workaround?

we were able to narrow down the issue to another test listener which we have configured to integrate with JIRA and was choking on some special characters.

so when junit listener is trying to access example, the other listener issue might have already caused a unrecoverable error for rspec process that is invoking other listeners?

We are having the same issue on our circle build. Any idea on resolving it?

@kxhitiz did you have any luck resolving this? I have the same problem on my Circle.CI build.

sj26 commented

Hi y'all 👋 Sounds like you should upgrade rspec to solve this issue. If you're running the latest version of rspec (3.6.0) and still seeing this issue then please let me know and I'll investigate further.

Seeing this failure for rspec 3.6.0

/usr/local/bundle/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:29:in `block in xml_dump_examples': undefined method `xml_dump_' for #<RSpecJUnitFormatter:0x0055563a7d3530> (NoMethodError)
	from /usr/local/bundle/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:28:in `each'
	from /usr/local/bundle/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:28:in `xml_dump_examples'
	from /usr/local/bundle/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:23:in `block in xml_dump'
	from /usr/local/bundle/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `call'
	from /usr/local/bundle/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `_nested_structures'
	from /usr/local/bundle/gems/builder-3.2.3/lib/builder/xmlbase.rb:68:in `tag!'
	from /usr/local/bundle/gems/builder-3.2.3/lib/builder/xmlbase.rb:93:in `method_missing'
	from /usr/local/bundle/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter.rb:20:in `xml_dump'
	from /usr/local/bundle/gems/rspec_junit_formatter-0.2.3/lib/rspec_junit_formatter/rspec3.rb:19:in `dump_summary'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:206:in `block in notify'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:205:in `each'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:205:in `notify'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:182:in `block in finish'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:191:in `close_after'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:171:in `finish'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:81:in `ensure in report'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:81:in `report'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:112:in `run_specs'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:87:in `run'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:71:in `run'
	from /usr/local/bundle/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:45:in `invoke'
	from /usr/local/bundle/gems/rspec-core-3.6.0/exe/rspec:4:in `<main>'
sj26 commented

@allcentury please update rspec junit formatter :-)