MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / waitFor

Function waitFor

__tests__/watcher-replaced-db.test.ts:41–48  ·  view source on GitHub ↗
(cond: () => boolean | Promise<boolean>, timeoutMs = 10000)

Source from the content-addressed store, hash-verified

39}
40
41async function waitFor(cond: () => boolean | Promise<boolean>, timeoutMs = 10000): Promise<void> {
42 const start = Date.now();
43 while (Date.now() - start < timeoutMs) {
44 if (await cond()) return;
45 await new Promise((r) => setTimeout(r, 50));
46 }
47 throw new Error('timed out waiting for condition');
48}
49
50describe('live sync after the index is rebuilt by another process (#1902)', () => {
51 let root: string;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected