guard-minitest 2.4.2 → 2.4.3
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/lib/guard/minitest/notifier.rb +2 -0
- data/lib/guard/minitest/version.rb +1 -1
- metadata +3 -11
- data/lib/guard/minitest.rb.orig +0 -56
- data/lib/guard/minitest/inspector.rb.orig +0 -54
- data/lib/guard/minitest/notifier.rb.orig +0 -39
- data/lib/guard/minitest/reporter.rb.orig +0 -18
- data/lib/guard/minitest/reporters/old_reporter.rb.orig +0 -22
- data/lib/guard/minitest/runner.rb.orig +0 -252
- data/lib/guard/minitest/utils.rb.orig +0 -28
- data/lib/guard/minitest/version.rb.orig +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc495e0ea2932c1ab9c7c012d783daa85bf2e15
|
4
|
+
data.tar.gz: 3de792938d8a06d656afa759c05785a4b4cf414b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea74b63c79336cd5db930b62cd6a745fa12e5b61f3a63969cc61e0c72aae765389f28dc74540faf83814d874562df966f86b673ced1a81d238fd11dfd7cfc3e5
|
7
|
+
data.tar.gz: f2fb0caa615b6879522289811988718a2590b541777da544be7ac1d140a16e472721bbd822b9c9bda9dc6b84047fd6d8864483fe6b60daa354ebdb9239afb41a
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yann Lugrin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard-compat
|
@@ -65,23 +65,15 @@ files:
|
|
65
65
|
- LICENSE
|
66
66
|
- README.md
|
67
67
|
- lib/guard/minitest.rb
|
68
|
-
- lib/guard/minitest.rb.orig
|
69
68
|
- lib/guard/minitest/inspector.rb
|
70
|
-
- lib/guard/minitest/inspector.rb.orig
|
71
69
|
- lib/guard/minitest/notifier.rb
|
72
|
-
- lib/guard/minitest/notifier.rb.orig
|
73
70
|
- lib/guard/minitest/reporter.rb
|
74
|
-
- lib/guard/minitest/reporter.rb.orig
|
75
71
|
- lib/guard/minitest/reporters/old_reporter.rb
|
76
|
-
- lib/guard/minitest/reporters/old_reporter.rb.orig
|
77
72
|
- lib/guard/minitest/runner.rb
|
78
|
-
- lib/guard/minitest/runner.rb.orig
|
79
73
|
- lib/guard/minitest/runners/old_runner.rb
|
80
74
|
- lib/guard/minitest/templates/Guardfile
|
81
75
|
- lib/guard/minitest/utils.rb
|
82
|
-
- lib/guard/minitest/utils.rb.orig
|
83
76
|
- lib/guard/minitest/version.rb
|
84
|
-
- lib/guard/minitest/version.rb.orig
|
85
77
|
- lib/minitest/guard_minitest_plugin.rb
|
86
78
|
homepage: https://rubygems.org/gems/guard-minitest
|
87
79
|
licenses:
|
@@ -103,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
95
|
version: '0'
|
104
96
|
requirements: []
|
105
97
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.4.
|
98
|
+
rubygems_version: 2.4.5
|
107
99
|
signing_key:
|
108
100
|
specification_version: 4
|
109
101
|
summary: Guard plugin for the Minitest framework
|
data/lib/guard/minitest.rb.orig
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'guard/compat/plugin'
|
2
|
-
|
3
|
-
module Guard
|
4
|
-
class Minitest < Plugin
|
5
|
-
|
6
|
-
require 'guard/minitest/runner'
|
7
|
-
require 'guard/minitest/utils'
|
8
|
-
require 'guard/minitest/version'
|
9
|
-
|
10
|
-
attr_accessor :runner
|
11
|
-
|
12
|
-
def initialize(options = {})
|
13
|
-
super
|
14
|
-
@options = {
|
15
|
-
all_on_start: true
|
16
|
-
}.merge(options)
|
17
|
-
@runner = Runner.new(@options)
|
18
|
-
end
|
19
|
-
|
20
|
-
def start
|
21
|
-
UI.info "Guard::Minitest #{MinitestVersion::VERSION} is running, with Minitest::Unit #{Utils.minitest_version}!"
|
22
|
-
run_all if @options[:all_on_start]
|
23
|
-
end
|
24
|
-
|
25
|
-
def stop
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
def reload
|
30
|
-
true
|
31
|
-
end
|
32
|
-
|
33
|
-
def run_all
|
34
|
-
throw_on_failed_tests { runner.run_all }
|
35
|
-
end
|
36
|
-
|
37
|
-
def run_on_modifications(paths = [])
|
38
|
-
throw_on_failed_tests { runner.run_on_modifications(paths) }
|
39
|
-
end
|
40
|
-
|
41
|
-
def run_on_additions(paths)
|
42
|
-
runner.run_on_additions(paths)
|
43
|
-
end
|
44
|
-
|
45
|
-
def run_on_removals(paths)
|
46
|
-
runner.run_on_removals(paths)
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def throw_on_failed_tests
|
52
|
-
throw :task_has_failed unless yield
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module Guard
|
2
|
-
class Minitest
|
3
|
-
class Inspector
|
4
|
-
|
5
|
-
attr_reader :test_folders, :test_file_patterns
|
6
|
-
|
7
|
-
def initialize(test_folders, test_file_patterns)
|
8
|
-
@test_folders = test_folders.uniq.compact
|
9
|
-
@test_file_patterns = test_file_patterns.uniq.compact
|
10
|
-
end
|
11
|
-
|
12
|
-
def clean_all
|
13
|
-
clean(test_folders)
|
14
|
-
end
|
15
|
-
|
16
|
-
def clean(paths)
|
17
|
-
paths.reduce([]) do |memo, path|
|
18
|
-
if File.directory?(path)
|
19
|
-
memo += _test_files_for_paths(path)
|
20
|
-
else
|
21
|
-
memo << path if _test_file?(path)
|
22
|
-
end
|
23
|
-
memo
|
24
|
-
end.uniq
|
25
|
-
end
|
26
|
-
|
27
|
-
def clear_memoized_test_files
|
28
|
-
@all_test_files = nil
|
29
|
-
end
|
30
|
-
|
31
|
-
def all_test_files
|
32
|
-
@all_test_files ||= _test_files_for_paths
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def _test_files_for_paths(paths = test_folders)
|
38
|
-
paths = _join_for_glob(Array(paths))
|
39
|
-
files = _join_for_glob(test_file_patterns)
|
40
|
-
|
41
|
-
Dir["#{paths}/**/#{files}"]
|
42
|
-
end
|
43
|
-
|
44
|
-
def _test_file?(path)
|
45
|
-
_test_files_for_paths.include?(path)
|
46
|
-
end
|
47
|
-
|
48
|
-
def _join_for_glob(fragments)
|
49
|
-
"{#{fragments.join(',')}}"
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'guard/notifier'
|
2
|
-
|
3
|
-
module Guard
|
4
|
-
class Minitest
|
5
|
-
class Notifier
|
6
|
-
|
7
|
-
def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
8
|
-
message = "#{test_count} tests"
|
9
|
-
if skip_count > 0
|
10
|
-
message << " (#{skip_count} skipped)"
|
11
|
-
end
|
12
|
-
message << "\n#{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
|
13
|
-
if test_count && assertion_count
|
14
|
-
message << "\n\n%.2f tests/s, %.2f assertions/s\n\nFinished in %.4f seconds" % [test_count / duration, assertion_count / duration, duration]
|
15
|
-
end
|
16
|
-
message
|
17
|
-
end
|
18
|
-
|
19
|
-
# failed | pending (skip) | success
|
20
|
-
def self.guard_image(failure_count, skip_count)
|
21
|
-
if failure_count > 0
|
22
|
-
:failed
|
23
|
-
elsif skip_count > 0
|
24
|
-
:pending
|
25
|
-
else
|
26
|
-
:success
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.notify(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
31
|
-
message = guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
32
|
-
image = guard_image(failure_count + error_count, skip_count)
|
33
|
-
|
34
|
-
::Guard::Notifier.notify(message, title: 'Minitest results', image: image)
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'minitest'
|
2
|
-
require 'guard/minitest/notifier'
|
3
|
-
|
4
|
-
module Guard
|
5
|
-
class Minitest
|
6
|
-
class Reporter < ::Minitest::StatisticsReporter
|
7
|
-
|
8
|
-
def report
|
9
|
-
super
|
10
|
-
|
11
|
-
::Guard::Minitest::Notifier.notify(self.count, self.assertions,
|
12
|
-
self.failures, self.errors,
|
13
|
-
self.skips, self.total_time)
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'minitest'
|
2
|
-
require 'guard/minitest/notifier'
|
3
|
-
|
4
|
-
module Guard
|
5
|
-
class Minitest
|
6
|
-
class Reporter < ::Minitest::Reporter
|
7
|
-
|
8
|
-
def report
|
9
|
-
aggregate = results.group_by { |r| r.failure.class }
|
10
|
-
aggregate.default = [] # dumb. group_by should provide this
|
11
|
-
|
12
|
-
f = aggregate[::Minitest::Assertion].size
|
13
|
-
e = aggregate[::Minitest::UnexpectedError].size
|
14
|
-
s = aggregate[::Minitest::Skip].size
|
15
|
-
t = Time.now - start_time
|
16
|
-
|
17
|
-
::Guard::Minitest::Notifier.notify(count, self.assertions, f, e, s, t)
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,252 +0,0 @@
|
|
1
|
-
require 'guard/minitest/inspector'
|
2
|
-
|
3
|
-
module Guard
|
4
|
-
class Minitest
|
5
|
-
class Runner
|
6
|
-
attr_accessor :inspector
|
7
|
-
|
8
|
-
def initialize(options = {})
|
9
|
-
@options = {
|
10
|
-
all_after_pass: false,
|
11
|
-
bundler: File.exist?("#{Dir.pwd}/Gemfile"),
|
12
|
-
rubygems: false,
|
13
|
-
drb: false,
|
14
|
-
zeus: false,
|
15
|
-
spring: false,
|
16
|
-
all_env: {},
|
17
|
-
env: {},
|
18
|
-
include: [],
|
19
|
-
test_folders: %w[test spec],
|
20
|
-
test_file_patterns: %w[*_test.rb test_*.rb *_spec.rb],
|
21
|
-
cli: nil,
|
22
|
-
autorun: true
|
23
|
-
}.merge(options)
|
24
|
-
|
25
|
-
parse_deprecated_options
|
26
|
-
|
27
|
-
[:test_folders, :test_file_patterns].each do |k|
|
28
|
-
@options[k] = Array(@options[k]).uniq.compact
|
29
|
-
end
|
30
|
-
|
31
|
-
@inspector = Inspector.new(test_folders, test_file_patterns)
|
32
|
-
end
|
33
|
-
|
34
|
-
def run(paths, options = {})
|
35
|
-
return unless options[:all] || !paths.empty?
|
36
|
-
|
37
|
-
message = "Running: #{options[:all] ? 'all tests' : paths.join(' ')}"
|
38
|
-
UI.info message, reset: true
|
39
|
-
|
40
|
-
status = _run_command(paths, options[:all])
|
41
|
-
|
42
|
-
# When using zeus or spring, the Guard::Minitest::Reporter can't be used because the minitests run in another
|
43
|
-
# process, but we can use the exit status of the client process to distinguish between :success and :failed.
|
44
|
-
if zeus? || spring?
|
45
|
-
::Guard::Notifier.notify(message, title: 'Minitest results', image: status ? :success : :failed)
|
46
|
-
end
|
47
|
-
|
48
|
-
if @options[:all_after_pass] && status && !options[:all]
|
49
|
-
run_all
|
50
|
-
else
|
51
|
-
status
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def run_all
|
56
|
-
paths = inspector.clean_all
|
57
|
-
run(paths, all: true)
|
58
|
-
end
|
59
|
-
|
60
|
-
def run_on_modifications(paths = [])
|
61
|
-
paths = inspector.clean(paths)
|
62
|
-
run(paths, all: all_paths?(paths))
|
63
|
-
end
|
64
|
-
|
65
|
-
def run_on_additions(paths)
|
66
|
-
inspector.clear_memoized_test_files
|
67
|
-
true
|
68
|
-
end
|
69
|
-
|
70
|
-
def run_on_removals(paths)
|
71
|
-
inspector.clear_memoized_test_files
|
72
|
-
end
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def cli_options
|
77
|
-
@cli_options ||= Array(@options[:cli])
|
78
|
-
end
|
79
|
-
|
80
|
-
def bundler?
|
81
|
-
@options[:bundler] && !@options[:spring]
|
82
|
-
end
|
83
|
-
|
84
|
-
def rubygems?
|
85
|
-
!bundler? && @options[:rubygems]
|
86
|
-
end
|
87
|
-
|
88
|
-
def drb?
|
89
|
-
@options[:drb]
|
90
|
-
end
|
91
|
-
|
92
|
-
def zeus?
|
93
|
-
@options[:zeus].is_a?(String) || @options[:zeus]
|
94
|
-
end
|
95
|
-
|
96
|
-
def spring?
|
97
|
-
@options[:spring].is_a?(String) || @options[:spring]
|
98
|
-
end
|
99
|
-
|
100
|
-
def all_after_pass?
|
101
|
-
@options[:all_after_pass]
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_folders
|
105
|
-
@options[:test_folders]
|
106
|
-
end
|
107
|
-
|
108
|
-
def include_folders
|
109
|
-
@options[:include]
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_file_patterns
|
113
|
-
@options[:test_file_patterns]
|
114
|
-
end
|
115
|
-
|
116
|
-
def autorun?
|
117
|
-
@options[:autorun]
|
118
|
-
end
|
119
|
-
|
120
|
-
def _run_command(paths, all)
|
121
|
-
if bundler?
|
122
|
-
system(*minitest_command(paths, all))
|
123
|
-
else
|
124
|
-
if defined?(::Bundler)
|
125
|
-
::Bundler.with_clean_env do
|
126
|
-
system(*minitest_command(paths, all))
|
127
|
-
end
|
128
|
-
else
|
129
|
-
system(*minitest_command(paths, all))
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def _commander(paths)
|
135
|
-
if drb?
|
136
|
-
drb_command(paths)
|
137
|
-
elsif zeus?
|
138
|
-
zeus_command(paths)
|
139
|
-
elsif spring?
|
140
|
-
spring_command(paths)
|
141
|
-
else
|
142
|
-
ruby_command(paths)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
def minitest_command(paths, all)
|
147
|
-
cmd_parts = []
|
148
|
-
|
149
|
-
cmd_parts << 'bundle exec' if bundler?
|
150
|
-
cmd_parts << _commander(paths)
|
151
|
-
|
152
|
-
[cmd_parts.compact.join(' ')].tap do |args|
|
153
|
-
env = generate_env(all)
|
154
|
-
args.unshift(env) if env.length > 0
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
def drb_command(paths)
|
159
|
-
%w[testdrb] + generate_includes(false) + relative_paths(paths)
|
160
|
-
end
|
161
|
-
|
162
|
-
def zeus_command(paths)
|
163
|
-
command = @options[:zeus].is_a?(String) ? @options[:zeus] : 'test'
|
164
|
-
['zeus', command] + relative_paths(paths)
|
165
|
-
end
|
166
|
-
|
167
|
-
def spring_command(paths)
|
168
|
-
command = @options[:spring].is_a?(String) ? @options[:spring] : 'bin/rake test'
|
169
|
-
cmd_parts = [command]
|
170
|
-
cmd_parts << File.expand_path('../runners/old_runner.rb', __FILE__) unless (Utils.minitest_version_gte_5? || command != 'spring testunit')
|
171
|
-
if cli_options.length > 0
|
172
|
-
cmd_parts + paths + ['--'] + cli_options
|
173
|
-
else
|
174
|
-
cmd_parts + paths
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
def ruby_command(paths)
|
179
|
-
cmd_parts = ['ruby']
|
180
|
-
cmd_parts.concat(generate_includes)
|
181
|
-
cmd_parts << '-r rubygems' if rubygems?
|
182
|
-
cmd_parts << '-r bundler/setup' if bundler?
|
183
|
-
cmd_parts << '-r minitest/autorun' if autorun?
|
184
|
-
cmd_parts.concat(paths.map { |path| "-r ./#{path}" })
|
185
|
-
|
186
|
-
unless Utils.minitest_version_gte_5?
|
187
|
-
cmd_parts << "-r #{File.expand_path('../runners/old_runner.rb', __FILE__)}"
|
188
|
-
end
|
189
|
-
|
190
|
-
# All the work is done through minitest/autorun
|
191
|
-
# and requiring the test files, so this is just
|
192
|
-
# a placeholder so Ruby doesn't try to exceute
|
193
|
-
# code from STDIN.
|
194
|
-
cmd_parts << '-e ""'
|
195
|
-
|
196
|
-
cmd_parts << '--'
|
197
|
-
cmd_parts += cli_options
|
198
|
-
end
|
199
|
-
|
200
|
-
def generate_includes(include_test_folders = true)
|
201
|
-
if include_test_folders
|
202
|
-
folders = test_folders + include_folders
|
203
|
-
else
|
204
|
-
folders = include_folders
|
205
|
-
end
|
206
|
-
|
207
|
-
folders.map {|f| %[-I"#{f}"] }
|
208
|
-
end
|
209
|
-
|
210
|
-
def generate_env(all=false)
|
211
|
-
base_env.merge(all ? all_env : {})
|
212
|
-
end
|
213
|
-
|
214
|
-
def base_env
|
215
|
-
Hash[(@options[:env] || {}).map{|key, value| [key.to_s, value.to_s]}]
|
216
|
-
end
|
217
|
-
|
218
|
-
def all_env
|
219
|
-
if @options[:all_env].kind_of? Hash
|
220
|
-
Hash[@options[:all_env].map{|key, value| [key.to_s, value.to_s]}]
|
221
|
-
else
|
222
|
-
{@options[:all_env].to_s => "true"}
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
def relative_paths(paths)
|
227
|
-
paths.map { |p| "./#{p}" }
|
228
|
-
end
|
229
|
-
|
230
|
-
def all_paths?(paths)
|
231
|
-
paths == inspector.all_test_files
|
232
|
-
end
|
233
|
-
|
234
|
-
def parse_deprecated_options
|
235
|
-
if @options.key?(:notify)
|
236
|
-
UI.info %{DEPRECATION WARNING: The :notify option is deprecated. Guard notification configuration is used.}
|
237
|
-
end
|
238
|
-
|
239
|
-
[:seed, :verbose].each do |key|
|
240
|
-
if value = @options.delete(key)
|
241
|
-
final_value = "--#{key}"
|
242
|
-
final_value << " #{value}" unless [TrueClass, FalseClass].include?(value.class)
|
243
|
-
cli_options << final_value
|
244
|
-
|
245
|
-
UI.info %{DEPRECATION WARNING: The :#{key} option is deprecated. Pass standard command line argument "--#{key}" to Minitest with the :cli option.}
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'rubygems/requirement'
|
2
|
-
|
3
|
-
module Guard
|
4
|
-
class Minitest
|
5
|
-
class Utils
|
6
|
-
|
7
|
-
def self.minitest_version
|
8
|
-
@@minitest_version ||= begin
|
9
|
-
require 'minitest'
|
10
|
-
::Minitest::VERSION
|
11
|
-
|
12
|
-
rescue LoadError, NameError
|
13
|
-
require 'minitest/unit'
|
14
|
-
::MiniTest::Unit::VERSION
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.minitest_version_gte_5?
|
19
|
-
@@minitest_version_gte_5 ||= Gem::Requirement.new('>= 5').satisfied_by?(Gem::Version.new(minitest_version))
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.minitest_version_gte_5_0_4?
|
23
|
-
@@minitest_version_gte_5_0_4 ||= Gem::Requirement.new('>= 5.0.4').satisfied_by?(Gem::Version.new(minitest_version))
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|