( assertion: () => boolean, timeoutMs = 2000, )
| 85 | } |
| 86 | |
| 87 | export async function waitFor( |
| 88 | assertion: () => boolean, |
| 89 | timeoutMs = 2000, |
| 90 | ): Promise<void> { |
| 91 | const startedAt = Date.now() |
| 92 | while (!assertion()) { |
| 93 | if (Date.now() - startedAt > timeoutMs) { |
| 94 | throw new Error(`Timed out waiting for assertion after ${timeoutMs}ms`) |
| 95 | } |
| 96 | await sleep(10) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | function isMissingQueryClientError(error: unknown): boolean { |
| 101 | return ( |
no test coverage detected