test_bench-bootstrap 7.0.0 → 7.0.2
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/upstream-lib/test_bench_bootstrap/test_bench/fixture/fixture.rb +7 -4
- data/upstream-lib/test_bench_bootstrap/test_bench/output/output.rb +1 -1
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace.rb +32 -6
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace.rb +17 -5
- data/upstream-lib/test_bench_bootstrap/test_bench/session/session.rb +20 -19
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute.rb +12 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/test_bench.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e69c31a9e3c8e9a9faa93deed4e46630d6d2d2fb7c5076ba4ed4a00deda92ad3
|
4
|
+
data.tar.gz: 210859751f32b656864846ebc1a28046167711054b028711aa6ba0354eb5f991
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9d2132905ca36a2231daad6c42e179bfcc944ccff00c6b67244f21d91e59b57180d6f0985cb6c9eda8d76c7e05e3a9a12826bb7d239e5202c6e0950f286e48f
|
7
|
+
data.tar.gz: 2cff56abf3645ae094fe71809ac548e67ff364dd766a2f4c2acf0149261d1b9a7c4d944b847c1ab4c757eb0723559d607029793e762a7c2683f8370298eebda8
|
@@ -118,6 +118,13 @@ module TestBenchBootstrap
|
|
118
118
|
return text, disposition
|
119
119
|
end
|
120
120
|
|
121
|
+
## Remove when no longer in use - Nathan, Tue Jul 15 2025
|
122
|
+
def self.output(fixture)
|
123
|
+
test_session = fixture.test_session
|
124
|
+
|
125
|
+
Output::Get.(test_session)
|
126
|
+
end
|
127
|
+
|
121
128
|
def comment(heading_text=nil, text_or_fixture, style: nil, disposition: nil)
|
122
129
|
if not heading_text.nil?
|
123
130
|
heading_style = Output::CommentStyle.heading
|
@@ -195,10 +202,6 @@ module TestBenchBootstrap
|
|
195
202
|
end
|
196
203
|
end
|
197
204
|
|
198
|
-
def execute(file_path)
|
199
|
-
test_session.execute(file_path)
|
200
|
-
end
|
201
|
-
|
202
205
|
def fixture(fixture_class, *, test_session: nil, **, &)
|
203
206
|
test_session ||= self.test_session
|
204
207
|
|
@@ -548,7 +548,7 @@ module TestBenchBootstrap
|
|
548
548
|
|
549
549
|
module Defaults
|
550
550
|
def self.detail_policy
|
551
|
-
env_var_value = ENV.fetch('
|
551
|
+
env_var_value = ENV.fetch('TEST_BENCH_DETAIL', 'failure')
|
552
552
|
|
553
553
|
detail_policy = env_var_value.to_sym
|
554
554
|
|
@@ -31,10 +31,12 @@ module TestBenchBootstrap
|
|
31
31
|
|
32
32
|
module Styling
|
33
33
|
def self.example
|
34
|
+
backtrace = AbsolutePaths::Local::Backtrace.example(styling: true)
|
35
|
+
|
34
36
|
[
|
35
|
-
|
37
|
+
backtrace.first,
|
36
38
|
"\e[2;3m*omitted*\e[23;22m",
|
37
|
-
|
39
|
+
backtrace.last
|
38
40
|
]
|
39
41
|
end
|
40
42
|
end
|
@@ -66,13 +68,37 @@ module TestBenchBootstrap
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def self.backtrace
|
69
|
-
|
70
|
-
backtrace_location.to_s.delete_prefix(::File.join(apex_directory, ''))
|
71
|
-
end
|
71
|
+
Backtrace.example
|
72
72
|
end
|
73
73
|
|
74
74
|
def self.apex_directory
|
75
|
-
|
75
|
+
Backtrace.apex_directory
|
76
|
+
end
|
77
|
+
|
78
|
+
module Backtrace
|
79
|
+
def self.example(styling: nil)
|
80
|
+
styling ||= false
|
81
|
+
|
82
|
+
if styling
|
83
|
+
relative_path_prefix = "\e[2m./\e[22m"
|
84
|
+
else
|
85
|
+
relative_path_prefix = "./"
|
86
|
+
end
|
87
|
+
|
88
|
+
Exception::AbsolutePaths::Example.backtrace_locations.map do |backtrace_location|
|
89
|
+
backtrace_location_text = backtrace_location.to_s
|
90
|
+
|
91
|
+
backtrace_location_text.delete_prefix!(::File.join(apex_directory, ''))
|
92
|
+
|
93
|
+
backtrace_location_text.insert(0, relative_path_prefix)
|
94
|
+
|
95
|
+
backtrace_location_text
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.apex_directory
|
100
|
+
Path::ApexDirectory.tmpdir
|
101
|
+
end
|
76
102
|
end
|
77
103
|
end
|
78
104
|
end
|
@@ -39,7 +39,7 @@ module TestBenchBootstrap
|
|
39
39
|
if styling?
|
40
40
|
omitted_text = "\e[2;3m*omitted*\e[23;22m"
|
41
41
|
else
|
42
|
-
omitted_text =
|
42
|
+
omitted_text = '*omitted*'
|
43
43
|
end
|
44
44
|
|
45
45
|
backtrace = []
|
@@ -65,10 +65,8 @@ module TestBenchBootstrap
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
apex_directory_prefix = ::File.join(apex_directory, '')
|
69
|
-
|
70
68
|
backtrace.each do |backtrace_location_text|
|
71
|
-
backtrace_location_text
|
69
|
+
delete_apex_directory_prefix(backtrace_location_text)
|
72
70
|
end
|
73
71
|
|
74
72
|
exception.set_backtrace(backtrace)
|
@@ -84,7 +82,7 @@ module TestBenchBootstrap
|
|
84
82
|
location ||= exception.backtrace_locations.first
|
85
83
|
|
86
84
|
location = "#{location.path}:#{location.lineno}"
|
87
|
-
location
|
85
|
+
delete_apex_directory_prefix(location)
|
88
86
|
location
|
89
87
|
end
|
90
88
|
|
@@ -96,6 +94,20 @@ module TestBenchBootstrap
|
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
97
|
+
def delete_apex_directory_prefix(backtrace_location_text)
|
98
|
+
if styling?
|
99
|
+
relative_path_prefix = "\e[2m./\e[22m"
|
100
|
+
else
|
101
|
+
relative_path_prefix = './'
|
102
|
+
end
|
103
|
+
|
104
|
+
apex_directory_prefix = ::File.join(apex_directory, '')
|
105
|
+
|
106
|
+
if backtrace_location_text.delete_prefix!(apex_directory_prefix)
|
107
|
+
backtrace_location_text.insert(0, relative_path_prefix)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
99
111
|
module Defaults
|
100
112
|
def self.omit_patterns
|
101
113
|
env_omit_backtrace_pattern = ENV.fetch('TEST_BENCH_OMIT_BACKTRACE_PATTERN', '')
|
@@ -5,6 +5,9 @@ module TestBenchBootstrap
|
|
5
5
|
|
6
6
|
ExecutionBreak = Object.new
|
7
7
|
|
8
|
+
## Remove when no longer in use - Nathan, Tue Jul 15 2025
|
9
|
+
Abort = ExecutionBreak
|
10
|
+
|
8
11
|
def telemetry
|
9
12
|
@telemetry ||= Telemetry::Substitute.build
|
10
13
|
end
|
@@ -202,34 +205,32 @@ module TestBenchBootstrap
|
|
202
205
|
|
203
206
|
catch(ExecutionBreak) do
|
204
207
|
block.(self)
|
205
|
-
end
|
206
208
|
|
207
|
-
|
208
|
-
|
209
|
-
|
209
|
+
rescue Failure => failure
|
210
|
+
message = failure.message
|
211
|
+
record_event(Events::Failed.build(message))
|
210
212
|
|
211
|
-
|
212
|
-
|
213
|
+
rescue ::Exception => exception
|
214
|
+
aborted_recorded = status.error_sequence > previous_status.error_sequence
|
213
215
|
|
214
|
-
|
215
|
-
|
216
|
+
if not aborted_recorded
|
217
|
+
location = format_backtrace.(exception)
|
216
218
|
|
217
|
-
|
218
|
-
|
219
|
-
record_event(Events::Aborted.build(message, location))
|
220
|
-
end
|
219
|
+
message = exception.detailed_message
|
221
220
|
|
222
|
-
|
221
|
+
record_event(Events::Aborted.build(message, location))
|
222
|
+
end
|
223
223
|
|
224
|
-
|
225
|
-
result = status.result(previous_status, pending_event)
|
224
|
+
raise exception
|
226
225
|
|
227
|
-
|
228
|
-
|
226
|
+
ensure
|
227
|
+
result = status.result(previous_status, pending_event)
|
229
228
|
|
230
|
-
|
231
|
-
|
229
|
+
pending_event.result = result
|
230
|
+
record_event(pending_event)
|
232
231
|
end
|
232
|
+
|
233
|
+
result
|
233
234
|
end
|
234
235
|
end
|
235
236
|
end
|
@@ -131,6 +131,18 @@ module TestBenchBootstrap
|
|
131
131
|
RUBY
|
132
132
|
end
|
133
133
|
|
134
|
+
alias :test? :any_test_started_event?
|
135
|
+
alias :one_test? :one_test_started_event?
|
136
|
+
|
137
|
+
alias :context? :any_context_started_event?
|
138
|
+
alias :one_context? :one_context_started_event?
|
139
|
+
|
140
|
+
alias :comment? :any_commented_event?
|
141
|
+
alias :one_comment? :one_commented_event?
|
142
|
+
|
143
|
+
alias :detail? :any_detailed_event?
|
144
|
+
alias :one_detail? :one_detailed_event?
|
145
|
+
|
134
146
|
def one_event?(...)
|
135
147
|
sink.one_event?(...)
|
136
148
|
end
|