@@ -111,6 +111,24 @@ function get_status(result)
111111 end
112112end
113113
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+
114132function result_dict (result:: Test.Result )
115133 file, line = if ! hasproperty (result, :source ) || isnothing (result. source)
116134 " unknown" , 0
@@ -120,19 +138,18 @@ function result_dict(result::Test.Result)
120138 file = generalize_file_paths (string (file))
121139
122140 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)
127142
128143 data = Dict {String,Any} (
129- " name" => " $(primary_reason) . Expression: $(result . orig_expr) " ,
144+ " name" => test_call ,
130145 " location" => string (file, ' :' , line),
131146 " file_name" => file,
132147 " result" => status)
133148
134149 job_label = replace (get (ENV , " BUILDKITE_LABEL" , " job label not found" ), r" :\w +:\s *" => " " )
135150 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 ]
136153 data[" failure_reason" ] = generalize_file_paths (firstline) * " | $job_label "
137154 err_trace = split (result_show, " \n Stacktrace:\n " , limit= 2 )
138155 if length (err_trace) == 2
0 commit comments