@@ -112,6 +112,24 @@ function get_status(result)
112
112
end
113
113
end
114
114
115
+ # An attempt to reconstruct the test call.
116
+ # Note we can't know if broken or skip was via the broken/skip macros or kwargs.
117
+ function get_test_call (result)
118
+ tt = result. test_type
119
+ if tt in (:test , :test_nonbool , :test_error , :test_interrupted )
120
+ " @test $(result. orig_expr) "
121
+ elseif tt === :test_unbroken
122
+ " @test_broken $(result. orig_expr) "
123
+ elseif tt === :skipped
124
+ " @test_skip $(result. orig_expr) "
125
+ elseif tt === (:test_throws , :test_throws_wrong , :test_throws_nothing )
126
+ expected = t. data
127
+ " @test_throws $expected $(result. orig_expr) "
128
+ elseif tt === :nontest_error
129
+ " Non-test error"
130
+ end
131
+ end
132
+
115
133
function result_dict (result:: Test.Result )
116
134
file, line = if ! hasproperty (result, :source ) || isnothing (result. source)
117
135
" unknown" , 0
@@ -121,19 +139,18 @@ function result_dict(result::Test.Result)
121
139
file = generalize_file_paths (string (file))
122
140
123
141
status = get_status (result)
124
-
125
- result_show = sprint (show, result; context= :color => false )
126
- firstline = split (result_show, ' \n ' )[1 ]
127
- primary_reason = split (firstline, " at " )[1 ]
142
+ test_call = get_test_macro (result)
128
143
129
144
data = Dict {String,Any} (
130
- " name" => " $(primary_reason) . Expression: $(result . orig_expr) " ,
145
+ " name" => test_call ,
131
146
" location" => string (file, ' :' , line),
132
147
" file_name" => file,
133
148
" result" => status)
134
149
135
150
job_label = replace (get (ENV , " BUILDKITE_LABEL" , " job label not found" ), r" :\w +:\s *" => " " )
136
151
if result isa Test. Fail || result isa Test. Error
152
+ result_show = sprint (show, result; context= :color => false )
153
+ firstline = split (result_show, ' \n ' )[1 ]
137
154
data[" failure_reason" ] = generalize_file_paths (firstline) * " | $job_label "
138
155
err_trace = split (result_show, " \n Stacktrace:\n " , limit= 2 )
139
156
if length (err_trace) == 2
0 commit comments