test: arrange cli failure lines · openclaw/openclaw@133fe11
shakkernerd
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,11 +10,13 @@ describe("formatCliFailureLines", () => {
|
10 | 10 | env: {}, |
11 | 11 | }); |
12 | 12 | |
13 | | -expect(lines).toContain("[openclaw] Could not start the CLI."); |
14 | | -expect(lines).toContain("[openclaw] Reason: config file is invalid"); |
15 | | -expect(lines).toContain("[openclaw] Debug: set OPENCLAW_DEBUG=1 to include the stack trace."); |
16 | | -expect(lines).toContain("[openclaw] Try: openclaw doctor"); |
17 | | -expect(lines).toContain("[openclaw] Help: openclaw --help"); |
| 13 | +expect(lines).toEqual([ |
| 14 | +"[openclaw] Could not start the CLI.", |
| 15 | +"[openclaw] Reason: config file is invalid", |
| 16 | +"[openclaw] Debug: set OPENCLAW_DEBUG=1 to include the stack trace.", |
| 17 | +"[openclaw] Try: openclaw doctor", |
| 18 | +"[openclaw] Help: openclaw --help", |
| 19 | +]); |
18 | 20 | }); |
19 | 21 | |
20 | 22 | it("prints stack details when debug output is requested", () => { |
@@ -24,7 +26,12 @@ describe("formatCliFailureLines", () => {
|
24 | 26 | env: { OPENCLAW_DEBUG: "1" }, |
25 | 27 | }); |
26 | 28 | |
27 | | -expect(lines).toContain("[openclaw] Stack:"); |
| 29 | +expect(lines.slice(0, 4)).toEqual([ |
| 30 | +"[openclaw] The CLI command failed.", |
| 31 | +"[openclaw] Reason: boom", |
| 32 | +"[openclaw] Stack:", |
| 33 | +"[openclaw] Error: boom", |
| 34 | +]); |
28 | 35 | expect(lines.some((line) => line.includes("Error: boom"))).toBe(true); |
29 | 36 | }); |
30 | 37 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。