Skip to content

Commit

Permalink
Added support to read outside error count returned from XML formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
pingfr committed Mar 30, 2020
1 parent 3738c28 commit 81629da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec_junit_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def xml_dump
output << %{ tests="#{example_count}"}
output << %{ skipped="#{pending_count}"}
output << %{ failures="#{failure_count}"}
output << %{ errors="0"}
output << %{ errors="#{error_count}"}
output << %{ time="#{escape("%.6f" % duration)}"}
output << %{ timestamp="#{escape(started.iso8601)}"}
output << %{ hostname="#{escape(Socket.gethostname)}"}
Expand Down
8 changes: 8 additions & 0 deletions lib/rspec_junit_formatter/rspec3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def examples
@examples_notification.notifications
end

def error_count
reports_errors_outside? ? @summary_notification.errors_outside_of_examples_count : 0
end

def result_of(notification)
notification.example.execution_result.status
end
Expand Down Expand Up @@ -125,6 +129,10 @@ def without_color
end
end

def reports_errors_outside?
Gem::Version.new(RSpec::Core::Version::STRING) >= Gem::Version.new("3.6")
end

def stdout_for(example_notification)
example_notification.example.metadata[:stdout]
end
Expand Down

0 comments on commit 81629da

Please sign in to comment.