MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / waitFor

Function waitFor

packages/node/src/__tests__/hotStateReload.test.ts:174–181  ·  view source on GitHub ↗
(predicate: () => boolean, timeoutMs = 4_000)

Source from the content-addressed store, hash-verified

172}
173
174async 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
183test("createHotStateReload reloadNow refreshes transitive imports and swaps view", async () => {
184 await withTempDir(async (dir) => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected