(promise, ms = 2000)
| 7 | import { within, retryTo, hopeThat } from '../../lib/effects.js' |
| 8 | |
| 9 | const 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 |
no outgoing calls
no test coverage detected