MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / settles

Function settles

test/unit/session_composition_test.js:9–16  ·  view source on GitHub ↗
(promise, ms = 2000)

Source from the content-addressed store, hash-verified

7import { within, retryTo, hopeThat } from '../../lib/effects.js'
8
9const settles = (promise, ms = 2000) =>
10 Promise.race([
11 promise,
12 new Promise((_, reject) => {
13 const t = setTimeout(() => reject(new Error(`did not settle within ${ms}ms`)), ms)
14 t.unref?.()
15 }),
16 ])
17
18// Re-reads recorder.promise() repeatedly so errors attached to trailing tasks
19// (added while the chain runs) are surfaced. Returns the last error seen, or

Callers 2

drainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected