Skip to content

Commit

Permalink
Merge pull request #13 from davidwessman/wrapping-testsuites
Browse files Browse the repository at this point in the history
Adds a wrapping <testsuites> to adhere to standard
  • Loading branch information
aespinosa authored Mar 21, 2024
2 parents c3eed68 + fb38d75 commit f0ceb24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/minitest/junit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def report
instruct[:version] = '1.0'
instruct[:encoding] = 'UTF-8'
doc << instruct

testsuite = Ox::Element.new('testsuite')
testsuite['name'] = @options[:name] || 'minitest'
testsuite['timestamp'] = @options[:timestamp]
Expand All @@ -46,7 +47,10 @@ def report
testsuite << format(result)
end

doc << testsuite
testsuites = Ox::Element.new('testsuites')
testsuites << testsuite

doc << testsuites
@io << Ox.dump(doc)
end

Expand Down
2 changes: 1 addition & 1 deletion test/reporter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_no_tests_generates_an_empty_suite
reporter.report

assert_match(
%r{<?xml version="1.0" encoding="UTF-8"\?>\n<testsuite name="minitest" timestamp="[^"]+" hostname="[^"]+" tests="0" skipped="0" failures="0" errors="0" time="0.000000"\/>},
%r{<?xml version="1.0" encoding="UTF-8"\?>\n<testsuites>\n <testsuite name="minitest" timestamp="[^"]+" hostname="[^"]+" tests="0" skipped="0" failures="0" errors="0" time="0.000000"\/>\n<\/testsuites>\n},
reporter.output
)
end
Expand Down

0 comments on commit f0ceb24

Please sign in to comment.