minitest-reporters 1.3.8 → 1.4.3
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 +30 -7
- data/README.md +5 -2
- data/lib/minitest/minitest_reporter_plugin.rb +6 -0
- data/lib/minitest/reporters/default_reporter.rb +18 -1
- data/lib/minitest/reporters/junit_reporter.rb +27 -17
- data/lib/minitest/reporters/mean_time_reporter.rb +1 -1
- data/lib/minitest/reporters/progress_reporter.rb +1 -2
- data/lib/minitest/reporters/version.rb +1 -1
- data/lib/minitest/templates/index.html.erb +4 -2
- data/test/integration/reporters/progress_reporter_test.rb +6 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 120b4ce6a1a42386c94c34efee2b65fe1964e75d2532553850f39964a7cbe832
|
4
|
+
data.tar.gz: 7ea83aff68338ad236208a6622b4f3b746cbf330d3189897a4edeae064d05a01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1062e3fac40dc4ad46aa3ee6be1f9996bd9b10877b1610083e40372adc6548396d9b7c83edd3c9034447d244e78c463669754498d7b5dd2d99b8d169deb1eb6
|
7
|
+
data.tar.gz: 0c99ed679c71e933e858faa088fa452351ebc0a1f18663a865e1c59741ce99b9d9a55c05b27fb4bd8a2b184da789c3e20f83e13d1a7cdcb049bd7ec45fcf1c6a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,45 @@
|
|
1
|
-
### [dev](https://github.com/kern/minitest-reporters/compare/v1.3
|
1
|
+
### [dev](https://github.com/kern/minitest-reporters/compare/v1.4.3...master)
|
2
2
|
|
3
|
-
### [1.3
|
3
|
+
### [1.4.3](https://github.com/kern/minitest-reporters/compare/v1.4.3...v1.4.2)
|
4
|
+
|
5
|
+
* fixed rare compatability issue between JUnitReporter and older versions of Minitest [#272](https://github.com/minitest-reporters/minitest-reporters/pull/272) contributed by [chakrit](https://github.com/chakrit)
|
6
|
+
* fixed JUnitReporter to use a relative file path if a file path is absolute [#305](https://github.com/minitest-reporters/minitest-reporters/issues/305)
|
7
|
+
* fixed MeanTimeReporter to reset by deleting previous run file [#296](https://github.com/kern/minitest-reporters/pull/296) contributed by [AnythonyClark](https://github.com/AnthonyClark)
|
8
|
+
* removed debug output from ProgressReporter [#301](https://github.com/kern/minitest-reporters/pull/301) contributed by [wvanbergen](https://github.com/wvanbergen)
|
9
|
+
|
10
|
+
### [1.4.2](https://github.com/kern/minitest-reporters/compare/v1.4.1...v1.4.2) (2019-10-26)
|
11
|
+
|
12
|
+
* fixed DelegateReporter to delegate prerecord() [#294](https://github.com/kern/minitest-reporters/pull/294) contributed by [mame](https://github.com/mame)
|
13
|
+
|
14
|
+
### [1.4.1](https://github.com/kern/minitest-reporters/compare/v1.4....v1.4.1) (2019-10-10)
|
15
|
+
|
16
|
+
* fixed Time.current replaced with Time.now in HTML reporter's remplate [#293](https://github.com/kern/minitest-reporters/issues/293)
|
17
|
+
|
18
|
+
### [1.4.0](https://github.com/kern/minitest-reporters/compare/v1.4.0.beta1...v1.4.0) (2019-10-06)
|
19
|
+
|
20
|
+
* travis updated to include ruby 2.6 ([#292](https://github.com/kern/minitest-reporters/pull/292) contributed by [pvalena](https://github.com/pvalena))
|
21
|
+
* location option added to DefaultReporter [#288](https://github.com/kern/minitest-reporters/pull/288) contributed by [bmo](https://github.com/bmo)
|
22
|
+
* Date and time added to HTML report [#287](https://github.com/kern/minitest-reporters/pull/287) contributed by [cderche](https://github.com/cderche)
|
23
|
+
|
24
|
+
### [1.4.0.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.8...v1.4.0.beta1) (2019-08-28)
|
25
|
+
|
26
|
+
* JUnitReporter changed to be compatible with the spec [#286](https://github.com/kern/minitest-reporters/pull/286) contributed by [dylanahsmith](https://github.com/dylanahsmith)
|
27
|
+
|
28
|
+
### [1.3.8](https://github.com/kern/minitest-reporters/compare/v1.3.7...v1.3.8) (2019-08-14)
|
4
29
|
|
5
30
|
* Fixed default ProgressReporter regression from [#278](https://github.com/kern/minitest-reporters/pull/278); fix [#284](https://github.com/kern/minitest-reporters/pull/284) contributed by [bobmaerten](https://github.com/bobmaerten)
|
6
31
|
|
7
|
-
### [1.3.7](https://github.com/kern/minitest-reporters/compare/v1.3.6...v1.3.7)
|
32
|
+
### [1.3.7](https://github.com/kern/minitest-reporters/compare/v1.3.6...v1.3.7) (2019-08-14)
|
8
33
|
|
9
34
|
* added ability to specify output dir of JUnitReporter through ENV [#277](https://github.com/kern/minitest-reporters/pull/277) countributed by [KevinSjoberg](https://github.com/KevinSjoberg)
|
10
35
|
* Added verbose functionality to ProgressReporter [#278](https://github.com/kern/minitest-reporters/pull/278) contributed by [senhalil](https://github.com/senhalil)
|
11
36
|
|
12
|
-
### [1.3.6](https://github.com/kern/minitest-reporters/compare/v1.3.5...v1.3.6)
|
37
|
+
### [1.3.6](https://github.com/kern/minitest-reporters/compare/v1.3.5...v1.3.6) (2019-01-16)
|
13
38
|
|
14
39
|
* fixed possible null pointer in #after_suite [#274](https://github.com/kern/minitest-reporters/pull/274)
|
15
40
|
contributed by [casperisfine](https://github.com/casperisfine)
|
16
41
|
|
17
|
-
### [1.3.5](https://github.com/kern/minitest-reporters/compare/v1.3.5.beta1...v1.3.5)
|
42
|
+
### [1.3.5](https://github.com/kern/minitest-reporters/compare/v1.3.5.beta1...v1.3.5) (2018-09-30)
|
18
43
|
|
19
44
|
### [1.3.5.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.4...v1.3.5.beta1)
|
20
45
|
|
@@ -98,5 +123,3 @@
|
|
98
123
|
## [1.1.15](https://github.com/kern/minitest-reporters/compare/v1.1.14...v1.1.15)
|
99
124
|
|
100
125
|
* Fixed problem with handling SIGINFO [#231](https://github.com/kern/minitest-reporters/pull/231) (contributed by [joshpencheon](https://github.com/joshpencheon))
|
101
|
-
|
102
|
-
|
data/README.md
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
# minitest-reporters - create customizable Minitest output formats
|
5
5
|
|
6
|
-
[![Join the chat at https://gitter.im/kern/minitest-reporters](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kern/minitest-reporters?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
7
6
|
[![Gem Version](https://badge.fury.io/rb/minitest-reporters.svg)][gem]
|
8
7
|
[![Build Status](https://secure.travis-ci.org/kern/minitest-reporters.png)][travis]
|
9
8
|
[![Windows build status](https://ci.appveyor.com/api/projects/status/3pugsxatwcldgyjd/branch/master?svg=true)](https://ci.appveyor.com/project/os97673/minitest-reporters/branch/master)
|
@@ -46,7 +45,7 @@ To override this behavior, you may set the ENV variable MINITEST_REPORTER:
|
|
46
45
|
export MINITEST_REPORTER=JUnitReporter
|
47
46
|
```
|
48
47
|
|
49
|
-
Detection of those systems is based on presence of certain ENV variables and are
|
48
|
+
Detection of those systems is based on presence of certain ENV variables and are evaluated in the following order:
|
50
49
|
|
51
50
|
```
|
52
51
|
MINITEST_REPORTER => use reporter indicated in env variable
|
@@ -117,6 +116,10 @@ The third parameter to `.use!`, in this case `Minitest.backtrace_filter`, should
|
|
117
116
|
filter object. In the above example, you're telling minitest-reporters to use the filter
|
118
117
|
that Rails has already set.
|
119
118
|
|
119
|
+
**Test Anything Protocol (TAP)**
|
120
|
+
|
121
|
+
The [Test Anything Protocol](https://testanything.org) is a specification for outputting test results in an implementation-agnostic manner so that various tools can read the output. If you need to produce TAP-compliant output for Minitest results, see this [blog post](https://dev.to/davidwessman/rails-minitest-results-output-in-tap-format-for-heroku-ci-46d3) and [gist](https://gist.github.com/davidwessman/09a13840a8a80080e3842ac3051714c7) by [@davidwessman](https://github.com/davidwessman).
|
122
|
+
|
120
123
|
## Note on Patches/Pull Requests ##
|
121
124
|
|
122
125
|
* Fork the project.
|
@@ -16,6 +16,12 @@ module Minitest
|
|
16
16
|
all_reporters.each(&:start)
|
17
17
|
end
|
18
18
|
|
19
|
+
def prerecord(klass, name)
|
20
|
+
all_reporters.each do |reporter|
|
21
|
+
reporter.prerecord klass, name
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
19
25
|
def record(result)
|
20
26
|
all_reporters.each do |reporter|
|
21
27
|
reporter.record result
|
@@ -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)
|
@@ -59,14 +61,18 @@ module Minitest
|
|
59
61
|
def get_relative_path(result)
|
60
62
|
file_path = Pathname.new(get_source_location(result).first)
|
61
63
|
base_path = Pathname.new(@base_path)
|
62
|
-
|
63
|
-
file_path
|
64
|
+
|
65
|
+
if file_path.absolute?
|
66
|
+
file_path.relative_path_from(base_path)
|
67
|
+
else
|
68
|
+
file_path
|
69
|
+
end
|
64
70
|
end
|
65
71
|
|
66
72
|
private
|
67
73
|
|
68
74
|
def get_source_location(result)
|
69
|
-
if result.respond_to? :
|
75
|
+
if result.respond_to? :source_location
|
70
76
|
result.source_location
|
71
77
|
else
|
72
78
|
result.method(result.name).source_location
|
@@ -99,16 +105,16 @@ module Minitest
|
|
99
105
|
txt.sub(/\n.*/m, '...')
|
100
106
|
end
|
101
107
|
|
102
|
-
|
108
|
+
failure = test.failure
|
103
109
|
|
104
110
|
if test.skipped?
|
105
|
-
xml.skipped(:type =>
|
111
|
+
xml.skipped(:type => failure.error.class.name)
|
106
112
|
elsif test.error?
|
107
|
-
xml.error(:type =>
|
113
|
+
xml.error(:type => failure.error.class.name, :message => xml.trunc!(failure.message)) do
|
108
114
|
xml.text!(message_for(test))
|
109
115
|
end
|
110
|
-
elsif
|
111
|
-
xml.failure(:type =>
|
116
|
+
elsif failure
|
117
|
+
xml.failure(:type => failure.error.class.name, :message => xml.trunc!(failure.message)) do
|
112
118
|
xml.text!(message_for(test))
|
113
119
|
end
|
114
120
|
end
|
@@ -134,6 +140,7 @@ module Minitest
|
|
134
140
|
last_before_assertion = ''
|
135
141
|
exception.backtrace.reverse_each do |s|
|
136
142
|
break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
|
143
|
+
|
137
144
|
last_before_assertion = s
|
138
145
|
end
|
139
146
|
last_before_assertion.sub(/:in .*$/, '')
|
@@ -159,7 +166,10 @@ module Minitest
|
|
159
166
|
while File.exist?(File.join(@reports_path, filename)) # restrict number of tries, to avoid infinite loops
|
160
167
|
file_counter += 1
|
161
168
|
filename = "TEST-#{suite_name}-#{file_counter}.xml"
|
162
|
-
|
169
|
+
if file_counter >= 99
|
170
|
+
puts "Too many duplicate files, overwriting earlier report #{filename}"
|
171
|
+
break
|
172
|
+
end
|
163
173
|
end
|
164
174
|
File.join(@reports_path, filename)
|
165
175
|
end
|
@@ -87,8 +87,7 @@ module Minitest
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def print_test_with_time(test)
|
90
|
-
|
91
|
-
print(" %s#%s (%.2fs)" % [test.name, test_class(test), total_time])
|
90
|
+
print(" %s#%s (%.2fs)" % [test_class(test), test.name, total_time])
|
92
91
|
end
|
93
92
|
|
94
93
|
def color
|
@@ -11,7 +11,9 @@
|
|
11
11
|
<body>
|
12
12
|
<div class="container">
|
13
13
|
<div class="jumbotron">
|
14
|
-
<
|
14
|
+
<h3><small>Generated on <%= Time.now.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>
|
@@ -6,17 +6,17 @@ module MinitestReportersTest
|
|
6
6
|
fixtures_directory = File.expand_path('../../../fixtures', __FILE__)
|
7
7
|
test_filename = File.join(fixtures_directory, 'progress_test.rb')
|
8
8
|
output = `#{ruby_executable} #{test_filename} 2>&1`
|
9
|
-
assert_match '
|
10
|
-
assert_match '
|
11
|
-
assert_match '
|
9
|
+
assert_match 'test_error', output, 'Errors should be displayed'
|
10
|
+
assert_match 'test_failure', output, 'Failures should be displayed'
|
11
|
+
assert_match 'test_skip', output, 'Skipped tests should be displayed'
|
12
12
|
end
|
13
13
|
def test_skipped_tests_are_not_displayed
|
14
14
|
fixtures_directory = File.expand_path('../../../fixtures', __FILE__)
|
15
15
|
test_filename = File.join(fixtures_directory, 'progress_detailed_skip_test.rb')
|
16
16
|
output = `#{ruby_executable} #{test_filename} 2>&1`
|
17
|
-
assert_match '
|
18
|
-
assert_match '
|
19
|
-
refute_match '
|
17
|
+
assert_match 'test_error', output, 'Errors should be displayed'
|
18
|
+
assert_match 'test_failure', output, 'Failures should be displayed'
|
19
|
+
refute_match 'test_skip', output, 'Skipped tests should not be displayed'
|
20
20
|
end
|
21
21
|
def test_progress_works_with_filter_and_specs
|
22
22
|
fixtures_directory = File.expand_path('../../../fixtures', __FILE__)
|
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.3
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kern
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -170,7 +170,7 @@ homepage: https://github.com/CapnKernul/minitest-reporters
|
|
170
170
|
licenses:
|
171
171
|
- MIT
|
172
172
|
metadata: {}
|
173
|
-
post_install_message:
|
173
|
+
post_install_message:
|
174
174
|
rdoc_options: []
|
175
175
|
require_paths:
|
176
176
|
- lib
|
@@ -185,8 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
|
-
rubygems_version: 3.
|
189
|
-
signing_key:
|
188
|
+
rubygems_version: 3.1.4
|
189
|
+
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: Create customizable Minitest output formats
|
192
192
|
test_files:
|