惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
DataBreaches.Net
B
Blog RSS Feed
博客园_首页
The GitHub Blog
The GitHub Blog
I
InfoQ
L
LangChain Blog
G
Google Developers Blog
M
MIT News - Artificial intelligence
美团技术团队
腾讯CDC
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: tighten fetch timeout assertions · openclaw/opencla...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -11,6 +11,14 @@ vi.mock("../logging/subsystem.js", () => ({

11111212

import { buildTimeoutAbortSignal } from "./fetch-timeout.js";

131314+

function requireWarnRecord(callIndex: number): Record<string, unknown> {

15+

const record = warn.mock.calls[callIndex]?.[1] as Record<string, unknown> | undefined;

16+

if (!record) {

17+

throw new Error(`missing warning record ${callIndex}`);

18+

}

19+

return record;

20+

}

21+1422

describe("buildTimeoutAbortSignal", () => {

1523

beforeEach(() => {

1624

warn.mockClear();

@@ -31,20 +39,16 @@ describe("buildTimeoutAbortSignal", () => {

3139

await vi.advanceTimersByTimeAsync(25);

32403341

expect(signal?.aborted).toBe(true);

34-

expect(signal?.reason).toMatchObject({

35-

name: "TimeoutError",

36-

message: "request timed out",

37-

});

42+

expect((signal?.reason as Error | undefined)?.name).toBe("TimeoutError");

43+

expect((signal?.reason as Error | undefined)?.message).toBe("request timed out");

3844

expect(warn).toHaveBeenCalledTimes(1);

39-

expect(warn).toHaveBeenCalledWith(

40-

"fetch timeout reached; aborting operation",

41-

expect.objectContaining({

42-

timeoutMs: 25,

43-

operation: "unit-test",

44-

url: "https://example.com/v1/responses",

45-

consoleMessage:

46-

"fetch timeout after 25ms (elapsed 25ms) operation=unit-test url=https://example.com/v1/responses",

47-

}),

45+

expect(warn.mock.calls[0]?.[0]).toBe("fetch timeout reached; aborting operation");

46+

const record = requireWarnRecord(0);

47+

expect(record.timeoutMs).toBe(25);

48+

expect(record.operation).toBe("unit-test");

49+

expect(record.url).toBe("https://example.com/v1/responses");

50+

expect(record.consoleMessage).toBe(

51+

"fetch timeout after 25ms (elapsed 25ms) operation=unit-test url=https://example.com/v1/responses",

4852

);

49535054

cleanup();

@@ -74,17 +78,15 @@ describe("buildTimeoutAbortSignal", () => {

7478

Symbol.asyncIterator

7579

]();

768077-

await expect(iterator.next()).resolves.toMatchObject({

78-

done: false,

79-

value: { ok: true },

80-

});

81+

const firstChunk = await iterator.next();

82+

expect(firstChunk.done).toBe(false);

83+

expect(firstChunk.value).toEqual({ ok: true });

8184

const pending = iterator.next().catch((error: unknown) => error);

8285

await vi.advanceTimersByTimeAsync(25);

838684-

await expect(pending).resolves.toMatchObject({

85-

name: "TimeoutError",

86-

message: "request timed out",

87-

});

87+

const timeoutError = (await pending) as Error;

88+

expect(timeoutError.name).toBe("TimeoutError");

89+

expect(timeoutError.message).toBe("request timed out");

88908991

cleanup();

9092

});

@@ -100,15 +102,12 @@ describe("buildTimeoutAbortSignal", () => {

100102

vi.setSystemTime(2_000);

101103

await vi.advanceTimersByTimeAsync(25);

102104103-

expect(warn).toHaveBeenCalledWith(

104-

"fetch timeout reached; aborting operation",

105-

expect.objectContaining({

106-

timerDelayMs: 2000,

107-

eventLoopDelayHint: "timer delayed 2000ms, likely event-loop starvation",

108-

consoleMessage: expect.stringContaining(

109-

"timer delayed 2000ms, likely event-loop starvation",

110-

),

111-

}),

105+

expect(warn.mock.calls[0]?.[0]).toBe("fetch timeout reached; aborting operation");

106+

const record = requireWarnRecord(0);

107+

expect(record.timerDelayMs).toBe(2000);

108+

expect(record.eventLoopDelayHint).toBe("timer delayed 2000ms, likely event-loop starvation");

109+

expect(String(record.consoleMessage)).toContain(

110+

"timer delayed 2000ms, likely event-loop starvation",

112111

);

113112114113

cleanup();

@@ -123,12 +122,8 @@ describe("buildTimeoutAbortSignal", () => {

123122124123

await vi.advanceTimersByTimeAsync(25);

125124126-

expect(warn).toHaveBeenCalledWith(

127-

"fetch timeout reached; aborting operation",

128-

expect.objectContaining({

129-

url: "/api/responses",

130-

}),

131-

);

125+

expect(warn.mock.calls[0]?.[0]).toBe("fetch timeout reached; aborting operation");

126+

expect(requireWarnRecord(0).url).toBe("/api/responses");

132127133128

cleanup();

134129

});