danger-junit 1.0.0 → 1.0.1

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: a77f977d090351e161a00681133882722b68f9bb6b28ac4cbebff16c2e36828e
4
- data.tar.gz: 43c9a8ed5b86acfe14408d24da7555d396a2495c5ac4eac891390c843e3e4465
3
+ metadata.gz: be6ad016006c6efed33d9d526ef6e67bb8be6e361ac0b7722d8423b5d56a7184
4
+ data.tar.gz: 733a263152c8df94e4768b42ae6817d42b18e626a29cd53d7f4fd920afdd810b
5
5
  SHA512:
6
- metadata.gz: c2592d04156cdab05b89e5462b018ad9fededda320c544d05bea486a468cc6bf30ded2b20c503de339004b3bb588707a39e83d57494ec56b6bc7bd7fbcde35c5
7
- data.tar.gz: b58ab5044bee356598b5f7458d76c40e319e8aa9103087825d3612bffa0a3b6ab022661660d89edca3113da3df67dfbe9ab4e9bde6695cb3b7c47f40668e70d3
6
+ metadata.gz: a93ded9aaae2335e0de0c049d948c153f115852c4b0436268dcb197ec433c15d9240f6b484eb4a1d1a652e49e798a99dcaf8a73396b4255ba9f1c61a40de8256
7
+ data.tar.gz: f41f9a828d2a0a07232d88451a950ccf35b7a99e3547482481b7ed666c9e1a1ce0cf4a786d6427cd23e53304d7ff90b63d6906ba8bfab2cd73d5f86fff66b974
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-junit (1.0.0)
4
+ danger-junit (1.0.1)
5
5
  danger (> 2.0)
6
6
  ox (~> 2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.5.2)
12
- public_suffix (>= 2.0.2, < 4.0)
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
13
  ast (2.3.0)
14
14
  builder (3.2.2)
15
- claide (1.0.2)
15
+ claide (1.0.3)
16
16
  claide-plugins (0.9.2)
17
17
  cork
18
18
  nap
@@ -34,13 +34,14 @@ GEM
34
34
  octokit (~> 4.7)
35
35
  terminal-table (~> 1)
36
36
  diff-lcs (1.2.5)
37
- faraday (0.15.4)
37
+ faraday (0.17.3)
38
38
  multipart-post (>= 1.2, < 3)
39
39
  faraday-http-cache (1.3.1)
40
40
  faraday (~> 0.8)
41
41
  ffi (1.9.14)
42
42
  formatador (0.2.5)
43
- git (1.5.0)
43
+ git (1.7.0)
44
+ rchardet (~> 1.8)
44
45
  guard (2.14.0)
45
46
  formatador (>= 0.2.4)
46
47
  listen (>= 2.7, < 4.0)
@@ -61,17 +62,18 @@ GEM
61
62
  rb-inotify (>= 0.9.7)
62
63
  lumberjack (1.0.10)
63
64
  method_source (0.8.2)
64
- multipart-post (2.0.0)
65
+ multipart-post (2.1.1)
65
66
  nap (1.1.0)
66
67
  nenv (0.3.0)
67
68
  no_proxy_fix (0.1.2)
68
69
  notiffany (0.1.1)
69
70
  nenv (~> 0.1)
70
71
  shellany (~> 0.0)
71
- octokit (4.13.0)
72
+ octokit (4.16.0)
73
+ faraday (>= 0.9)
72
74
  sawyer (~> 0.8.0, >= 0.5.3)
73
75
  open4 (1.3.4)
74
- ox (2.10.0)
76
+ ox (2.13.2)
75
77
  parser (2.3.1.2)
76
78
  ast (~> 2.2)
77
79
  powerpack (0.1.1)
@@ -79,12 +81,13 @@ GEM
79
81
  coderay (~> 1.1.0)
80
82
  method_source (~> 0.8.1)
81
83
  slop (~> 3.4)
82
- public_suffix (3.0.3)
84
+ public_suffix (4.0.5)
83
85
  rainbow (2.1.0)
84
86
  rake (10.5.0)
85
87
  rb-fsevent (0.9.7)
86
88
  rb-inotify (0.9.7)
87
89
  ffi (>= 0.5.0)
90
+ rchardet (1.8.0)
88
91
  rspec (3.5.0)
89
92
  rspec-core (~> 3.5.0)
90
93
  rspec-expectations (~> 3.5.0)
@@ -108,9 +111,9 @@ GEM
108
111
  ruby-progressbar (~> 1.7)
109
112
  unicode-display_width (~> 1.0, >= 1.0.1)
110
113
  ruby-progressbar (1.8.1)
111
- sawyer (0.8.1)
112
- addressable (>= 2.3.5, < 2.6)
113
- faraday (~> 0.8, < 1.0)
114
+ sawyer (0.8.2)
115
+ addressable (>= 2.3.5)
116
+ faraday (> 0.8, < 2.0)
114
117
  shellany (0.0.1)
115
118
  slop (3.6.0)
116
119
  terminal-table (1.7.0)
@@ -136,4 +139,4 @@ DEPENDENCIES
136
139
  yard (~> 0.8)
137
140
 
138
141
  BUNDLED WITH
139
- 1.16.3
142
+ 1.17.3
data/README.md CHANGED
@@ -72,6 +72,7 @@ fail("Tests failed") unless junit.failures.empty?
72
72
  <pre>
73
73
  junit.parse "/path/to/output.xml"
74
74
  junit.show_skipped_tests = true
75
+ junit.skipped_headers = [:name, :file]
75
76
  junit.report</pre>
76
77
  </blockquote>
77
78
 
@@ -109,6 +110,10 @@ message "#{slowest_test[:time]} took #{slowest_test[:time]} seconds"
109
110
  `headers` - An array of symbols that become the columns of your tests,
110
111
  if `nil`, the default, it will be all of the attributes.
111
112
 
113
+ `skipped_headers` - An array of symbols that become the columns of your skipped tests,
114
+ if `nil`, the default, it will be all of the attributes for a single parse
115
+ or all of the common attributes between multiple files
116
+
112
117
 
113
118
 
114
119
  #### Methods
@@ -1,3 +1,3 @@
1
1
  module Junit
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -92,6 +92,13 @@ module Danger
92
92
  # @return [Array<Symbol>]
93
93
  attr_accessor :headers
94
94
 
95
+ # An array of symbols that become the columns of your skipped tests,
96
+ # if `nil`, the default, it will be all of the attributes for a single parse
97
+ # or all of the common attributes between multiple files
98
+ #
99
+ # @return [Array<Symbol>]
100
+ attr_accessor :skipped_headers
101
+
95
102
  # Parses an XML file, which fills all the attributes,
96
103
  # will `raise` for errors
97
104
  # @return [void]
@@ -120,7 +127,7 @@ module Danger
120
127
  failed_tests += failed_suites.map(&:nodes).flatten.select { |node| node.kind_of?(Ox::Element) && node.value == 'testcase' }
121
128
  end
122
129
 
123
- @failures = failed_tests.select do |test|
130
+ @failures = failed_tests.select do |test|
124
131
  test.nodes.count > 0
125
132
  end.select do |test|
126
133
  node = test.nodes.first
@@ -150,41 +157,52 @@ module Danger
150
157
  # @return [void]
151
158
  def report
152
159
  return if failures.nil? # because danger calls `report` before loading a file
153
- warn("Skipped #{skipped.count} tests.") if show_skipped_tests && skipped.count > 0
160
+ if show_skipped_tests && skipped.count > 0
161
+ warn("Skipped #{skipped.count} tests.")
162
+
163
+ message = "### Skipped: \n\n"
164
+ message << get_report_content(skipped, skipped_headers)
165
+ markdown message
166
+
167
+ end
154
168
 
155
169
  unless failures.empty? && errors.empty?
156
170
  fail('Tests have failed, see below for more information.', sticky: false)
157
- message = "### Tests: \n\n"
158
171
 
172
+ message = "### Tests: \n\n"
159
173
  tests = (failures + errors)
174
+ message << get_report_content(tests, header)
175
+ markdown message
176
+ end
177
+ end
160
178
 
161
- common_attributes = tests.map{|test| test.attributes.keys }.inject(&:&)
179
+ private
162
180
 
163
- # check the provided headers are available
164
- unless headers.nil?
165
- not_available_headers = headers.select { |header| not common_attributes.include?(header) }
166
- raise "Some of headers provided aren't available in the JUnit report (#{not_available_headers})" unless not_available_headers.empty?
167
- end
181
+ def get_report_content(tests, headers)
182
+ message = ''
183
+ common_attributes = tests.map{|test| test.attributes.keys }.inject(&:&)
168
184
 
169
- keys = headers || common_attributes
170
- attributes = keys.map(&:to_s).map(&:capitalize)
185
+ # check the provided headers are available
186
+ unless headers.nil?
187
+ not_available_headers = headers.select { |header| not common_attributes.include?(header) }
188
+ raise "Some of headers provided aren't available in the JUnit report (#{not_available_headers})" unless not_available_headers.empty?
189
+ end
171
190
 
172
- # Create the headers
173
- message << attributes.join(' | ') + "|\n"
174
- message << attributes.map { |_| '---' }.join(' | ') + "|\n"
191
+ keys = headers || common_attributes
192
+ attributes = keys.map(&:to_s).map(&:capitalize)
175
193
 
176
- # Map out the keys to the tests
177
- tests.each do |test|
178
- row_values = keys.map { |key| test.attributes[key] }.map { |v| auto_link(v) }
179
- message << row_values.join(' | ') + "|\n"
180
- end
194
+ # Create the headers
195
+ message << attributes.join(' | ') + "|\n"
196
+ message << attributes.map { |_| '---' }.join(' | ') + "|\n"
181
197
 
182
- markdown message
198
+ # Map out the keys to the tests
199
+ tests.each do |test|
200
+ row_values = keys.map { |key| test.attributes[key] }.map { |v| auto_link(v) }
201
+ message << row_values.join(' | ') + "|\n"
183
202
  end
203
+ message
184
204
  end
185
205
 
186
- private
187
-
188
206
  def auto_link(value)
189
207
  if File.exist?(value) && defined?(@dangerfile.github)
190
208
  github.html_link(value, full_path: false)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-junit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orta Therox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-30 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  - !ruby/object:Gem::Version
226
226
  version: '0'
227
227
  requirements: []
228
- rubygems_version: 3.0.3
228
+ rubygems_version: 3.1.2
229
229
  signing_key:
230
230
  specification_version: 4
231
231
  summary: Get automatic inline test reporting for JUnit-conforming XML files