(promise, label, ms = 10000)
| 50 | } |
| 51 | |
| 52 | function withTimeout(promise, label, ms = 10000) { |
| 53 | let timer = null; |
| 54 | const timeout = new Promise((_, reject) => { |
| 55 | timer = setTimeout(() => reject(new Error(`${label} timed out after ${ms}ms`)), ms); |
| 56 | }); |
| 57 | return Promise.race([promise, timeout]).finally(() => clearTimeout(timer)); |
| 58 | } |
| 59 | |
| 60 | async function test(name, fn) { |
| 61 | results.total++; |
no outgoing calls
no test coverage detected