minitest-reporters 1.3.1 → 1.3.2.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -0
- data/.travis.yml +6 -3
- data/CHANGELOG.md +12 -5
- data/LICENSE +2 -2
- data/Rakefile +10 -0
- data/lib/minitest/reporters/base_reporter.rb +19 -13
- data/lib/minitest/reporters/default_reporter.rb +1 -1
- data/lib/minitest/reporters/mean_time_reporter.rb +9 -10
- data/lib/minitest/reporters/spec_reporter.rb +1 -1
- data/lib/minitest/reporters/version.rb +1 -1
- data/minitest-reporters.gemspec +1 -0
- data/test/fixtures/mean_time_test.rb +29 -1
- data/test/fixtures/spec_test.rb +6 -1
- data/test/unit/minitest/mean_time_reporter_unit_test.rb +1 -1
- data/test/unit/minitest/spec_reporter_test.rb +20 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3257dd726eea7dfcb07c3945e9066149fcbbd6c5cd8c7d4a05fa259c6f1fc849
|
4
|
+
data.tar.gz: 266cd94a13ebe4b9899feed855e9831edc03f87e8a137813df4067d15ab73499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2c695a962ded855e76c60c55a668f7b0d77d2b111c713367912a61e138f548861cf940877a1410a63d1b91550bc3c18986d28e864ec95b941b79894077aa15f
|
7
|
+
data.tar.gz: 13d3872725a4bb52c928e5238ebcc90f1e27c2660aaa0e2427860a5d0ec85532248d7e950f77516ff923a0a210f4048545f15c561e18a6c1278061a2579e831b
|
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
-
### [dev](https://github.com/kern/minitest-reporters/compare/v1.3.
|
1
|
+
### [dev](https://github.com/kern/minitest-reporters/compare/v1.3.2.beta1...master)
|
2
2
|
|
3
|
-
### [
|
3
|
+
### [1.3.2.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.1...v1.3.2.beta1)
|
4
4
|
|
5
|
-
|
5
|
+
* SpecReporter do not print exception name any more (unless it is an test error) [#264](https://github.com/kern/minitest-reporters/pull/264)
|
6
|
+
* Fixed loading error caused by fix for [#265](https://github.com/kern/minitest-reporters/pull/265)
|
7
|
+
see [#267](https://github.com/kern/minitest-reporters/pull/267) and
|
8
|
+
[#268](https://github.com/kern/minitest-reporters/pull/268) for more details.
|
9
|
+
|
10
|
+
### [1.3.1](https://github.com/kern/minitest-reporters/compare/v1.3.1.beta1...v1.3.1)
|
11
|
+
|
12
|
+
### [1.3.1.beta1](https://github.com/kern/minitest-reporters/compare/v1.3.0...v1.3.1.beta1)
|
6
13
|
|
7
14
|
* Fixed time reporting [#265](https://github.com/kern/minitest-reporters/pull/265) contributed by [brendandeere](https://github.com/brendandeere)
|
8
15
|
|
9
|
-
### [
|
16
|
+
### [1.3.0](https://github.com/kern/minitest-reporters/compare/v1.3.0.beta3...v1.3.0)
|
10
17
|
|
11
|
-
### [
|
18
|
+
### [1.3.0.beta3](https://github.com/kern/minitest-reporters/compare/v1.3.0.beta2...v1.3.0.beta3)
|
12
19
|
|
13
20
|
* [#261](https://github.com/kern/minitest-reporters/issues/261) fixed by [#262](https://github.com/kern/minitest-reporters/pull/262) contributed by [trabulmonkee](https://github.com/trabulmonkee)
|
14
21
|
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2018 Alexander Kern
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
|
+
require 'rubocop/rake_task'
|
3
4
|
|
4
5
|
task :default => :test
|
5
6
|
Rake::TestTask.new do |t|
|
@@ -58,3 +59,12 @@ task :reset_statistics do
|
|
58
59
|
puts "The mean time reporter statistics have been reset."
|
59
60
|
exit 0
|
60
61
|
end
|
62
|
+
|
63
|
+
desc 'Run RuboCop on the lib directory'
|
64
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
65
|
+
task.patterns = ['lib/**/*.rb']
|
66
|
+
# only show the files with failures
|
67
|
+
task.formatters = ['clang']
|
68
|
+
# don't abort rake on failure
|
69
|
+
task.fail_on_error = false
|
70
|
+
end
|
@@ -1,5 +1,15 @@
|
|
1
1
|
module Minitest
|
2
2
|
module Reporters
|
3
|
+
class Suite
|
4
|
+
attr_reader :name
|
5
|
+
def initialize(name)
|
6
|
+
@name = name
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_s
|
10
|
+
name.to_s
|
11
|
+
end
|
12
|
+
end
|
3
13
|
class BaseReporter < Minitest::StatisticsReporter
|
4
14
|
attr_accessor :tests
|
5
15
|
|
@@ -14,11 +24,12 @@ module Minitest
|
|
14
24
|
|
15
25
|
# called by our own before hooks
|
16
26
|
def before_test(test)
|
17
|
-
last_test = tests.last
|
18
|
-
|
27
|
+
last_test = test_class(tests.last)
|
28
|
+
|
29
|
+
suite_changed = last_test.nil? || last_test.name != test.class.name
|
19
30
|
|
20
31
|
if suite_changed
|
21
|
-
after_suite(
|
32
|
+
after_suite(last_test) if last_test
|
22
33
|
before_suite(test.class)
|
23
34
|
end
|
24
35
|
end
|
@@ -58,8 +69,11 @@ module Minitest
|
|
58
69
|
end
|
59
70
|
|
60
71
|
def test_class(result)
|
61
|
-
|
62
|
-
|
72
|
+
# Minitest broke API between 5.10 and 5.11 this gets around Result object
|
73
|
+
if result.nil?
|
74
|
+
nil
|
75
|
+
elsif result.respond_to? :klass
|
76
|
+
Suite.new(result.klass)
|
63
77
|
else
|
64
78
|
result.class
|
65
79
|
end
|
@@ -106,14 +120,6 @@ module Minitest
|
|
106
120
|
trace.each { |line| print_with_info_padding(line) }
|
107
121
|
end
|
108
122
|
end
|
109
|
-
|
110
|
-
# This method is to be version compatible with ruby 1.X. In these
|
111
|
-
# versions constant lookup was not namespace aware
|
112
|
-
def load_constant(name)
|
113
|
-
name.to_s.split('::').inject(Object) do |namespace, const_name|
|
114
|
-
namespace.const_get(const_name)
|
115
|
-
end
|
116
|
-
end
|
117
123
|
end
|
118
124
|
end
|
119
125
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'minitest/reporters'
|
2
|
+
require 'tmpdir'
|
2
3
|
require 'yaml'
|
3
4
|
|
4
5
|
module Minitest
|
@@ -125,8 +126,8 @@ module Minitest
|
|
125
126
|
show_progress: true,
|
126
127
|
show_all_runs: true,
|
127
128
|
sort_column: :avg,
|
128
|
-
previous_runs_filename: '/
|
129
|
-
report_filename: '
|
129
|
+
previous_runs_filename: Dir.tmpdir + '/minitest_reporters_previous_run',
|
130
|
+
report_filename: Dir.tmpdir + 'minitest_reporters_report'
|
130
131
|
}
|
131
132
|
end
|
132
133
|
|
@@ -249,15 +250,13 @@ module Minitest
|
|
249
250
|
def create_or_update_previous_runs!
|
250
251
|
if previously_ran?
|
251
252
|
current_run.each do |description, elapsed|
|
252
|
-
|
253
|
-
|
253
|
+
new_times = if previous_run[description.to_s]
|
254
|
+
Array(previous_run[description.to_s]) << elapsed
|
255
|
+
else
|
256
|
+
Array(elapsed)
|
257
|
+
end
|
254
258
|
|
255
|
-
|
256
|
-
Array(elapsed)
|
257
|
-
|
258
|
-
end
|
259
|
-
|
260
|
-
previous_run.store("#{description}", new_times)
|
259
|
+
previous_run.store(description.to_s, new_times)
|
261
260
|
end
|
262
261
|
|
263
262
|
File.write(previous_runs_filename, previous_run.to_yaml)
|
data/minitest-reporters.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
|
24
24
|
s.add_development_dependency 'maruku'
|
25
25
|
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'rubocop'
|
26
27
|
|
27
28
|
s.files = `git ls-files`.split("\n")
|
28
29
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -5,4 +5,32 @@ require 'minitest/reporters/mean_time_reporter'
|
|
5
5
|
|
6
6
|
Minitest::Reporters.use! Minitest::Reporters::MeanTimeReporter.new
|
7
7
|
|
8
|
-
|
8
|
+
class TestClass < Minitest::Test
|
9
|
+
def test_assertion
|
10
|
+
assert true
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_fail
|
14
|
+
fail
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class AnotherTestClass < Minitest::Test
|
19
|
+
def test_assertion
|
20
|
+
assert true
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_fail
|
24
|
+
fail
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class LastTestClass < Minitest::Test
|
29
|
+
def test_assertion
|
30
|
+
assert true
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_fail
|
34
|
+
fail
|
35
|
+
end
|
36
|
+
end
|
data/test/fixtures/spec_test.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
+
require 'bundler/setup'
|
1
2
|
require 'minitest'
|
2
3
|
require 'minitest/reporters'
|
3
4
|
require 'minitest/autorun'
|
4
5
|
|
5
|
-
Minitest::Reporters.use! Minitest::Reporters::
|
6
|
+
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
6
7
|
|
7
8
|
describe String do
|
8
9
|
describe '#length' do
|
9
10
|
it 'works' do
|
10
11
|
assert_equal 5, 'hello'.length
|
11
12
|
end
|
13
|
+
|
14
|
+
it 'doesn\'t works' do
|
15
|
+
assert_equal 6, 'hello'.length
|
16
|
+
end
|
12
17
|
end
|
13
18
|
end
|
@@ -37,5 +37,25 @@ module MinitestReportersTest
|
|
37
37
|
@reporter.record(the_test)
|
38
38
|
assert_respond_to the_test, the_test.name
|
39
39
|
end
|
40
|
+
|
41
|
+
def test_report_for_describe_not_using_const
|
42
|
+
klass = describe("whatever") { it("passes") { assert true } }
|
43
|
+
runnable = klass.runnable_methods.first
|
44
|
+
|
45
|
+
# Run the test
|
46
|
+
result = klass.new(runnable).run
|
47
|
+
@reporter.start
|
48
|
+
@reporter.record(result)
|
49
|
+
|
50
|
+
error_msg = nil
|
51
|
+
begin
|
52
|
+
@reporter.report
|
53
|
+
rescue => e
|
54
|
+
error_msg = "error executing @reporter.report, #{e}"
|
55
|
+
end
|
56
|
+
|
57
|
+
refute error_msg, error_msg
|
58
|
+
end
|
40
59
|
end
|
41
60
|
end
|
61
|
+
|
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.3.2.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Death to haphazard monkey-patching! Extend Minitest through simple hooks.
|
98
112
|
email:
|
99
113
|
- alex@kernul.com
|
@@ -102,6 +116,7 @@ extensions: []
|
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
104
118
|
- ".gitignore"
|
119
|
+
- ".rubocop.yml"
|
105
120
|
- ".ruby-gemset"
|
106
121
|
- ".travis.yml"
|
107
122
|
- ".yardopts"
|
@@ -164,9 +179,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
179
|
version: 1.9.3
|
165
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
181
|
requirements:
|
167
|
-
- - "
|
182
|
+
- - ">"
|
168
183
|
- !ruby/object:Gem::Version
|
169
|
-
version:
|
184
|
+
version: 1.3.1
|
170
185
|
requirements: []
|
171
186
|
rubyforge_project: minitest-reporters
|
172
187
|
rubygems_version: 2.7.6
|