( condition: () => boolean, timeout: number = 1000, interval: number = 10, )
| 234 | } |
| 235 | |
| 236 | export async function waitForCondition( |
| 237 | condition: () => boolean, |
| 238 | timeout: number = 1000, |
| 239 | interval: number = 10, |
| 240 | ): Promise<void> { |
| 241 | const start = Date.now(); |
| 242 | while (!condition()) { |
| 243 | if (Date.now() - start > timeout) { |
| 244 | throw new Error("Timeout waiting for condition"); |
| 245 | } |
| 246 | await new Promise((resolve) => setTimeout(resolve, interval)); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * Helper to create a dynamic suggestions config |
no test coverage detected
searching dependent graphs…