(p: Promise<T>, ms: number, what: string)
| 45 | } |
| 46 | |
| 47 | function withTimeout<T>(p: Promise<T>, ms: number, what: string): Promise<T> { |
| 48 | let timer: ReturnType<typeof setTimeout> | undefined; |
| 49 | const timeout = new Promise<T>((_, reject) => { |
| 50 | timer = setTimeout(() => reject(new Error(`Timed out waiting for ${what} after ${ms}ms`)), ms); |
| 51 | }); |
| 52 | return Promise.race([p, timeout]).finally(() => { |
| 53 | if (timer !== undefined) clearTimeout(timer); |
| 54 | }); |
| 55 | } |
| 56 | |
| 57 | Deno.test('denoRedisIntegration: included in default integrations', () => { |
| 58 | resetGlobals(); |
no test coverage detected