test: clear browser open tab timeout guard · openclaw/openclaw@105cc8d
shakkernerd
·
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 |
|---|
@@ -272,12 +272,17 @@ describe("browser server-context tab selection state", () => {
|
272 | 272 | }, |
273 | 273 | }); |
274 | 274 | |
| 275 | +let timeout: NodeJS.Timeout | undefined; |
275 | 276 | const opened = await Promise.race([ |
276 | 277 | openManagedTabWithRunningProfile({ fetchMock }), |
277 | | -new Promise<never>((_, reject) => |
278 | | -setTimeout(() => reject(new Error("openTab timed out waiting for cleanup")), 300), |
279 | | -), |
280 | | -]); |
| 278 | +new Promise<never>((_, reject) => { |
| 279 | +timeout = setTimeout(() => reject(new Error("openTab timed out waiting for cleanup")), 300); |
| 280 | +}), |
| 281 | +]).finally(() => { |
| 282 | +if (timeout) { |
| 283 | +clearTimeout(timeout); |
| 284 | +} |
| 285 | +}); |
281 | 286 | |
282 | 287 | expect(opened.targetId).toBe("NEW"); |
283 | 288 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。