minitest-junit 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/minitest/junit/version.rb +1 -1
- data/lib/minitest/junit.rb +11 -0
- data/test/reporter_test.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e77d4317b3cfdd887b3a79497498e5117a9e7ce1c38670c5b045b34eb2926c54
|
4
|
+
data.tar.gz: decabac10b6b204e9518444c7bb4cc363746e33df37749335f8da88aaa59c0a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 874208f1793f8824d98bf84cb5f72c720780d4c8c7be01d872693e80a97bd469f6e06638fa9cbfe1c44b8276eac7f9d5b7731051488d78a17a5995344ed10c9d
|
7
|
+
data.tar.gz: 87e1ee1a293c2cd58a1e64f2129db7b76d6ff766832ab48901f22031fabf53823ae4c7487e033366737ed56caabbc2fddc2c197ad2153c74c9cafb95169deef8
|
data/lib/minitest/junit.rb
CHANGED
@@ -62,6 +62,7 @@ module Minitest
|
|
62
62
|
testcase['file'] = relative_to_cwd(result.source_location.first)
|
63
63
|
testcase['line'] = result.source_location.last
|
64
64
|
testcase['assertions'] = result.assertions
|
65
|
+
|
65
66
|
if result.skipped?
|
66
67
|
skipped = Ox::Element.new('skipped')
|
67
68
|
skipped['message'] = result
|
@@ -76,6 +77,16 @@ module Minitest
|
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
80
|
+
# Minitest 5.19 supports metadata
|
81
|
+
# Rails 7.1 adds `failure_screenshot_path` to metadata
|
82
|
+
# Output according to Gitlab format
|
83
|
+
# https://docs.gitlab.com/ee/ci/testing/unit_test_reports.html#view-junit-screenshots-on-gitlab
|
84
|
+
if result.respond_to?("metadata") && result.metadata[:failure_screenshot_path]
|
85
|
+
screenshot = Ox::Element.new("system-out")
|
86
|
+
screenshot << "[[ATTACHMENT|#{result.metadata[:failure_screenshot_path]}]]"
|
87
|
+
testcase << screenshot
|
88
|
+
end
|
89
|
+
|
79
90
|
testcase
|
80
91
|
end
|
81
92
|
|
data/test/reporter_test.rb
CHANGED
@@ -49,8 +49,9 @@ class ReporterTest < Minitest::Test
|
|
49
49
|
results.each do |result|
|
50
50
|
parsed_report.xpath("//testcase[@name='#{result.name}']").any?
|
51
51
|
end
|
52
|
-
# Check if some testcase has a failure
|
52
|
+
# Check if some testcase has a failure and screenshot path
|
53
53
|
assert parsed_report.xpath("//testcase//failure").any?
|
54
|
+
assert parsed_report.xpath("//testcase//system-out").any?
|
54
55
|
end
|
55
56
|
|
56
57
|
def test_xml_nodes_has_file_and_line_attributes
|
@@ -93,6 +94,11 @@ class ReporterTest < Minitest::Test
|
|
93
94
|
end
|
94
95
|
end.new
|
95
96
|
end
|
97
|
+
|
98
|
+
if failures.positive?
|
99
|
+
test.metadata[:failure_screenshot_path] = '/tmp/screenshot.png'
|
100
|
+
end
|
101
|
+
|
96
102
|
Minitest::Result.from test
|
97
103
|
end
|
98
104
|
|