minitest-reporters 1.4.0.beta1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +7 -1
- data/lib/minitest/reporters/default_reporter.rb +18 -1
- data/lib/minitest/reporters/junit_reporter.rb +15 -9
- data/lib/minitest/reporters/version.rb +1 -1
- data/lib/minitest/templates/index.html.erb +4 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a0d617bd5555dc8aa2251bb8e6351700ac826b81c76a4146aa46c4de04bf37c
|
4
|
+
data.tar.gz: e1b2ab8a11ae00a613b75134008c6be55a0efb53c42c186346e40a90f76546e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89af1791568eb12157ee3d438a27f97dbecad07d5c92a9bc307c21b1079b584444384107acac7c8b972962c3fe3ba66b77a749aa1e836c2e8c924c1fb79f9a76
|
7
|
+
data.tar.gz: 1a5698902d3237adc9711b68732fe3b6029a33ab2e79dd720261b5bec9689fc83767c4d91b3f4f71280b19abdd626b6429dfb44a389eab36892f66f9ab9e43e2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
### [dev](https://github.com/kern/minitest-reporters/compare/v1.4.0
|
1
|
+
### [dev](https://github.com/kern/minitest-reporters/compare/v1.4.0...master)
|
2
|
+
|
3
|
+
### [1.4.0](https://github.com/kern/minitest-reporters/compare/v1.4.0.beta1...v1.4.0)
|
4
|
+
|
5
|
+
* travis updated to include ruby 2.6 ([#292](https://github.com/kern/minitest-reporters/pull/292) contributed by [pvalena](https://github.com/pvalena))
|
6
|
+
* location option added to DefaultReporter [#288](https://github.com/kern/minitest-reporters/pull/288) contributed by [bmo](https://github.com/bmo)
|
7
|
+
* Date and time added to HTML report [#287](https://github.com/kern/minitest-reporters/pull/287) contributed by [cderche](https://github.com/cderche)
|
2
8
|
|
3
9
|
### [1.4.0.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.8...v1.4.0.beta1)
|
4
10
|
|
@@ -19,6 +19,7 @@ module Minitest
|
|
19
19
|
@suite_times = []
|
20
20
|
@suite_start_times = {}
|
21
21
|
@fast_fail = options.fetch(:fast_fail, false)
|
22
|
+
@show_test_location = options.fetch(:location, false)
|
22
23
|
@options = options
|
23
24
|
end
|
24
25
|
|
@@ -141,11 +142,28 @@ module Minitest
|
|
141
142
|
unless message.nil? || message.strip == ''
|
142
143
|
puts
|
143
144
|
puts colored_for(result(test), message)
|
145
|
+
if @show_test_location
|
146
|
+
location = get_source_location(test)
|
147
|
+
puts "\n\n#{relative_path(location[0])}:#{location[1]}"
|
148
|
+
end
|
149
|
+
|
144
150
|
end
|
145
151
|
end
|
146
152
|
|
147
153
|
private
|
148
154
|
|
155
|
+
def relative_path(path)
|
156
|
+
Pathname.new(path).relative_path_from(Pathname.new(Dir.getwd))
|
157
|
+
end
|
158
|
+
|
159
|
+
def get_source_location(result)
|
160
|
+
if result.respond_to? :klass
|
161
|
+
result.source_location
|
162
|
+
else
|
163
|
+
result.method(result.name).source_location
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
149
167
|
def color?
|
150
168
|
return @color if defined?(@color)
|
151
169
|
@color = @options.fetch(:color) do
|
@@ -187,7 +205,6 @@ module Minitest
|
|
187
205
|
|
188
206
|
def location(exception)
|
189
207
|
last_before_assertion = ''
|
190
|
-
|
191
208
|
exception.backtrace.reverse_each do |s|
|
192
209
|
break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
|
193
210
|
last_before_assertion = s
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'builder'
|
2
4
|
require 'fileutils'
|
3
5
|
require 'pathname'
|
@@ -10,7 +12,7 @@ module Minitest
|
|
10
12
|
# Also inspired by Marc Seeger's attempt at producing a JUnitReporter (see https://github.com/rb2k/minitest-reporters/commit/e13d95b5f884453a9c77f62bc5cba3fa1df30ef5)
|
11
13
|
# Also inspired by minitest-ci (see https://github.com/bhenderson/minitest-ci)
|
12
14
|
class JUnitReporter < BaseReporter
|
13
|
-
DEFAULT_REPORTS_DIR = "test/reports"
|
15
|
+
DEFAULT_REPORTS_DIR = "test/reports"
|
14
16
|
|
15
17
|
attr_reader :reports_path
|
16
18
|
|
@@ -20,20 +22,20 @@ module Minitest
|
|
20
22
|
@single_file = options[:single_file]
|
21
23
|
@base_path = options[:base_path] || Dir.pwd
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
return unless empty
|
26
|
+
|
27
|
+
puts "Emptying #{@reports_path}"
|
28
|
+
FileUtils.mkdir_p(@reports_path)
|
29
|
+
File.delete(*Dir.glob("#{@reports_path}/TEST-*.xml"))
|
28
30
|
end
|
29
31
|
|
30
32
|
def report
|
31
33
|
super
|
32
34
|
|
33
35
|
puts "Writing XML reports to #{@reports_path}"
|
34
|
-
suites = tests.group_by
|
36
|
+
suites = tests.group_by do |test|
|
35
37
|
test_class(test)
|
36
|
-
|
38
|
+
end
|
37
39
|
|
38
40
|
if @single_file
|
39
41
|
xml = Builder::XmlMarkup.new(:indent => 2)
|
@@ -134,6 +136,7 @@ module Minitest
|
|
134
136
|
last_before_assertion = ''
|
135
137
|
exception.backtrace.reverse_each do |s|
|
136
138
|
break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
|
139
|
+
|
137
140
|
last_before_assertion = s
|
138
141
|
end
|
139
142
|
last_before_assertion.sub(/:in .*$/, '')
|
@@ -159,7 +162,10 @@ module Minitest
|
|
159
162
|
while File.exist?(File.join(@reports_path, filename)) # restrict number of tries, to avoid infinite loops
|
160
163
|
file_counter += 1
|
161
164
|
filename = "TEST-#{suite_name}-#{file_counter}.xml"
|
162
|
-
|
165
|
+
if file_counter >= 99
|
166
|
+
puts "Too many duplicate files, overwriting earlier report #{filename}"
|
167
|
+
break
|
168
|
+
end
|
163
169
|
end
|
164
170
|
File.join(@reports_path, filename)
|
165
171
|
end
|
@@ -11,7 +11,9 @@
|
|
11
11
|
<body>
|
12
12
|
<div class="container">
|
13
13
|
<div class="jumbotron">
|
14
|
-
<
|
14
|
+
<h3><small>Generated on <%= Time.current.strftime("%b %d, %Y at %H:%M %Z") %></small></h3>
|
15
|
+
<h1>
|
16
|
+
<%= title %></h1>
|
15
17
|
<p>
|
16
18
|
Finished in <%= total_time_to_hms %>, <%= '%.2f tests/s' % (count / total_time) %>, <%= '%.2f assertions/s' % (assertions / total_time) %>
|
17
19
|
</p>
|
@@ -80,4 +82,4 @@
|
|
80
82
|
<% end %>
|
81
83
|
</div>
|
82
84
|
</body>
|
83
|
-
</html>
|
85
|
+
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-reporters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.0
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -181,9 +181,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: 1.9.3
|
182
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
|
-
- - "
|
184
|
+
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
186
|
+
version: '0'
|
187
187
|
requirements: []
|
188
188
|
rubygems_version: 3.0.3
|
189
189
|
signing_key:
|