rspec-capturing-formatter 1.0.0 → 1.0.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 80a4b49223b6aaa6bbd6d56615f473e9fcf466325c920085dcc5feb265b88481
|
|
4
|
+
data.tar.gz: 8dda70c2b5caa5b7a1d850f24c0076eace39040f88440cecea0a39cd86d164eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9105fd05e4abc47239bb4035f52d5022a3396b0f3e9e4d0d640c9a721572a9a4ea44fe96788a640e5904cdb028b53bbd8605a36f6cc99829c1587d7935e933d9
|
|
7
|
+
data.tar.gz: dc5d6157f91fcb8f8cd5f8a9e46116744e52bb1b1dfebbc151369adbf4ce22cede4007617468feb3fde85d55b5735436406b0ca63fa43080c8232687032a1249
|
|
@@ -78,14 +78,14 @@ module RSpec
|
|
|
78
78
|
line("RSpec suite") if heading
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
def capture(source, value, encoding = nil)
|
|
81
|
+
def capture(source, value, encoding = nil, nonblocking: false)
|
|
82
82
|
if @capture_source != source
|
|
83
83
|
finish_capture
|
|
84
84
|
@capture_source = source
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
text = (@sanitizers[source] ||= Sanitizer.new).process(value, encoding)
|
|
88
|
-
emit_captured_text(source, text)
|
|
88
|
+
emit_captured_text(source, text, nonblocking: nonblocking)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def message(lines, inside_example: false)
|
|
@@ -184,8 +184,8 @@ module RSpec
|
|
|
184
184
|
begin_entry
|
|
185
185
|
@entry_kind = :reruns
|
|
186
186
|
@entry_path = nil
|
|
187
|
-
line("Failed examples")
|
|
188
|
-
commands.each { |command| line(" #{command}") }
|
|
187
|
+
line("Failed examples", :red)
|
|
188
|
+
commands.each { |command| line(" #{command}", :red) }
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
def seed(seed)
|
|
@@ -222,7 +222,7 @@ module RSpec
|
|
|
222
222
|
|
|
223
223
|
private
|
|
224
224
|
|
|
225
|
-
def emit_captured_text(source, text)
|
|
225
|
+
def emit_captured_text(source, text, nonblocking: false)
|
|
226
226
|
text = strip_sgr(text) unless @ansi_supported
|
|
227
227
|
return if text.empty?
|
|
228
228
|
|
|
@@ -250,7 +250,7 @@ module RSpec
|
|
|
250
250
|
|
|
251
251
|
@capture_open = true unless text.end_with?("\n")
|
|
252
252
|
@capture_open = false if text.end_with?("\n")
|
|
253
|
-
write_raw(rendered)
|
|
253
|
+
write_raw(rendered, nonblocking: nonblocking)
|
|
254
254
|
end
|
|
255
255
|
|
|
256
256
|
def captured_part(source, value)
|
|
@@ -273,12 +273,13 @@ module RSpec
|
|
|
273
273
|
write_raw("\n")
|
|
274
274
|
end
|
|
275
275
|
|
|
276
|
-
def write_raw(value)
|
|
276
|
+
def write_raw(value, nonblocking: false)
|
|
277
277
|
return if value.nil? || value.empty?
|
|
278
278
|
|
|
279
279
|
text = encode_for_output(value)
|
|
280
280
|
if @pending_output.nil? || @pending_output.empty?
|
|
281
281
|
@pending_output = text.dup
|
|
282
|
+
@pending_output_nonblocking = nonblocking
|
|
282
283
|
else
|
|
283
284
|
@pending_output << text
|
|
284
285
|
end
|
|
@@ -303,7 +304,7 @@ module RSpec
|
|
|
303
304
|
end
|
|
304
305
|
|
|
305
306
|
def write_pending_chunk
|
|
306
|
-
if @output.respond_to?(:write_nonblock)
|
|
307
|
+
if @pending_output_nonblocking && @output.respond_to?(:write_nonblock)
|
|
307
308
|
written = @output.write_nonblock(@pending_output)
|
|
308
309
|
raise Errno::EAGAIN if written == :wait_writable
|
|
309
310
|
|
|
@@ -116,7 +116,12 @@ module RSpec
|
|
|
116
116
|
proxy.write_backing(value, method, **options)
|
|
117
117
|
else
|
|
118
118
|
begin
|
|
119
|
-
@formatter.capture(
|
|
119
|
+
@formatter.capture(
|
|
120
|
+
proxy.source,
|
|
121
|
+
value,
|
|
122
|
+
value.encoding,
|
|
123
|
+
nonblocking: nonblocking_method?(method)
|
|
124
|
+
)
|
|
120
125
|
rescue IO::WaitWritable, Errno::EAGAIN
|
|
121
126
|
@pending_nonblock[proxy] = value if nonblocking_method?(method)
|
|
122
127
|
raise
|
|
@@ -163,14 +163,14 @@ module RSpec
|
|
|
163
163
|
with_capture_lock { @manager.deactivate(@lease) }
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
-
def capture(source, value, encoding)
|
|
166
|
+
def capture(source, value, encoding, nonblocking: false)
|
|
167
167
|
with_capture_lock do
|
|
168
168
|
if @current_example
|
|
169
|
-
@renderer.capture(source.to_s, value, encoding)
|
|
169
|
+
@renderer.capture(source.to_s, value, encoding, nonblocking: nonblocking)
|
|
170
170
|
else
|
|
171
171
|
ensure_suite_or_context
|
|
172
172
|
label = (source == :stdout) ? "suite stdout" : "suite stderr"
|
|
173
|
-
@renderer.capture(label, value, encoding)
|
|
173
|
+
@renderer.capture(label, value, encoding, nonblocking: nonblocking)
|
|
174
174
|
end
|
|
175
175
|
end
|
|
176
176
|
end
|