MCPcopy Create free account
hub / github.com/apache/maka / waitFor

Function waitFor

packages/runtime/src/__tests__/runtime-kernel-interaction.test.ts:692–698  ·  view source on GitHub ↗
(predicate: () => boolean)

Source from the content-addressed store, hash-verified

690}
691
692async function waitFor(predicate: () => boolean): Promise<void> {
693 for (let attempt = 0; attempt < 50; attempt += 1) {
694 if (predicate()) return;
695 await new Promise<void>((resolve) => setImmediate(resolve));
696 }
697 assert.fail('condition was not met');
698}
699
700async function within<T>(promise: Promise<T>, operation: string): Promise<T> {
701 let timeout: NodeJS.Timeout | undefined;

Calls 1

failMethod · 0.65

Tested by

no test coverage detected