minitest-reporters-ordered_spec_reporter 1.1.2 → 1.2.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/README.md +15 -2
- data/lib/minitest/reporters/ordered_spec_reporter.rb +22 -2
- data/minitest-reporters-ordered_spec_reporter.gemspec +2 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa19e059e9e859908ba7ff739292ea2cde1038ece49db041570104b4ce2dbce2
|
4
|
+
data.tar.gz: 2c4b2282a822d294e0fed672c5f583ef500e94b81e5573e7e1b24b40abc53d10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1abe2deaeb2ee26849b9a1945176ebbcac6ac0e218392edda8b1e5fefebc01acd8c92889e62b87d5363cf76427b773b5f522803b41e0e297e4e1b3d136b1102
|
7
|
+
data.tar.gz: 0657bf2a9e7a4a075af84c633884c70c7859e1221435868432f283b14bf2f33ce42cf7c1f2d2b1ce3ddc2c7bc94809e416d408d692b1aa82bbdf7322b872f74c
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Minitest::Reporters::OrderedSpecReporter
|
2
2
|
|
3
|
-
Modified version of `Minitest::Reporters::SpecReporter` which prints test results in alphabetical order, grouped by test
|
3
|
+
Modified version of `Minitest::Reporters::SpecReporter` which prints test results in alphabetical order, grouped by test suite.
|
4
4
|
|
5
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
|
|
@@ -34,8 +34,21 @@ The constructor accepts the following options:
|
|
34
34
|
|
35
35
|
| option | description | default |
|
36
36
|
|-|-|-|
|
37
|
-
| `:indentation` | number of indentations to apply to top level test
|
37
|
+
| `:indentation` | number of indentations to apply to top level test suite 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
40
|
| `:truncate` | whether to remove the `test_####_` prefix from each test name | `false` |
|
41
41
|
| `:loose` | whether to add a blank line after each group of tests | `false` |
|
42
|
+
| `:color` | options hash describing color options (see below) or `false` to disable colors | `{ suite: :yellow, test: :cyan }` |
|
43
|
+
|
44
|
+
#### Color Options
|
45
|
+
|
46
|
+
All color options from the [ANSI](https://github.com/rubyworks/ansi) library are accepted.
|
47
|
+
|
48
|
+
| option | description | default |
|
49
|
+
|-|-|-|
|
50
|
+
| `:suite` | color applied to test suite name | `:yellow` |
|
51
|
+
| `:test` | color applied to test name | `:cyan` |
|
52
|
+
| `:match` | hash of `Regexp` to color | `{}` |
|
53
|
+
|
54
|
+
Colors provided through the `:match` options take precedence over the `:suite` and `:test` colors. If there are multiple matches, the first is applied.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ansi/code'
|
1
2
|
require 'minitest/reporters'
|
2
3
|
|
3
4
|
module Minitest
|
@@ -13,6 +14,11 @@ module Minitest
|
|
13
14
|
justification: TEST_SIZE + TEST_PADDING, # match output of SpecReporter
|
14
15
|
truncate: false,
|
15
16
|
loose: false,
|
17
|
+
color: {
|
18
|
+
suite: :yellow,
|
19
|
+
test: :cyan,
|
20
|
+
match: {},
|
21
|
+
},
|
16
22
|
}
|
17
23
|
|
18
24
|
def initialize options = {}
|
@@ -54,7 +60,7 @@ module Minitest
|
|
54
60
|
protected
|
55
61
|
|
56
62
|
def print_suite(name, branch, indentation = options[:indentation])
|
57
|
-
puts pad_string(name, indentation) unless name.nil?
|
63
|
+
puts colorize(name, :suite) + pad_string(name, indentation) unless name.nil?
|
58
64
|
|
59
65
|
indentation += 1
|
60
66
|
|
@@ -81,7 +87,7 @@ module Minitest
|
|
81
87
|
def record_print_status(test, indentation)
|
82
88
|
test_name = test.name.gsub(/^test_: /, 'test:')
|
83
89
|
test_name = test_name.gsub(/^test_\d*_/, '') if options[:truncate]
|
84
|
-
print pad_string(test_name, indentation)
|
90
|
+
print colorize(test.name, :test) + pad_string(test_name, indentation)
|
85
91
|
print_colored_status(test)
|
86
92
|
print(" (%.2fs)" % test.time) unless test.time.nil?
|
87
93
|
puts
|
@@ -97,6 +103,20 @@ module Minitest
|
|
97
103
|
def pad_string(str, indentation)
|
98
104
|
(' ' * indentation * options[:spaces] + str).ljust(options[:justification])
|
99
105
|
end
|
106
|
+
|
107
|
+
def colorize(name, type)
|
108
|
+
return '' unless options[:color]
|
109
|
+
|
110
|
+
color = nil
|
111
|
+
|
112
|
+
(options[:color][:match] || []).find do |regexp, color_code|
|
113
|
+
color = color_code if regexp.is_a?(Regexp) && name.match(regexp)
|
114
|
+
end
|
115
|
+
|
116
|
+
color ||= options[:color][type]
|
117
|
+
|
118
|
+
color ? ANSI::Code[color] : ''
|
119
|
+
end
|
100
120
|
end
|
101
121
|
end
|
102
122
|
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.2.0"
|
8
8
|
spec.authors = ["Nick Barry"]
|
9
9
|
spec.email = ["itsnickbarry@protonmail.ch"]
|
10
10
|
|
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
30
|
|
31
31
|
spec.add_dependency "minitest-reporters", "~> 1.3.6"
|
32
|
+
spec.add_dependency "ansi"
|
32
33
|
end
|
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.2.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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.3.6
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ansi
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Modified version of `Minitest::Reporters::SpecReporter` which prints
|
56
70
|
test results in alphabetical order, grouped by test class.
|
57
71
|
email:
|