minitest-junit 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28a6272dfe9b52525afbcfc9a98fa0610bca6531d685f2e1c2bb5c838ac55480
4
- data.tar.gz: 561f4eb58db6d84edd0c6da41aa463f736a14984870aa7b4f00e6bdefae09133
3
+ metadata.gz: e77d4317b3cfdd887b3a79497498e5117a9e7ce1c38670c5b045b34eb2926c54
4
+ data.tar.gz: decabac10b6b204e9518444c7bb4cc363746e33df37749335f8da88aaa59c0a4
5
5
  SHA512:
6
- metadata.gz: 57482ae234635c9a5f9f697d964361b614e8d47da5a5a60e9e49ae4a7f1aab7b7771af7f902f0cbb49272c2404bd9e612913d7926a7c8c437a116d9b01dc2f58
7
- data.tar.gz: 33b11351e74c51bd4ba23549165b4138837574396d08a2da97c0e33e51ae0efcf9a84c5367d1d2f328005deb66763372462ef209968b96d0ae20111a71715dfc
6
+ metadata.gz: 874208f1793f8824d98bf84cb5f72c720780d4c8c7be01d872693e80a97bd469f6e06638fa9cbfe1c44b8276eac7f9d5b7731051488d78a17a5995344ed10c9d
7
+ data.tar.gz: 87e1ee1a293c2cd58a1e64f2129db7b76d6ff766832ab48901f22031fabf53823ae4c7487e033366737ed56caabbc2fddc2c197ad2153c74c9cafb95169deef8
@@ -1,6 +1,6 @@
1
1
  module Minitest
2
2
  # :nodoc:
3
3
  module Junit
4
- VERSION = '2.0.1'
4
+ VERSION = '2.1.0'
5
5
  end
6
6
  end
@@ -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
 
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-junit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allan Espinosa