(sanitized: string, limit = 20)
| 76 | * into a separate section that the body-cap is careful not to drop. |
| 77 | */ |
| 78 | export function extractRecentErrors(sanitized: string, limit = 20): string[] { |
| 79 | const matches: string[] = []; |
| 80 | const lines = sanitized.split(/\r?\n/); |
| 81 | // Walk newest-first, stop once we hit `limit`. |
| 82 | for (let i = lines.length - 1; i >= 0 && matches.length < limit; i -= 1) { |
| 83 | if (isErrorLogLine(lines[i])) { |
| 84 | matches.push(lines[i]); |
| 85 | } |
| 86 | } |
| 87 | return matches.reverse(); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Apply a byte budget to a rendered issue body. If the body is already |
no test coverage detected