(cond: () => boolean | Promise<boolean>, timeoutMs = 10000)
| 39 | } |
| 40 | |
| 41 | async function waitFor(cond: () => boolean | Promise<boolean>, timeoutMs = 10000): Promise<void> { |
| 42 | const start = Date.now(); |
| 43 | while (Date.now() - start < timeoutMs) { |
| 44 | if (await cond()) return; |
| 45 | await new Promise((r) => setTimeout(r, 50)); |
| 46 | } |
| 47 | throw new Error('timed out waiting for condition'); |
| 48 | } |
| 49 | |
| 50 | describe('live sync after the index is rebuilt by another process (#1902)', () => { |
| 51 | let root: string; |
no outgoing calls
no test coverage detected