minitest-sprint 1.4.1 → 1.5.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
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +22 -0
- data/Manifest.txt +0 -3
- data/README.rdoc +1 -1
- data/Rakefile +0 -1
- data/bin/minitest +1 -1
- data/lib/minitest/complete.rb +40 -19
- data/lib/minitest/path_expander.rb +231 -12
- data/lib/minitest/sprint.rb +92 -8
- data/lib/minitest/sprint_plugin.rb +22 -8
- data.tar.gz.sig +0 -0
- metadata +1 -18
- metadata.gz.sig +0 -0
- data/lib/minitest/binstub_reporter.rb +0 -11
- data/lib/minitest/rake_reporter.rb +0 -18
- data/lib/minitest/sprint_reporter.rb +0 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8b1b68075882de07be85d45f66148b077be1e1935c8b26164525e0b3ea009d3f
|
|
4
|
+
data.tar.gz: 47effadd6a826ff5f967cc90d9944822483e815ee1ba54d5ab1e9284cdefab8e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f1a813c462dca3ec94100802a686ac7db6dd475b0512012ab7bf81e87bca09876479c50eae3a7eef9c420771939f0291ed70a8def6d365097d97c62fd0982961
|
|
7
|
+
data.tar.gz: 715a332cdcb91d0029ae00d7841468bf580842e485075380e82ed87533eacee3261da25f78c3c07dce2509827ece43f7aabda07763ff9ff57410bc4d08a9df6f
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/History.rdoc
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
=== 1.5.0 / 2025-12-11
|
|
2
|
+
|
|
3
|
+
* 10 minor enhancements:
|
|
4
|
+
|
|
5
|
+
* --rerun now takes a style (lines, names) and defaults to lines.
|
|
6
|
+
* Add --simplecov (and MT_COV=1) option to load before minitest.
|
|
7
|
+
* Added all the filtering options to minitest/complete.
|
|
8
|
+
* Folded BinstubReporter into SprintReporter and added line number reporting.
|
|
9
|
+
* Folded rake_reporter.rb and sprint_reporter.rb into sprint.rb
|
|
10
|
+
* Normalized namespacing inside of Minitest::Sprint
|
|
11
|
+
* Renamed --binstub to --rerun and added -r shortcut.
|
|
12
|
+
* Switched minitest/complete to prism. Should be much more solid.
|
|
13
|
+
* Vendored latest version of path_expander.
|
|
14
|
+
* Updated Minitest::VendoredPathExpander to 2.0.0 and cleaned up overrides.
|
|
15
|
+
|
|
16
|
+
* 4 bug fixes:
|
|
17
|
+
|
|
18
|
+
* -I flag now prepends onto load path.
|
|
19
|
+
* Fixed minitest cmdline to use require_relative to test against current version.
|
|
20
|
+
* Made RakeReporter play better with superclass.
|
|
21
|
+
* Prepend test and lib onto load path before loading minitest.
|
|
22
|
+
|
|
1
23
|
=== 1.4.1 / 2025-11-18
|
|
2
24
|
|
|
3
25
|
* 1 bug fix:
|
data/Manifest.txt
CHANGED
|
@@ -4,11 +4,8 @@ Manifest.txt
|
|
|
4
4
|
README.rdoc
|
|
5
5
|
Rakefile
|
|
6
6
|
bin/minitest
|
|
7
|
-
lib/minitest/binstub_reporter.rb
|
|
8
7
|
lib/minitest/complete.rb
|
|
9
8
|
lib/minitest/path_expander.rb
|
|
10
|
-
lib/minitest/rake_reporter.rb
|
|
11
9
|
lib/minitest/sprint.rb
|
|
12
10
|
lib/minitest/sprint_plugin.rb
|
|
13
|
-
lib/minitest/sprint_reporter.rb
|
|
14
11
|
test/test_minitest_sprint.rb
|
data/README.rdoc
CHANGED
|
@@ -41,7 +41,7 @@ failures.
|
|
|
41
41
|
|
|
42
42
|
Add this to your .bashrc (or .zshrc?--someone please confirm with a PR):
|
|
43
43
|
|
|
44
|
-
$ complete -o bashdefault -f -C 'ruby
|
|
44
|
+
$ complete -o bashdefault -f -C 'ruby $(gem which minitest/complete)' minitest
|
|
45
45
|
|
|
46
46
|
Running individual minitest tests will now have tab completion for the
|
|
47
47
|
method names. When running tests, just hit tab after -n. For example:
|
data/Rakefile
CHANGED
data/bin/minitest
CHANGED
data/lib/minitest/complete.rb
CHANGED
|
@@ -1,35 +1,56 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
1
|
+
#!/usr/bin/env -S ruby
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# :stopdoc:
|
|
4
4
|
|
|
5
|
-
require
|
|
6
|
-
require
|
|
5
|
+
require "optparse"
|
|
6
|
+
require "shellwords"
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
# complete -o bashdefault -f -C 'ruby lib/minitest/complete.rb' minitest
|
|
9
|
+
# using eg:
|
|
10
|
+
# COMP_LINE="blah test/test_file.rb -n test_pattern"
|
|
11
|
+
# or test directly with:
|
|
12
|
+
# ./lib/minitest/complete.rb test/test_file.rb -n test_pattern
|
|
13
|
+
|
|
14
|
+
argv = Shellwords.split ENV["COMP_LINE"] || ARGV.join(" ")
|
|
15
|
+
comp_re = nil
|
|
10
16
|
|
|
11
17
|
begin
|
|
12
18
|
OptionParser.new do |opts|
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
# part of my unofficial embedded gem "makeoptparseworkwell"
|
|
20
|
+
def opts.topdict(name) = (name.length > 1 ? top.long : top.short)
|
|
21
|
+
def opts.alias(from, to) = (dict = topdict(from) ; dict[to] = dict[from])
|
|
22
|
+
|
|
23
|
+
opts.on "-n", "--name [METHOD]", "minitest option" do |m|
|
|
24
|
+
comp_re = Regexp.new m
|
|
15
25
|
end
|
|
16
|
-
|
|
26
|
+
|
|
27
|
+
opts.alias "name", "include"
|
|
28
|
+
opts.alias "name", "exclude"
|
|
29
|
+
opts.alias "n", "i"
|
|
30
|
+
opts.alias "n", "e"
|
|
31
|
+
opts.alias "n", "x"
|
|
32
|
+
end.parse! argv
|
|
17
33
|
rescue
|
|
18
34
|
retry # ignore options passed to Ruby
|
|
19
35
|
end
|
|
20
36
|
|
|
21
|
-
|
|
37
|
+
path = argv.find_all { |f| File.file? f }.last
|
|
22
38
|
|
|
23
|
-
exit unless
|
|
39
|
+
exit unless comp_re && path
|
|
24
40
|
|
|
25
|
-
require
|
|
41
|
+
require "prism"
|
|
26
42
|
|
|
27
|
-
|
|
28
|
-
K = Class.new(Ripper) { define_method(:on_def) { |n,_,_| methods << n } }
|
|
43
|
+
names, queue = [], [Prism.parse_file(path).value]
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
while node = queue.shift do
|
|
46
|
+
if node.type == :def_node then
|
|
47
|
+
name = node.name
|
|
48
|
+
names << name if name =~ comp_re
|
|
49
|
+
else
|
|
50
|
+
queue.concat node.compact_child_nodes # no need to process def body
|
|
51
|
+
end
|
|
35
52
|
end
|
|
53
|
+
|
|
54
|
+
puts names.sort
|
|
55
|
+
|
|
56
|
+
# :startdoc:
|
|
@@ -1,13 +1,228 @@
|
|
|
1
|
-
require "path_expander"
|
|
2
1
|
require "prism"
|
|
3
2
|
|
|
4
3
|
module Minitest; end # :nodoc:
|
|
5
4
|
|
|
5
|
+
##
|
|
6
|
+
# PathExpander helps pre-process command-line arguments expanding
|
|
7
|
+
# directories into their constituent files. It further helps by
|
|
8
|
+
# providing additional mechanisms to make specifying subsets easier
|
|
9
|
+
# with path subtraction and allowing for command-line arguments to be
|
|
10
|
+
# saved in a file.
|
|
11
|
+
#
|
|
12
|
+
# NOTE: this is NOT an options processor. It is a path processor
|
|
13
|
+
# (basically everything else besides options). It does provide a
|
|
14
|
+
# mechanism for pre-filtering cmdline options, but not with the intent
|
|
15
|
+
# of actually processing them in PathExpander. Use OptionParser to
|
|
16
|
+
# deal with options either before or after passing ARGV through
|
|
17
|
+
# PathExpander.
|
|
18
|
+
|
|
19
|
+
class Minitest::VendoredPathExpander
|
|
20
|
+
# extracted version = "2.0.0"
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# The args array to process.
|
|
24
|
+
|
|
25
|
+
attr_accessor :args
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# The glob used to expand dirs to files.
|
|
29
|
+
|
|
30
|
+
attr_accessor :glob
|
|
31
|
+
|
|
32
|
+
##
|
|
33
|
+
# The path to scan if no paths are found in the initial scan.
|
|
34
|
+
|
|
35
|
+
attr_accessor :path
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
# Create a new path expander that operates on args and expands via
|
|
39
|
+
# glob as necessary. Takes an optional +path+ arg to fall back on if
|
|
40
|
+
# no paths are found on the initial scan (see #process_args).
|
|
41
|
+
|
|
42
|
+
def initialize args, glob, path = "."
|
|
43
|
+
self.args = args
|
|
44
|
+
self.glob = glob
|
|
45
|
+
self.path = path
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
##
|
|
49
|
+
# Takes an array of paths and returns an array of paths where all
|
|
50
|
+
# directories are expanded to all files found via the glob provided
|
|
51
|
+
# to PathExpander.
|
|
52
|
+
#
|
|
53
|
+
# Paths are normalized to not have a leading "./".
|
|
54
|
+
|
|
55
|
+
def expand_dirs_to_files *dirs
|
|
56
|
+
dirs.flatten.map { |p|
|
|
57
|
+
if File.directory? p then
|
|
58
|
+
Dir[File.join(p, glob)].find_all { |f| File.file? f }
|
|
59
|
+
else
|
|
60
|
+
p
|
|
61
|
+
end
|
|
62
|
+
}.flatten.sort.map { |s| s.to_s.delete_prefix "./" }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
##
|
|
66
|
+
# Process a file into more arguments. Override this to add
|
|
67
|
+
# additional capabilities.
|
|
68
|
+
|
|
69
|
+
def process_file path
|
|
70
|
+
File.readlines(path).map(&:chomp)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
##
|
|
74
|
+
# Enumerate over args passed to PathExpander and return a list of
|
|
75
|
+
# files and flags to process. Arguments are processed as:
|
|
76
|
+
#
|
|
77
|
+
# @file_of_args :: Read the file and append to args.
|
|
78
|
+
# -file_path :: Subtract path from file to be processed.
|
|
79
|
+
# -dir_path :: Expand and subtract paths from files to be processed.
|
|
80
|
+
# -not_a_path :: Add to flags to be processed.
|
|
81
|
+
# dir_path :: Expand and add to files to be processed.
|
|
82
|
+
# file_path :: Add to files to be processed.
|
|
83
|
+
# - :: Add "-" (stdin) to files to be processed.
|
|
84
|
+
#
|
|
85
|
+
# See expand_dirs_to_files for details on how expansion occurs.
|
|
86
|
+
#
|
|
87
|
+
# Subtraction happens last, regardless of argument ordering.
|
|
88
|
+
#
|
|
89
|
+
# If no files are found (which is not the same as having an empty
|
|
90
|
+
# file list after subtraction), then fall back to expanding on the
|
|
91
|
+
# default #path given to initialize.
|
|
92
|
+
|
|
93
|
+
def process_args
|
|
94
|
+
pos_files = []
|
|
95
|
+
neg_files = []
|
|
96
|
+
flags = []
|
|
97
|
+
clean = true
|
|
98
|
+
|
|
99
|
+
args.each do |arg|
|
|
100
|
+
case arg
|
|
101
|
+
when /^@(.*)/ then # push back on, so they can have dirs/-/@ as well
|
|
102
|
+
clean = false
|
|
103
|
+
args.concat process_file $1
|
|
104
|
+
when "-" then
|
|
105
|
+
pos_files << arg
|
|
106
|
+
when /^-(.*)/ then
|
|
107
|
+
if File.exist? $1 then
|
|
108
|
+
clean = false
|
|
109
|
+
neg_files += expand_dirs_to_files($1)
|
|
110
|
+
else
|
|
111
|
+
flags << arg
|
|
112
|
+
end
|
|
113
|
+
else
|
|
114
|
+
root_path = File.expand_path(arg) == "/" # eg: -n /./
|
|
115
|
+
if File.exist? arg and not root_path then
|
|
116
|
+
clean = false
|
|
117
|
+
pos_files += expand_dirs_to_files(arg)
|
|
118
|
+
else
|
|
119
|
+
flags << arg
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
files = pos_files - neg_files
|
|
125
|
+
files += expand_dirs_to_files(self.path) if files.empty? && clean
|
|
126
|
+
|
|
127
|
+
[files, flags]
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
##
|
|
131
|
+
# Process over flags and treat any special ones here. Returns an
|
|
132
|
+
# array of the flags you haven't processed.
|
|
133
|
+
#
|
|
134
|
+
# This version does nothing. Subclass and override for
|
|
135
|
+
# customization.
|
|
136
|
+
|
|
137
|
+
def process_flags flags
|
|
138
|
+
flags
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
##
|
|
142
|
+
# Top-level method processes args. If no block is given, immediately
|
|
143
|
+
# returns with an Enumerator for further chaining.
|
|
144
|
+
#
|
|
145
|
+
# Otherwise, it calls +pre_process+, +process_args+ and
|
|
146
|
+
# +process_flags+, enumerates over the files, and then calls
|
|
147
|
+
# +post_process+, returning self for any further chaining.
|
|
148
|
+
#
|
|
149
|
+
# Most of the time, you're going to provide a block to process files
|
|
150
|
+
# and do nothing more with the result. Eg:
|
|
151
|
+
#
|
|
152
|
+
# PathExpander.new(ARGV).process do |f|
|
|
153
|
+
# puts "./#{f}"
|
|
154
|
+
# end
|
|
155
|
+
#
|
|
156
|
+
# or:
|
|
157
|
+
#
|
|
158
|
+
# PathExpander.new(ARGV).process # => Enumerator
|
|
159
|
+
|
|
160
|
+
def process(&b)
|
|
161
|
+
return enum_for(:process) unless block_given?
|
|
162
|
+
|
|
163
|
+
pre_process
|
|
164
|
+
|
|
165
|
+
files, flags = process_args
|
|
166
|
+
|
|
167
|
+
args.replace process_flags flags
|
|
168
|
+
|
|
169
|
+
files.uniq.each(&b)
|
|
170
|
+
|
|
171
|
+
post_process
|
|
172
|
+
|
|
173
|
+
self
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def pre_process = nil
|
|
177
|
+
def post_process = nil
|
|
178
|
+
|
|
179
|
+
##
|
|
180
|
+
# A file filter mechanism similar to, but not as extensive as,
|
|
181
|
+
# .gitignore files:
|
|
182
|
+
#
|
|
183
|
+
# + If a pattern does not contain a slash, it is treated as a shell glob.
|
|
184
|
+
# + If a pattern ends in a slash, it matches on directories (and contents).
|
|
185
|
+
# + Otherwise, it matches on relative paths.
|
|
186
|
+
#
|
|
187
|
+
# File.fnmatch is used throughout, so glob patterns work for all 3 types.
|
|
188
|
+
#
|
|
189
|
+
# Takes a list of +files+ and either an io or path of +ignore+ data
|
|
190
|
+
# and returns a list of files left after filtering.
|
|
191
|
+
|
|
192
|
+
def filter_files files, ignore
|
|
193
|
+
ignore_paths = if ignore.respond_to? :read then
|
|
194
|
+
ignore.read
|
|
195
|
+
elsif File.exist? ignore then
|
|
196
|
+
File.read ignore
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
if ignore_paths then
|
|
200
|
+
nonglobs, globs = ignore_paths.split("\n").partition { |p| p.include? "/" }
|
|
201
|
+
dirs, ifiles = nonglobs.partition { |p| p.end_with? "/" }
|
|
202
|
+
dirs = dirs.map { |s| s.chomp "/" }
|
|
203
|
+
|
|
204
|
+
dirs.map! { |i| File.expand_path i }
|
|
205
|
+
globs.map! { |i| File.expand_path i }
|
|
206
|
+
ifiles.map! { |i| File.expand_path i }
|
|
207
|
+
|
|
208
|
+
only_paths = File::FNM_PATHNAME
|
|
209
|
+
files = files.reject { |f|
|
|
210
|
+
f = File.expand_path(f)
|
|
211
|
+
dirs.any? { |i| File.fnmatch?(i, File.dirname(f), only_paths) } ||
|
|
212
|
+
globs.any? { |i| File.fnmatch?(i, f) } ||
|
|
213
|
+
ifiles.any? { |i| File.fnmatch?(i, f, only_paths) }
|
|
214
|
+
}
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
files
|
|
218
|
+
end
|
|
219
|
+
end # VendoredPathExpander
|
|
220
|
+
|
|
6
221
|
##
|
|
7
222
|
# Minitest's PathExpander to find and filter tests.
|
|
8
223
|
|
|
9
|
-
class Minitest::PathExpander <
|
|
10
|
-
attr_accessor :by_line
|
|
224
|
+
class Minitest::PathExpander < Minitest::VendoredPathExpander
|
|
225
|
+
attr_accessor :by_line # :nodoc:
|
|
11
226
|
|
|
12
227
|
TEST_GLOB = "**/{test_*,*_test,spec_*,*_spec}.rb" # :nodoc:
|
|
13
228
|
|
|
@@ -16,12 +231,6 @@ class Minitest::PathExpander < PathExpander
|
|
|
16
231
|
self.by_line = {}
|
|
17
232
|
end
|
|
18
233
|
|
|
19
|
-
def process(&b) # :nodoc: TODO: push up!
|
|
20
|
-
super.each(&b)
|
|
21
|
-
post_process
|
|
22
|
-
self
|
|
23
|
-
end
|
|
24
|
-
|
|
25
234
|
def process_args # :nodoc:
|
|
26
235
|
args.reject! { |arg| # this is a good use of overriding
|
|
27
236
|
case arg
|
|
@@ -57,7 +266,7 @@ class Minitest::PathExpander < PathExpander
|
|
|
57
266
|
flags.reject { |flag| # all hits are truthy, so this works out well
|
|
58
267
|
case flag
|
|
59
268
|
when /^-I(.*)/ then
|
|
60
|
-
$LOAD_PATH.
|
|
269
|
+
$LOAD_PATH.prepend(*$1.split(/:/))
|
|
61
270
|
when /^-d/ then
|
|
62
271
|
$DEBUG = true
|
|
63
272
|
when /^-w/ then
|
|
@@ -82,6 +291,10 @@ class Minitest::PathExpander < PathExpander
|
|
|
82
291
|
self.args << "-n" << "/#{test_res.join "|"}/"
|
|
83
292
|
end
|
|
84
293
|
|
|
294
|
+
##
|
|
295
|
+
# Find and return all known tests as a hash of klass => [TM...]
|
|
296
|
+
# pairs.
|
|
297
|
+
|
|
85
298
|
def all_tests
|
|
86
299
|
Minitest.seed = 42 # minor hack to deal with runnable_methods shuffling
|
|
87
300
|
Minitest::Runnable.runnables
|
|
@@ -101,7 +314,10 @@ class Minitest::PathExpander < PathExpander
|
|
|
101
314
|
def tests_by_class
|
|
102
315
|
all_tests
|
|
103
316
|
.transform_values { |ms|
|
|
104
|
-
ms.select { |m|
|
|
317
|
+
ms.select { |m|
|
|
318
|
+
bl = by_line[m.path]
|
|
319
|
+
not bl or bl.any? { |l| m.include? l }
|
|
320
|
+
}
|
|
105
321
|
}
|
|
106
322
|
.reject { |k, v| v.empty? }
|
|
107
323
|
end
|
|
@@ -116,7 +332,7 @@ class Minitest::PathExpander < PathExpander
|
|
|
116
332
|
.map { |k, ns| # [ "k1#(?:a|b)", "k2#c", ...]
|
|
117
333
|
if ns.size > 1 then
|
|
118
334
|
ns.map! { |n| Regexp.escape n }
|
|
119
|
-
"%s#\(
|
|
335
|
+
"%s#\(?:%s\)" % [Regexp.escape(k.name), ns.join("|")]
|
|
120
336
|
else
|
|
121
337
|
"%s#%s" % [Regexp.escape(k.name), ns.first]
|
|
122
338
|
end
|
|
@@ -158,6 +374,9 @@ class Minitest::PathExpander < PathExpander
|
|
|
158
374
|
end
|
|
159
375
|
end
|
|
160
376
|
|
|
377
|
+
##
|
|
378
|
+
# Simple TestMethod (abbr TM) Data object.
|
|
379
|
+
|
|
161
380
|
TM = Data.define :klass, :name, :path, :lines do
|
|
162
381
|
def initialize klass:, name:
|
|
163
382
|
method = klass.instance_method name
|
data/lib/minitest/sprint.rb
CHANGED
|
@@ -1,14 +1,98 @@
|
|
|
1
|
+
$LOAD_PATH.unshift "test", "lib"
|
|
2
|
+
|
|
3
|
+
require "simplecov" if ENV["MT_COV"] || ARGV.delete("--simplecov")
|
|
1
4
|
require "minitest/autorun"
|
|
2
|
-
|
|
5
|
+
require_relative "path_expander"
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# Runs (Get it? It's fast!) your tests and makes it easier to rerun individual
|
|
9
|
+
# failures.
|
|
10
|
+
|
|
11
|
+
module Minitest
|
|
12
|
+
class Sprint
|
|
13
|
+
VERSION = "1.5.0" # :nodoc:
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# Process and run minitest cmdline.
|
|
17
|
+
|
|
18
|
+
def self.run args = ARGV
|
|
19
|
+
Minitest::PathExpander.new(args).process { |f|
|
|
20
|
+
require "./#{f}" if File.file? f
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
##
|
|
25
|
+
# An extra minitest reporter to output how to rerun failures in
|
|
26
|
+
# various styles.
|
|
27
|
+
|
|
28
|
+
class SprintReporter < AbstractReporter
|
|
29
|
+
##
|
|
30
|
+
# The style to report, either lines or regexp. Defaults to lines.
|
|
31
|
+
attr_accessor :style
|
|
32
|
+
attr_accessor :results # :nodoc:
|
|
33
|
+
|
|
34
|
+
def initialize style = :regexp # :nodoc:
|
|
35
|
+
self.results = []
|
|
36
|
+
self.style = style
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def record result # :nodoc:
|
|
40
|
+
results << result unless result.passed? or result.skipped?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def report # :nodoc:
|
|
44
|
+
return if results.empty?
|
|
45
|
+
|
|
46
|
+
puts
|
|
47
|
+
puts "Happy Happy Sprint List:"
|
|
48
|
+
puts
|
|
49
|
+
print_list
|
|
50
|
+
puts
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def print_list # :nodoc:
|
|
54
|
+
case style
|
|
55
|
+
when :regexp
|
|
56
|
+
results.each do |result|
|
|
57
|
+
puts " minitest -n #{result.class_name}##{result.name}"
|
|
58
|
+
end
|
|
59
|
+
when :lines
|
|
60
|
+
files = Hash.new { |h,k| h[k] = [] }
|
|
61
|
+
results.each do |result|
|
|
62
|
+
path, line = result.source_location
|
|
63
|
+
path = path.delete_prefix "#{Dir.pwd}/"
|
|
64
|
+
files[path] << line
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
files.sort.each do |path, lines|
|
|
68
|
+
puts " minitest %s:%s" % [path, lines.sort.join(",")]
|
|
69
|
+
end
|
|
70
|
+
else
|
|
71
|
+
raise "unsupported style: %p" % [style]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
##
|
|
77
|
+
# An extra minitest reporter to output how to rerun failures using
|
|
78
|
+
# rake.
|
|
79
|
+
|
|
80
|
+
class RakeReporter < SprintReporter
|
|
81
|
+
##
|
|
82
|
+
# The name of the rake task to rerun. Defaults to nil.
|
|
3
83
|
|
|
4
|
-
|
|
5
|
-
$LOAD_PATH.unshift "lib"
|
|
84
|
+
attr_accessor :name
|
|
6
85
|
|
|
7
|
-
|
|
8
|
-
|
|
86
|
+
def initialize name = nil # :nodoc:
|
|
87
|
+
super()
|
|
88
|
+
self.name = name
|
|
89
|
+
end
|
|
9
90
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
91
|
+
def print_list # :nodoc:
|
|
92
|
+
results.each do |result|
|
|
93
|
+
puts [" rake", name, "N=#{result.class_name}##{result.name}"].compact.join(" ")
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
13
97
|
end
|
|
14
98
|
end
|
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
require "minitest"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# :stopdoc:
|
|
4
|
+
class OptionParser # unofficial embedded gem "makeoptparseworkwell"
|
|
5
|
+
def hidden(...) = define(...).tap { |sw| def sw.summarize(*) = nil }
|
|
6
|
+
def deprecate(from, to) = hidden(from) { abort "#{from} is deprecated. Use #{to}." }
|
|
7
|
+
def topdict(name) = name.length > 1 ? top.long : top.short
|
|
8
|
+
def alias(from, to) = (dict = topdict(from) and dict[to] = dict[from])
|
|
9
|
+
end unless OptionParser.method_defined? :hidden
|
|
10
|
+
# :startdoc:
|
|
11
|
+
|
|
12
|
+
module Minitest # :nodoc:
|
|
4
13
|
def self.plugin_sprint_options opts, options # :nodoc:
|
|
5
14
|
opts.on "--rake [TASK]", "Report how to re-run failures with rake." do |task|
|
|
6
15
|
options[:sprint] = :rake
|
|
7
16
|
options[:rake_task] = task
|
|
8
17
|
end
|
|
9
18
|
|
|
10
|
-
opts.
|
|
11
|
-
|
|
19
|
+
opts.deprecate "--binstub", "--rerun"
|
|
20
|
+
|
|
21
|
+
sprint_styles = %w[rake lines names binstub]
|
|
22
|
+
|
|
23
|
+
opts.on "-r", "--rerun [STYLE]", sprint_styles, "Report how to re-run failures using STYLE (names, lines)." do |style|
|
|
24
|
+
options[:sprint] = (style || :lines).to_sym
|
|
12
25
|
end
|
|
13
26
|
end
|
|
14
27
|
|
|
15
28
|
def self.plugin_sprint_init options
|
|
29
|
+
require_relative "sprint"
|
|
16
30
|
case options[:sprint]
|
|
17
31
|
when :rake then
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
self.reporter << Minitest::
|
|
32
|
+
self.reporter << Minitest::Sprint::RakeReporter.new(options[:rake_task])
|
|
33
|
+
when :binstub, :names then
|
|
34
|
+
self.reporter << Minitest::Sprint::SprintReporter.new
|
|
35
|
+
when :lines then
|
|
36
|
+
self.reporter << Minitest::Sprint::SprintReporter.new(:lines)
|
|
23
37
|
end
|
|
24
38
|
end
|
|
25
39
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minitest-sprint
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Davis
|
|
@@ -30,20 +30,6 @@ cert_chain:
|
|
|
30
30
|
-----END CERTIFICATE-----
|
|
31
31
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
32
32
|
dependencies:
|
|
33
|
-
- !ruby/object:Gem::Dependency
|
|
34
|
-
name: path_expander
|
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - "~>"
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.1'
|
|
40
|
-
type: :runtime
|
|
41
|
-
prerelease: false
|
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - "~>"
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '1.1'
|
|
47
33
|
- !ruby/object:Gem::Dependency
|
|
48
34
|
name: prism
|
|
49
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -111,13 +97,10 @@ files:
|
|
|
111
97
|
- README.rdoc
|
|
112
98
|
- Rakefile
|
|
113
99
|
- bin/minitest
|
|
114
|
-
- lib/minitest/binstub_reporter.rb
|
|
115
100
|
- lib/minitest/complete.rb
|
|
116
101
|
- lib/minitest/path_expander.rb
|
|
117
|
-
- lib/minitest/rake_reporter.rb
|
|
118
102
|
- lib/minitest/sprint.rb
|
|
119
103
|
- lib/minitest/sprint_plugin.rb
|
|
120
|
-
- lib/minitest/sprint_reporter.rb
|
|
121
104
|
- test/test_minitest_sprint.rb
|
|
122
105
|
homepage: https://github.com/seattlerb/minitest-sprint
|
|
123
106
|
licenses:
|
metadata.gz.sig
CHANGED
|
Binary file
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require "minitest/sprint_reporter"
|
|
2
|
-
|
|
3
|
-
module Minitest
|
|
4
|
-
class RakeReporter < SprintReporter
|
|
5
|
-
attr_accessor :name
|
|
6
|
-
|
|
7
|
-
def initialize name = nil
|
|
8
|
-
self.results = []
|
|
9
|
-
self.name = name
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def print_list
|
|
13
|
-
results.each do |result|
|
|
14
|
-
puts [" rake", name, "N=#{result.class_name}##{result.name}"].compact.join(" ")
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module Minitest
|
|
2
|
-
class SprintReporter < AbstractReporter
|
|
3
|
-
attr_accessor :results
|
|
4
|
-
|
|
5
|
-
def initialize
|
|
6
|
-
self.results = []
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def record result
|
|
10
|
-
results << result unless result.passed? or result.skipped?
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def report
|
|
14
|
-
return if results.empty?
|
|
15
|
-
|
|
16
|
-
puts
|
|
17
|
-
puts "Happy Happy Sprint List:"
|
|
18
|
-
puts
|
|
19
|
-
print_list
|
|
20
|
-
puts
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|