(
promise: Promise<T>,
timeoutMs: number,
label: string
)
| 30 | } |
| 31 | |
| 32 | async function waitWithTimeout<T>( |
| 33 | promise: Promise<T>, |
| 34 | timeoutMs: number, |
| 35 | label: string |
| 36 | ): Promise<T> { |
| 37 | let timer: ReturnType<typeof setTimeout> | undefined; |
| 38 | try { |
| 39 | return await Promise.race([ |
| 40 | promise, |
| 41 | new Promise<T>((_, reject) => { |
| 42 | timer = setTimeout(() => reject(new Error(`Timeout: ${label}`)), timeoutMs); |
| 43 | }), |
| 44 | ]); |
| 45 | } finally { |
| 46 | if (timer) clearTimeout(timer); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | function onTestFinishedForceStop(client: CopilotClient): void { |
| 51 | onTestFinished(async () => { |
no outgoing calls
no test coverage detected
searching dependent graphs…