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

推荐订阅源

WordPress大学
WordPress大学
GbyAI
GbyAI
P
Proofpoint News Feed
B
Blog
MyScale Blog
MyScale Blog
V
V2EX
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
量子位
Jina AI
Jina AI
博客园 - 叶小钗
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
罗磊的独立博客
L
LangChain Blog
I
InfoQ
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
小众软件
小众软件
V
Visual Studio Blog
月光博客
月光博客
The Cloudflare Blog
雷峰网
雷峰网

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 test: merge chat context notice checks · openclaw/openclaw@5c2f4af 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
QA Matrix: exit cleanly on failure · openclaw/openclaw@42...
gumadeiras · 2026-04-17 · via Recent Commits to openclaw:main
11

import { Command } from "commander";

2-

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

2+

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

3+4+

const { runQaMatrixCommand } = vi.hoisted(() => ({

5+

runQaMatrixCommand: vi.fn(),

6+

}));

7+8+

vi.mock("./cli.runtime.js", () => ({

9+

runQaMatrixCommand,

10+

}));

11+312

import { matrixQaCliRegistration } from "./cli.js";

41314+

function mockProcessWrite(

15+

_chunk: string | Uint8Array,

16+

encodingOrCallback?: BufferEncoding | ((err?: Error | null) => void),

17+

callback?: (err?: Error | null) => void,

18+

) {

19+

if (typeof encodingOrCallback === "function") {

20+

encodingOrCallback();

21+

} else {

22+

callback?.();

23+

}

24+

return true;

25+

}

26+527

describe("matrix qa cli registration", () => {

28+

const originalDisableForceExit = process.env.OPENCLAW_QA_MATRIX_DISABLE_FORCE_EXIT;

29+

let exitSpy: ReturnType<typeof vi.spyOn>;

30+

let stderrSpy: ReturnType<typeof vi.spyOn>;

31+

let stdoutSpy: ReturnType<typeof vi.spyOn>;

32+33+

beforeEach(() => {

34+

runQaMatrixCommand.mockReset();

35+

exitSpy = vi.spyOn(process, "exit").mockImplementation((code?: string | number | null) => {

36+

throw new Error(`process.exit(${String(code)})`);

37+

});

38+

stderrSpy = vi.spyOn(process.stderr, "write").mockImplementation(mockProcessWrite);

39+

stdoutSpy = vi.spyOn(process.stdout, "write").mockImplementation(mockProcessWrite);

40+

});

41+42+

afterEach(() => {

43+

if (originalDisableForceExit === undefined) {

44+

delete process.env.OPENCLAW_QA_MATRIX_DISABLE_FORCE_EXIT;

45+

} else {

46+

process.env.OPENCLAW_QA_MATRIX_DISABLE_FORCE_EXIT = originalDisableForceExit;

47+

}

48+

exitSpy.mockRestore();

49+

stderrSpy.mockRestore();

50+

stdoutSpy.mockRestore();

51+

});

52+653

it("keeps disposable Matrix lane flags focused", () => {

754

const qa = new Command();

855

@@ -26,4 +73,27 @@ describe("matrix qa cli registration", () => {

2673

expect(optionNames).not.toContain("--credential-source");

2774

expect(optionNames).not.toContain("--credential-role");

2875

});

76+77+

it("exits with failure after Matrix artifacts are written for a failed run", async () => {

78+

const qa = new Command();

79+

matrixQaCliRegistration.register(qa);

80+

runQaMatrixCommand.mockRejectedValue(new Error("Matrix QA failed.\nreport: /tmp/report.md"));

81+82+

await expect(qa.parseAsync(["node", "openclaw", "matrix"])).rejects.toThrow("process.exit(1)");

83+84+

expect(runQaMatrixCommand).toHaveBeenCalledOnce();

85+

expect(stderrSpy).toHaveBeenCalledWith("Matrix QA failed.\nreport: /tmp/report.md\n");

86+

expect(exitSpy).toHaveBeenCalledWith(1);

87+

});

88+89+

it("can disable the forced exit for direct test harnesses", async () => {

90+

process.env.OPENCLAW_QA_MATRIX_DISABLE_FORCE_EXIT = "1";

91+

const qa = new Command();

92+

matrixQaCliRegistration.register(qa);

93+

runQaMatrixCommand.mockRejectedValue(new Error("scenario failed"));

94+95+

await expect(qa.parseAsync(["node", "openclaw", "matrix"])).rejects.toThrow("scenario failed");

96+97+

expect(exitSpy).not.toHaveBeenCalled();

98+

});

2999

});