( pid: number, timeoutMs = 5000, )
| 121 | } |
| 122 | |
| 123 | async function waitForProcessExit( |
| 124 | pid: number, |
| 125 | timeoutMs = 5000, |
| 126 | ): Promise<void> { |
| 127 | const startTime = Date.now(); |
| 128 | while (Date.now() - startTime < timeoutMs) { |
| 129 | if (!isProcessAlive(pid)) { |
| 130 | return; |
| 131 | } |
| 132 | await new Promise(resolve => setTimeout(resolve, 50)); |
| 133 | } |
| 134 | throw new Error(`Timeout waiting for process ${pid} to exit`); |
| 135 | } |
| 136 | |
| 137 | function cleanupTest(ctx: TestContext): void { |
| 138 | // Kill Main Process |
no test coverage detected