(timeoutMs: number)
| 119 | } |
| 120 | |
| 121 | waitForFirstResponse(timeoutMs: number): Promise<JsonRpcMessage> { |
| 122 | const existing = this.messages.find( |
| 123 | (message) => typeof message.id === "string" || typeof message.id === "number", |
| 124 | ); |
| 125 | if (existing) return Promise.resolve(existing); |
| 126 | return new Promise((resolve, reject) => { |
| 127 | const timeout = setTimeout(() => { |
| 128 | // oxlint-disable-next-line executor/no-promise-reject, executor/no-error-constructor -- boundary: Promise timeout adapter for e2e polling. |
| 129 | reject(new Error("timed out waiting for the first JSON-RPC response")); |
| 130 | }, timeoutMs); |
| 131 | this.responseWaiters.push({ |
| 132 | resolve: (message) => { |
| 133 | clearTimeout(timeout); |
| 134 | resolve(message); |
| 135 | }, |
| 136 | }); |
| 137 | }); |
| 138 | } |
| 139 | |
| 140 | abort(reason: string): void { |
| 141 | this.abortController?.abort(reason); |
no test coverage detected