(runner: VitestRunner)
| 475 | const pendingTasksUpdates: Promise<void>[] = [] |
| 476 | |
| 477 | function sendTasksUpdate(runner: VitestRunner): void { |
| 478 | if (packs.size) { |
| 479 | const taskPacks = Array.from(packs).map<TaskResultPack>(([id, task]) => { |
| 480 | return [id, task[0], task[1]] |
| 481 | }) |
| 482 | const p = runner.onTaskUpdate?.(taskPacks, eventsPacks) |
| 483 | if (p) { |
| 484 | pendingTasksUpdates.push(p) |
| 485 | // remove successful promise to not grow array indefinitely, |
| 486 | // but keep rejections so finishSendTasksUpdate can handle them |
| 487 | p.then( |
| 488 | () => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p), 1), |
| 489 | () => {}, |
| 490 | ) |
| 491 | } |
| 492 | eventsPacks.length = 0 |
| 493 | packs.clear() |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | export async function finishSendTasksUpdate(runner: VitestRunner): Promise<void> { |
| 498 | sendTasksUpdate(runner) |
no test coverage detected