MCPcopy
hub / github.com/openai/codex-plugin-cc / waitFor

Function waitFor

tests/runtime.test.mjs:19–29  ·  view source on GitHub ↗
(predicate, { timeoutMs = 5000, intervalMs = 50 } = {})

Source from the content-addressed store, hash-verified

17const SESSION_HOOK = path.join(PLUGIN_ROOT, "scripts", "session-lifecycle-hook.mjs");
18
19async function waitFor(predicate, { timeoutMs = 5000, intervalMs = 50 } = {}) {
20 const start = Date.now();
21 while (Date.now() - start < timeoutMs) {
22 const value = await predicate();
23 if (value) {
24 return value;
25 }
26 await new Promise((resolve) => setTimeout(resolve, intervalMs));
27 }
28 throw new Error("Timed out waiting for condition.");
29}
30
31test("setup reports ready when fake codex is installed and authenticated", () => {
32 const binDir = makeTempDir();

Callers 1

runtime.test.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected