344
345
// parseFailureDetails extracts the actionable part of a JUnit failure Data block.
347
>
lines := normalizedFailureLines(data)
348
>
349
>
// Prefer assertion blocks because they contain the useful testify failure
350
>
// detail and can be selected from the end while ignoring trailing logs.
351
>
if block, ok := findLastAssertionFailureBlock(lines); ok {
352
return block
353
}
354
// Some failures, such as gomock errors, do not include an Error Trace.
355
// Fall back to the last Go test output block in those cases.
358
>
}
359
return noFailureDetails
360
}
361
363
>
lines := strings.Split(strings.ReplaceAll(data, "\r\n", "\n"), "\n")
364
>
for len(lines) > 0 {
365
>
t := strings.TrimSpace(lines[len(lines)-1])
366
>
if t != "" && t != "FAIL" {
368
}
370
}
372
}
373
375
>
var failLine string
376
>
for i := len(lines) - 1; i >= 0; i-- {
378
>
if failLine == "" && strings.HasPrefix(line, goTestFailLinePrefix) {
379
// Keep the final Go test failure line because it carries the test duration.
380
failLine = line
381
continue
382
}
384
>
continue
385
}
386