test-loop 9.0.0 → 9.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +32 -12
- data/bin/test-loop +11 -15
- metadata +3 -3
data/README.md
CHANGED
@@ -155,13 +155,41 @@ you can query and modify the `Test::Loop` OpenStruct configuration as follows:
|
|
155
155
|
execution began, and (5) how many seconds it took for the overall test
|
156
156
|
execution to complete.
|
157
157
|
|
158
|
-
For example, to display
|
159
|
-
|
160
|
-
|
158
|
+
For example, to see on-screen-display notifications about test failures only
|
159
|
+
(not successes) and also see their corresponding failure logs in your
|
160
|
+
terminal, add the following to your configuration file:
|
161
|
+
|
162
|
+
Test::Loop.after_each_test = lambda do |test_file, log_file, run_status, started_at, elapsed_time|
|
163
|
+
unless run_status.success?
|
164
|
+
# display the failure log
|
165
|
+
divider = '#' * 80
|
166
|
+
STDERR.print [divider, File.read(log_file), divider, nil].join("\n")
|
167
|
+
|
168
|
+
# notify user about failure
|
169
|
+
title = 'FAIL at %s in %0.1fs' % [started_at.strftime('%r'), elapsed_time]
|
170
|
+
message = test_file
|
171
|
+
Thread.new do # run in background
|
172
|
+
system 'notify-send', '-i', 'dialog-error', title, message or
|
173
|
+
system 'growlnotify', '-a', 'Xcode', '-m', message, title or
|
174
|
+
system 'xmessage', '-timeout', '5', '-title', title, message
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
For example, to see on-screen-display notifications about completed test
|
180
|
+
runs (both successes and failures) and also see failure logs for failed test
|
181
|
+
runs in your terminal, add the following to your configuration file:
|
161
182
|
|
162
183
|
Test::Loop.after_each_test = lambda do |test_file, log_file, run_status, started_at, elapsed_time|
|
163
184
|
success = run_status.success?
|
164
185
|
|
186
|
+
# display the failure log
|
187
|
+
unless success
|
188
|
+
divider = '#' * 80
|
189
|
+
STDERR.print [divider, File.read(log_file), divider, nil].join("\n")
|
190
|
+
end
|
191
|
+
|
192
|
+
# notify the user about test completion
|
165
193
|
title = '%s at %s in %0.1fs' %
|
166
194
|
[success ? 'PASS' : 'FAIL', started_at.strftime('%X'), elapsed_time]
|
167
195
|
|
@@ -170,15 +198,7 @@ you can query and modify the `Test::Loop` OpenStruct configuration as follows:
|
|
170
198
|
Thread.new do # run in background
|
171
199
|
system 'notify-send', '-i', "dialog-#{success ? 'information' : 'error'}", title, message or
|
172
200
|
system 'growlnotify', '-a', 'Xcode', '-m', message, title or
|
173
|
-
system 'xmessage', '-timeout', '5', '-title', title, message
|
174
|
-
puts title, message
|
175
|
-
|
176
|
-
unless success # show failure log
|
177
|
-
system 'open', log_file or
|
178
|
-
system 'xdg-open', log_file or
|
179
|
-
system 'xmessage', '-title', log_file, '-file', log_file or
|
180
|
-
puts log_file, File.read(log_file)
|
181
|
-
end
|
201
|
+
system 'xmessage', '-timeout', '5', '-title', title, message
|
182
202
|
end
|
183
203
|
end
|
184
204
|
|
data/bin/test-loop
CHANGED
@@ -28,12 +28,10 @@ require 'diff/lcs'
|
|
28
28
|
module Test
|
29
29
|
Loop = OpenStruct.new
|
30
30
|
|
31
|
-
Loop.config_file_path = File.join(Dir.pwd, '.test-loop')
|
32
|
-
|
33
31
|
Loop.overhead_file_globs = ['{test,spec}/{test,spec}_helper.rb']
|
34
32
|
|
35
33
|
Loop.reabsorb_file_globs = Loop.overhead_file_globs +
|
36
|
-
['config
|
34
|
+
['config/**/*.{rb,yml}', 'Gemfile.lock']
|
37
35
|
|
38
36
|
Loop.test_file_matchers = {
|
39
37
|
# source files that correspond to test files
|
@@ -88,18 +86,19 @@ module Test
|
|
88
86
|
|
89
87
|
private
|
90
88
|
|
91
|
-
SCRIPT_NAME = File.basename($0).freeze
|
92
89
|
EXEC_VECTOR = [$0, *ARGV].map {|s| s.dup.freeze }.freeze
|
93
90
|
|
94
91
|
def notify message
|
95
92
|
# using print() because puts() is not an atomic operation
|
96
|
-
print "
|
93
|
+
print "test-loop: #{message}\n"
|
97
94
|
end
|
98
95
|
|
99
96
|
def register_signals
|
100
|
-
|
101
|
-
|
102
|
-
trap(:
|
97
|
+
# puts newline to shield normal output from control-key interference:
|
98
|
+
# some shells like BASH emit text when control-key combos are pressed
|
99
|
+
trap(:INT) { puts; kill_master_and_workers }
|
100
|
+
trap(:QUIT) { puts; reload_master_process }
|
101
|
+
trap(:TSTP) { puts; forcibly_run_all_tests }
|
103
102
|
end
|
104
103
|
|
105
104
|
def kill_master_and_workers
|
@@ -116,9 +115,9 @@ module Test
|
|
116
115
|
end
|
117
116
|
|
118
117
|
def load_user_config
|
119
|
-
if File.exist?
|
118
|
+
if File.exist? config_file = File.join(Dir.pwd, '.test-loop')
|
120
119
|
notify 'Loading configuration...'
|
121
|
-
load
|
120
|
+
load config_file
|
122
121
|
end
|
123
122
|
end
|
124
123
|
|
@@ -206,10 +205,7 @@ module Test
|
|
206
205
|
|
207
206
|
# monitor and report on the worker's progress
|
208
207
|
Thread.new do
|
209
|
-
|
210
|
-
notify [state, worker_pid, test_file].join("\t")
|
211
|
-
end
|
212
|
-
report.call :RUN
|
208
|
+
notify "TEST #{test_file}"
|
213
209
|
|
214
210
|
# wait for worker to finish
|
215
211
|
begin
|
@@ -219,7 +215,7 @@ module Test
|
|
219
215
|
end
|
220
216
|
elapsed_time = Time.now - @last_ran_at
|
221
217
|
|
222
|
-
|
218
|
+
notify "#{$?.success? && :PASS || :FAIL} #{test_file}"
|
223
219
|
after_each_test.call test_file, log_file, $?, @last_ran_at, elapsed_time
|
224
220
|
@running_files_lock.synchronize { @running_files.delete test_file }
|
225
221
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 9
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 9.0.
|
8
|
+
- 1
|
9
|
+
version: 9.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Suraj N. Kurapati
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-18 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|