(predicate: () => boolean, timeoutMs = 4_000)
| 172 | } |
| 173 | |
| 174 | async function waitFor(predicate: () => boolean, timeoutMs = 4_000): Promise<void> { |
| 175 | const deadline = Date.now() + timeoutMs; |
| 176 | while (Date.now() < deadline) { |
| 177 | if (predicate()) return; |
| 178 | await new Promise<void>((resolve) => setTimeout(resolve, 30)); |
| 179 | } |
| 180 | throw new Error("timed out waiting for condition"); |
| 181 | } |
| 182 | |
| 183 | test("createHotStateReload reloadNow refreshes transitive imports and swaps view", async () => { |
| 184 | await withTempDir(async (dir) => { |
no outgoing calls
no test coverage detected