test: tighten browser cdp transport failure assertions · openclaw/openclaw@b28e29c
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
File tree
extensions/browser/src/browser
| Original file line number | Diff line number | Diff line change |
|---|
@@ -354,7 +354,7 @@ describe("cdp.helpers internal", () => {
|
354 | 354 | withCdpSocket("ws://127.0.0.1:1/devtools/browser/NO", async () => { |
355 | 355 | return "unreachable"; |
356 | 356 | }), |
357 | | -).rejects.toThrow(); |
| 357 | +).rejects.toThrow(/ECONNREFUSED|CDP socket closed/); |
358 | 358 | }); |
359 | 359 | |
360 | 360 | it("wraps a non-Error callback throw before closing the socket", async () => { |
@@ -438,7 +438,7 @@ describe("cdp.helpers internal", () => {
|
438 | 438 | withCdpSocket(server.url, async (send) => { |
439 | 439 | await send("Test.boom"); |
440 | 440 | }), |
441 | | -).rejects.toThrow(); |
| 441 | +).rejects.toThrow(/CDP socket closed|WebSocket was closed/i); |
442 | 442 | }); |
443 | 443 | |
444 | 444 | // The non-Error branch of the `err instanceof Error ? ... : new Error(String(err))` |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -201,7 +201,7 @@ describe("cdp", () => {
|
201 | 201 | url: "https://example.com", |
202 | 202 | timeouts: { httpTimeoutMs: 20 }, |
203 | 203 | }), |
204 | | -).rejects.toThrow(); |
| 204 | +).rejects.toThrow(/abort|timeout|timed out/i); |
205 | 205 | }); |
206 | 206 | |
207 | 207 | it("honors configured WebSocket handshake timeouts when creating a target", async () => { |
@@ -222,7 +222,7 @@ describe("cdp", () => {
|
222 | 222 | url: "https://example.com", |
223 | 223 | timeouts: { handshakeTimeoutMs: 20 }, |
224 | 224 | }), |
225 | | -).rejects.toThrow(); |
| 225 | +).rejects.toThrow(/handshake|timeout|timed out/i); |
226 | 226 | } finally { |
227 | 227 | for (const socket of heldSockets) { |
228 | 228 | socket.destroy(); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。