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

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
I
InfoQ
D
Docker
F
Fortinet All Blogs
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
月光博客
月光博客
B
Blog
Engineering at Meta
Engineering at Meta
T
Tailwind CSS Blog
罗磊的独立博客
博客园_首页
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
IT之家
IT之家
V
V2EX

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
fix(ci): isolate timer-sensitive tests · openclaw/opencla...
steipete · 2026-05-31 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -9,10 +9,13 @@ describe("isCliBindingFlushed", () => {

99

const workspaceDir = "/tmp/openclaw-workspace";

1010
1111

beforeEach(() => {

12+

vi.useRealTimers();

1213

restoreCliRunnerTestDeps();

1314

});

1415
1516

afterEach(() => {

17+

vi.clearAllTimers();

18+

vi.useRealTimers();

1619

restoreCliRunnerTestDeps();

1720

});

1821

@@ -34,22 +37,33 @@ describe("isCliBindingFlushed", () => {

3437

});

3538
3639

it("retries up to three times before giving up", async () => {

40+

vi.useFakeTimers();

3741

const probe = vi.fn(async () => false);

3842

setCliRunnerTestDeps({ claudeCliSessionTranscriptHasContent: probe });

3943
40-

expect(await isCliBindingFlushed("sid-cold", "claude-cli", workspaceDir)).toBe(false);

44+

const resultPromise = isCliBindingFlushed("sid-cold", "claude-cli", workspaceDir);

45+

await vi.advanceTimersByTimeAsync(0);

46+

await vi.advanceTimersByTimeAsync(50);

47+

await vi.advanceTimersByTimeAsync(150);

48+
49+

await expect(resultPromise).resolves.toBe(false);

4150

expect(probe).toHaveBeenCalledTimes(3);

4251

});

4352
4453

it("succeeds when the transcript becomes visible on a later retry", async () => {

54+

vi.useFakeTimers();

4555

let calls = 0;

4656

const probe = vi.fn(async () => {

4757

calls += 1;

4858

return calls >= 2;

4959

});

5060

setCliRunnerTestDeps({ claudeCliSessionTranscriptHasContent: probe });

5161
52-

expect(await isCliBindingFlushed("sid-late", "claude-cli", workspaceDir)).toBe(true);

62+

const resultPromise = isCliBindingFlushed("sid-late", "claude-cli", workspaceDir);

63+

await vi.advanceTimersByTimeAsync(0);

64+

await vi.advanceTimersByTimeAsync(50);

65+
66+

await expect(resultPromise).resolves.toBe(true);

5367

expect(probe).toHaveBeenCalledTimes(2);

5468

});

5569

@@ -72,6 +86,7 @@ describe("isCliBindingFlushed", () => {

7286

expect(errored).not.toHaveBeenCalled();

7387

expect(probe).toHaveBeenCalledTimes(3);

7488

} finally {

89+

vi.clearAllTimers();

7590

vi.useRealTimers();

7691

}

7792

});

Original file line numberDiff line numberDiff line change

@@ -1,4 +1,4 @@

1-

import { afterEach, describe, expect, it, vi } from "vitest";

1+

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

22

import type { OpenClawConfig } from "../config/types.openclaw.js";

33

import { MAX_TIMER_TIMEOUT_MS } from "../shared/number-coercion.js";

44

import { loadModelCatalogForBrowse } from "./model-catalog-browse.js";

@@ -24,7 +24,12 @@ function config(params: { providerWildcard?: boolean } = {}): OpenClawConfig {

2424

}

2525
2626

describe("loadModelCatalogForBrowse", () => {

27+

beforeEach(() => {

28+

vi.useRealTimers();

29+

});

30+
2731

afterEach(() => {

32+

vi.clearAllTimers();

2833

vi.useRealTimers();

2934

});

3035

@@ -65,6 +70,7 @@ describe("loadModelCatalogForBrowse", () => {

6570

});

6671
6772

it("returns an empty catalog when read-only catalog loading times out", async () => {

73+

vi.useFakeTimers();

6874

const onTimeout = vi.fn();

6975

const loadCatalog = vi.fn(

7076

() =>

@@ -80,9 +86,10 @@ describe("loadModelCatalogForBrowse", () => {

8086

onTimeout,

8187

});

8288
89+

await vi.advanceTimersByTimeAsync(5);

8390

await expect(resultPromise).resolves.toEqual([]);

8491

expect(onTimeout).toHaveBeenCalledExactlyOnceWith(5);

85-

await new Promise((resolve) => setTimeout(resolve, 15));

92+

await vi.advanceTimersByTimeAsync(10);

8693

});

8794
8895

it("uses the default timeout when timeoutMs is non-finite", async () => {

Original file line numberDiff line numberDiff line change

@@ -1,4 +1,4 @@

1-

import { describe, expect, it, vi } from "vitest";

1+

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

22

import { MAX_TIMER_TIMEOUT_MS } from "../shared/number-coercion.js";

33

import { createTypingCallbacks } from "./typing.js";

44

@@ -16,6 +16,7 @@ async function withFakeTimers(run: () => Promise<void>) {

1616

try {

1717

await run();

1818

} finally {

19+

vi.clearAllTimers();

1920

vi.useRealTimers();

2021

}

2122

}

@@ -56,6 +57,15 @@ function createTypingHarness(overrides: TypingCallbackOverrides = {}) {

5657

}

5758
5859

describe("createTypingCallbacks", () => {

60+

beforeEach(() => {

61+

vi.useRealTimers();

62+

});

63+
64+

afterEach(() => {

65+

vi.clearAllTimers();

66+

vi.useRealTimers();

67+

});

68+
5969

it("invokes start on reply start", async () => {

6070

const { start, onStartError, callbacks } = createTypingHarness();

6171
Original file line numberDiff line numberDiff line change

@@ -1,4 +1,4 @@

1-

import { describe, expect, it, vi } from "vitest";

1+

import { beforeEach, describe, expect, it, vi } from "vitest";

22

import type { MsgContext } from "../auto-reply/templating.js";

33

import type { OpenClawConfig } from "../config/types.js";

44

import { MIN_AUDIO_FILE_BYTES } from "./defaults.js";

@@ -78,6 +78,10 @@ async function runAudioCapabilityWithTranscriber(params: {

7878

}

7979
8080

describe("runCapability skips tiny audio files", () => {

81+

beforeEach(() => {

82+

vi.useRealTimers();

83+

});

84+
8185

it("skips audio transcription when file is smaller than MIN_AUDIO_FILE_BYTES", async () => {

8286

await withAudioFixture({

8387

filePrefix: "openclaw-tiny-audio",

@@ -172,7 +176,7 @@ describe("runCapability skips tiny audio files", () => {

172176

media,

173177

cache,

174178

transcribeAudio: async () => {

175-

throw new Error("upstream 500");

179+

throw Object.assign(new Error("HTTP 400 validation failed"), { status: 400 });

176180

},

177181

});

178182

@@ -189,7 +193,7 @@ describe("runCapability skips tiny audio files", () => {

189193

throw new Error("expected failed audio decision attempt");

190194

}

191195

expect(attempt.outcome).toBe("failed");

192-

expect(attempt.reason).toContain("upstream 500");

196+

expect(attempt.reason).toContain("HTTP 400 validation failed");

193197

},

194198

});

195199

});