(logContents: string, stepId: string)
| 58 | } |
| 59 | |
| 60 | function countStaleStepUpdates(logContents: string, stepId: string): number { |
| 61 | return logContents.split("\n").reduce((count, line) => { |
| 62 | if (!line.trim()) { |
| 63 | return count; |
| 64 | } |
| 65 | |
| 66 | try { |
| 67 | const parsed = JSON.parse(line) as { |
| 68 | type?: unknown; |
| 69 | stepId?: unknown; |
| 70 | update?: { error?: unknown } | null; |
| 71 | }; |
| 72 | |
| 73 | if ( |
| 74 | parsed.type === "step-update" && |
| 75 | parsed.stepId === stepId && |
| 76 | parsed.update?.error === "Interrupted (stale)" |
| 77 | ) { |
| 78 | return count + 1; |
| 79 | } |
| 80 | } catch { |
| 81 | // Ignore malformed test fixture lines while counting stale-step updates. |
| 82 | } |
| 83 | |
| 84 | return count; |
| 85 | }, 0); |
| 86 | } |
| 87 | |
| 88 | describe("DevToolsService", () => { |
| 89 | let tempDir: string; |
no test coverage detected