test: display cli output text · openclaw/openclaw@71cdb6a
shakkernerd
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -166,15 +166,15 @@ function requireWriteOptions(): { unsetPaths?: string[][]; explicitSetPaths?: st
|
166 | 166 | } |
167 | 167 | |
168 | 168 | function expectLogIncludes(text: string) { |
169 | | -expect(mockLog.mock.calls.some((call) => String(call[0]).includes(text))).toBe(true); |
| 169 | +expect(mockLog.mock.calls.map((call) => String(call[0])).join("\n")).toContain(text); |
170 | 170 | } |
171 | 171 | |
172 | 172 | function expectLogExcludes(text: string) { |
173 | | -expect(mockLog.mock.calls.some((call) => String(call[0]).includes(text))).toBe(false); |
| 173 | +expect(mockLog.mock.calls.map((call) => String(call[0])).join("\n")).not.toContain(text); |
174 | 174 | } |
175 | 175 | |
176 | 176 | function expectErrorIncludes(text: string) { |
177 | | -expect(mockError.mock.calls.some((call) => String(call[0]).includes(text))).toBe(true); |
| 177 | +expect(mockError.mock.calls.map((call) => String(call[0])).join("\n")).toContain(text); |
178 | 178 | } |
179 | 179 | |
180 | 180 | function requireRecord(value: unknown, label: string): Record<string, unknown> { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -134,11 +134,11 @@ function runtimeErrorMessages(): string[] {
|
134 | 134 | } |
135 | 135 | |
136 | 136 | function expectRuntimeErrorContaining(text: string): void { |
137 | | -expect(runtimeErrorMessages().some((message) => message.includes(text))).toBe(true); |
| 137 | +expect(runtimeErrorMessages().join("\n")).toContain(text); |
138 | 138 | } |
139 | 139 | |
140 | 140 | function expectNoRuntimeErrorContaining(text: string): void { |
141 | | -expect(runtimeErrorMessages().some((message) => message.includes(text))).toBe(false); |
| 141 | +expect(runtimeErrorMessages().join("\n")).not.toContain(text); |
142 | 142 | } |
143 | 143 | |
144 | 144 | function stdoutText(): string { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -32,6 +32,6 @@ describe("formatCliFailureLines", () => {
|
32 | 32 | "[openclaw] Stack:", |
33 | 33 | "[openclaw] Error: boom", |
34 | 34 | ]); |
35 | | -expect(lines.some((line) => line.includes("Error: boom"))).toBe(true); |
| 35 | +expect(lines.join("\n")).toContain("Error: boom"); |
36 | 36 | }); |
37 | 37 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -31,7 +31,7 @@ function requireMockCallArg(
|
31 | 31 | } |
32 | 32 | |
33 | 33 | function expectRuntimeLogIncludes(fragment: string) { |
34 | | -expect(runtimeLogs.some((log) => log.includes(fragment))).toBe(true); |
| 34 | +expect(runtimeLogs.join("\n")).toContain(fragment); |
35 | 35 | } |
36 | 36 | |
37 | 37 | describe("persistPluginInstall", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。