(
check: () => boolean,
opts?: { debug?: () => string },
)
| 1206 | }); |
| 1207 | |
| 1208 | async function waitUntil( |
| 1209 | check: () => boolean, |
| 1210 | opts?: { debug?: () => string }, |
| 1211 | ): Promise<void> { |
| 1212 | const start = Date.now(); |
| 1213 | while (!check()) { |
| 1214 | if (Date.now() - start > 2000) { |
| 1215 | const extra = opts?.debug ? ` debug=${opts.debug()}` : ''; |
| 1216 | throw new Error(`timeout${extra}`); |
| 1217 | } |
| 1218 | await new Promise((r) => setTimeout(r, 10)); |
| 1219 | } |
| 1220 | } |
no outgoing calls
no test coverage detected