(line: string)
| 250 | export const isToolTrailResultLine = (line: string) => line.endsWith(' ✓') || line.endsWith(' ✗') |
| 251 | |
| 252 | export const parseToolTrailResultLine = (line: string) => { |
| 253 | if (!isToolTrailResultLine(line)) { |
| 254 | return null |
| 255 | } |
| 256 | |
| 257 | const mark = line.endsWith(' ✗') ? '✗' : '✓' |
| 258 | const body = line.slice(0, -2) |
| 259 | const sep = body.indexOf(' :: ') |
| 260 | |
| 261 | if (sep >= 0) { |
| 262 | return { call: body.slice(0, sep), detail: body.slice(sep + 4), mark } |
| 263 | } |
| 264 | |
| 265 | const legacy = body.indexOf(': ') |
| 266 | |
| 267 | if (legacy > 0) { |
| 268 | return { call: body.slice(0, legacy), detail: body.slice(legacy + 2), mark } |
| 269 | } |
| 270 | |
| 271 | return { call: body, detail: '', mark } |
| 272 | } |
| 273 | |
| 274 | export const splitToolDuration = (call: string) => { |
| 275 | const match = call.match(/^(.*?)( \(\d+(?:\.\d)?s\))$/) |
no test coverage detected