in src/main/kotlin/com/pestphp/pest/runner/PestTestStackTraceParser.kt [12:28]
fun parse(url: String,
stacktrace: String?,
errorMessage: String?,
locator: PestLocationProvider,
project: Project): PestTestStackTraceParser {
if (stacktrace == null) return PestTestStackTraceParser(errorMessage)
val lines = stacktrace.split("\n")
if (lines.isEmpty()) return PestTestStackTraceParser(errorMessage)
val realErrorMessage = if (errorMessage.isNullOrEmpty()) lines[0] else errorMessage
val path = url.removePrefix("${PestLocationProvider.PROTOCOL_ID}://").substringBefore( "::")
val lastLine = lines.last().trim { it <= ' ' }.substringAfter("at ")
if (path == url || !lastLine.startsWith(path)) return PestTestStackTraceParser(realErrorMessage)
val failedLine = StringUtil.parseInt(lastLine.substring(path.length + 1), -1)
val failedLineText = if (failedLine > 0) getLineText(path, failedLine, project, locator) else null
return PestTestStackTraceParser(failedLine, failedLineText, realErrorMessage, null)
}