MCPcopy Create free account
hub / github.com/Noumena-Network/code / waitUntil

Function waitUntil

src/session/replTurnController.test.ts:116–127  ·  view source on GitHub ↗
(
  predicate: () => boolean,
  timeoutMs = 200,
)

Source from the content-addressed store, hash-verified

114}
115
116async function waitUntil(
117 predicate: () => boolean,
118 timeoutMs = 200,
119): Promise<void> {
120 const started = Date.now()
121 while (!predicate()) {
122 if (Date.now() - started > timeoutMs) {
123 throw new Error('Timed out waiting for condition')
124 }
125 await Bun.sleep(1)
126 }
127}
128
129beforeEach(async () => {
130 resetAnalytics()

Callers 1

Calls 1

sleepMethod · 0.80

Tested by

no test coverage detected