minitest-reporters-ordered_spec_reporter 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/lib/minitest/reporters/ordered_spec_reporter.rb +31 -21
- data/minitest-reporters-ordered_spec_reporter.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed71e90717676ce09625103d4785f2e0705bcc7218eb800794fe95a54d074a4c
|
4
|
+
data.tar.gz: 9a0a25859f339ada0bad3119369cf11c0278362d124801cc5ce5b3e81cd48cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18db9ba2d826671a4b7b34189ff410e9b2169d244b1d5bc162fd720b5f3987891b3e48b97759c498971517d43ffe46b592bf55a094e420b0073ccd0ae4a90091
|
7
|
+
data.tar.gz: f0eb84a746fb49c927105c816d4e42fe03471766cff0aab711296863d4ecb6266f2b6c94485ec34c5d0bf3291f3577ddf92158289145beb06040ebb5d48f73f0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Modified version of `Minitest::Reporters::SpecReporter` which prints test results in alphabetical order, grouped by test class.
|
4
4
|
|
5
|
-
This gem makes use of the
|
5
|
+
This gem makes use of the `minitest-reporters` library. It modifies the test reporting order, but not Minitest's randomized test execution order.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -36,4 +36,6 @@ The constructor accepts the following options:
|
|
36
36
|
|-|-|-|
|
37
37
|
| `:indentation` | number of indentations to apply to top level test class reports | `0` |
|
38
38
|
| `:spaces` | number of spaces per indentation level | `2` |
|
39
|
-
| `:
|
39
|
+
| `:justification` | width of the test description column | `65` (aligns with default `SpecReporter`)|
|
40
|
+
| `:truncate` | whether to remove the `test_####_` prefix from each test name | `false` |
|
41
|
+
| `:loose` | whether to add a blank line after each group of tests | `false` |
|
@@ -7,11 +7,16 @@ module Minitest
|
|
7
7
|
include ANSI::Code
|
8
8
|
include RelativePosition
|
9
9
|
|
10
|
+
@@default_options = {
|
11
|
+
indentation: 0,
|
12
|
+
spaces: 2,
|
13
|
+
justification: TEST_SIZE + TEST_PADDING, # match output of SpecReporter
|
14
|
+
truncate: false,
|
15
|
+
loose: false,
|
16
|
+
}
|
17
|
+
|
10
18
|
def initialize options = {}
|
11
|
-
super
|
12
|
-
@indentation = options[:indentation] || 0
|
13
|
-
@spaces = options[:spaces] || 2
|
14
|
-
@truncate = options[:truncate] || true
|
19
|
+
super(@@default_options.merge(options))
|
15
20
|
end
|
16
21
|
|
17
22
|
def start
|
@@ -36,8 +41,8 @@ module Minitest
|
|
36
41
|
end
|
37
42
|
|
38
43
|
tree.sort.to_h.each { |k, v| print_suite(k, v) }
|
39
|
-
|
40
|
-
puts
|
44
|
+
|
45
|
+
puts unless options[:loose] # already printed by last suite if true
|
41
46
|
puts('Finished in %.5fs' % total_time)
|
42
47
|
print('%d tests, %d assertions, ' % [count, assertions])
|
43
48
|
color = failures.zero? && errors.zero? ? :green : :red
|
@@ -48,31 +53,32 @@ module Minitest
|
|
48
53
|
|
49
54
|
protected
|
50
55
|
|
51
|
-
def print_suite(name, branch, indentation =
|
52
|
-
|
53
|
-
puts ' ' * indentation * @spaces + name unless name.nil?
|
56
|
+
def print_suite(name, branch, indentation = options[:indentation])
|
57
|
+
puts pad_string(name, indentation) unless name.nil?
|
54
58
|
|
55
|
-
|
56
|
-
print ' ' * indentation * @spaces
|
57
|
-
print_test(test)
|
58
|
-
end
|
59
|
+
indentation += 1
|
59
60
|
|
60
|
-
branch
|
61
|
-
|
61
|
+
if branch[:tests]
|
62
|
+
branch[:tests].each do |test|
|
63
|
+
print_test(test, indentation)
|
64
|
+
end
|
65
|
+
puts if options[:loose]
|
62
66
|
end
|
63
67
|
|
64
|
-
|
68
|
+
branch.sort.to_h.each do |k, v|
|
69
|
+
print_suite k, v, indentation unless k == :tests
|
70
|
+
end
|
65
71
|
end
|
66
72
|
|
67
|
-
def print_test(test)
|
68
|
-
record_print_status(test)
|
73
|
+
def print_test(test, indentation)
|
74
|
+
record_print_status(test, indentation)
|
69
75
|
record_print_failures_if_any(test)
|
70
76
|
end
|
71
77
|
|
72
|
-
def record_print_status(test)
|
78
|
+
def record_print_status(test, indentation)
|
73
79
|
test_name = test.name.gsub(/^test_: /, 'test:')
|
74
|
-
test_name = test_name.gsub(/^test_\d*_/, '') if
|
75
|
-
print
|
80
|
+
test_name = test_name.gsub(/^test_\d*_/, '') if options[:truncate]
|
81
|
+
print pad_string(test_name, indentation)
|
76
82
|
print_colored_status(test)
|
77
83
|
print(" (%.2fs)" % test.time) unless test.time.nil?
|
78
84
|
puts
|
@@ -84,6 +90,10 @@ module Minitest
|
|
84
90
|
puts
|
85
91
|
end
|
86
92
|
end
|
93
|
+
|
94
|
+
def pad_string(str, indentation)
|
95
|
+
(' ' * indentation * options[:spaces] + str).ljust(options[:justification])
|
96
|
+
end
|
87
97
|
end
|
88
98
|
end
|
89
99
|
end
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "minitest-reporters-ordered_spec_reporter"
|
7
|
-
spec.version = "1.
|
7
|
+
spec.version = "1.1.0"
|
8
8
|
spec.authors = ["Nick Barry"]
|
9
9
|
spec.email = ["itsnickbarry@protonmail.ch"]
|
10
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-reporters-ordered_spec_reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|