( predicate: () => boolean, message: string, timeoutMs = 500, )
| 75 | } |
| 76 | |
| 77 | async function waitFor( |
| 78 | predicate: () => boolean, |
| 79 | message: string, |
| 80 | timeoutMs = 500, |
| 81 | ): Promise<void> { |
| 82 | const deadline = Date.now() + timeoutMs |
| 83 | while (Date.now() < deadline) { |
| 84 | if (predicate()) return |
| 85 | await Bun.sleep(5) |
| 86 | } |
| 87 | throw new Error(message) |
| 88 | } |
| 89 | |
| 90 | function DialogWriter({ show }: { show: boolean }): React.ReactNode { |
| 91 | const dialog = useMemo( |
no test coverage detected