Closed
Description
- Version:
master
- Platform: *
- Subsystem:
test
In some tests we want to delay or retry an async task whose exact timing for success is indeterminable.
A few option come to mind:
setTimeout(task, n)
wheren
is an arbitrary number that's empirically proven to be sufficient.const interval = setInterval(() => {const ret = task(); if (ret) clearInterval(interval);}), 1)
do { const ret = await task()} while (ret != true)
Any other ideas or preferences?
Ref: #13252
Ref: #13312
/cc @nodejs/testing