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