( predicate: () => boolean, message: string, timeoutMs = 1500, )
| 59 | } |
| 60 | |
| 61 | async function waitFor( |
| 62 | predicate: () => boolean, |
| 63 | message: string, |
| 64 | timeoutMs = 1500, |
| 65 | ): Promise<void> { |
| 66 | const deadline = Date.now() + timeoutMs |
| 67 | while (Date.now() < deadline) { |
| 68 | if (predicate()) return |
| 69 | await Bun.sleep(10) |
| 70 | } |
| 71 | throw new Error(message) |
| 72 | } |
| 73 | |
| 74 | async function renderComponent(node: React.ReactNode): Promise<string> { |
| 75 | let output = '' |
no test coverage detected