rspec_trunk_flaky_tests 0.12.10.pre.beta.1 → 0.12.10.pre.beta.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/trunk_spec_helper.rb +15 -9
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e638f9ccf4ec88822cc5b74df2084fb6e862ded37cf626a88ce8787759ae01b
|
|
4
|
+
data.tar.gz: bc783060c056f99859450205500f9f02eb490ff6ac89cd59653c421d9c99d0eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 937983ce279fe83cbad7928f64dc81a04e21a3430bb2f0ff3a896d7538e9c0762f2b8f34df3d4b49c919259cb6aa95d47492ff86b8ce46b01db322eb8a5ae407
|
|
7
|
+
data.tar.gz: 624452abf2b63d213b8acf4e68e154b25107e2e16ed8c41fd5b1d7a88807ccf47c653f0ef8e425834ec7add746e472d73ce9e172f65e42ae5e881c881f1e56f6
|
data/lib/trunk_spec_helper.rb
CHANGED
|
@@ -54,10 +54,16 @@ class String
|
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
ANSI_ESCAPE_PATTERN = %r{(?:\e[@-Z\\-_]|\e\[[0-?]*[ -/]*[@-~])}
|
|
58
|
+
|
|
57
59
|
def escape(str)
|
|
58
60
|
str.dump[1..-2]
|
|
59
61
|
end
|
|
60
62
|
|
|
63
|
+
def strip_ansi_codes(text)
|
|
64
|
+
text.to_s.gsub(ANSI_ESCAPE_PATTERN, '')
|
|
65
|
+
end
|
|
66
|
+
|
|
61
67
|
# Knapsack example detector instantiates all test cases in order to determine how to shard them
|
|
62
68
|
# These instantiations should not generate test bundles, so we
|
|
63
69
|
# disable the gem when running under knapsack_pro:rspec_test_example_detector
|
|
@@ -204,12 +210,12 @@ def format_exception_message(exception, example)
|
|
|
204
210
|
return '' unless exception
|
|
205
211
|
|
|
206
212
|
presenter = RSpec::Core::Formatters::ExceptionPresenter.new(exception, example)
|
|
207
|
-
presenter.fully_formatted(nil, PlainColorizer)
|
|
213
|
+
strip_ansi_codes(presenter.fully_formatted(nil, PlainColorizer))
|
|
208
214
|
rescue StandardError
|
|
209
215
|
legacy_format_exception_message(exception)
|
|
210
216
|
end
|
|
211
217
|
|
|
212
|
-
# trunk-ignore(rubocop/Metrics/MethodLength)
|
|
218
|
+
# trunk-ignore(rubocop/Metrics/MethodLength,rubocop/Metrics/AbcSize)
|
|
213
219
|
def format_exception_backtrace(exception, example)
|
|
214
220
|
return '' unless exception
|
|
215
221
|
|
|
@@ -230,7 +236,7 @@ def format_exception_backtrace(exception, example)
|
|
|
230
236
|
# and after hooks, so we fall back to the legacy formatter
|
|
231
237
|
return legacy_format_exception_backtrace(exception) if result.strip.empty?
|
|
232
238
|
|
|
233
|
-
result
|
|
239
|
+
strip_ansi_codes(result)
|
|
234
240
|
rescue StandardError
|
|
235
241
|
legacy_format_exception_backtrace(exception)
|
|
236
242
|
end
|
|
@@ -246,25 +252,25 @@ def legacy_format_exception_message(exception)
|
|
|
246
252
|
case exception
|
|
247
253
|
when RSpec::Core::MultipleExceptionError
|
|
248
254
|
messages = exception.all_exceptions.map { |e| "#{e.class}: #{e.message}" }
|
|
249
|
-
"#{exception.class}: #{messages.join(' | ')}"
|
|
255
|
+
strip_ansi_codes("#{exception.class}: #{messages.join(' | ')}")
|
|
250
256
|
else
|
|
251
|
-
exception.to_s
|
|
257
|
+
strip_ansi_codes(exception.to_s)
|
|
252
258
|
end
|
|
253
259
|
end
|
|
254
260
|
|
|
255
|
-
# trunk-ignore(rubocop/Metrics/MethodLength)
|
|
261
|
+
# trunk-ignore(rubocop/Metrics/MethodLength,rubocop/Metrics/AbcSize)
|
|
256
262
|
def legacy_format_exception_backtrace(exception)
|
|
257
263
|
case exception
|
|
258
264
|
when RSpec::Core::MultipleExceptionError
|
|
259
|
-
exception.all_exceptions.map do |e|
|
|
265
|
+
strip_ansi_codes(exception.all_exceptions.map do |e|
|
|
260
266
|
if e.backtrace && !e.backtrace.empty?
|
|
261
267
|
"#{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
|
|
262
268
|
else
|
|
263
269
|
"#{e.class}: #{e.message}"
|
|
264
270
|
end
|
|
265
|
-
end.join("\n\n")
|
|
271
|
+
end.join("\n\n"))
|
|
266
272
|
else
|
|
267
|
-
exception.backtrace&.join("\n") || ''
|
|
273
|
+
strip_ansi_codes(exception.backtrace&.join("\n") || '')
|
|
268
274
|
end
|
|
269
275
|
end
|
|
270
276
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec_trunk_flaky_tests
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.12.10.pre.beta.
|
|
4
|
+
version: 0.12.10.pre.beta.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Trunk Technologies, Inc.
|
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '0'
|
|
68
68
|
requirements: []
|
|
69
|
-
rubygems_version: 4.0.
|
|
69
|
+
rubygems_version: 4.0.10
|
|
70
70
|
specification_version: 4
|
|
71
71
|
summary: RSpec plugin for Trunk Flaky Tests - automatically uploads test results to
|
|
72
72
|
detect and quarantine flaky tests
|