test: keep extension tests on sdk terminal helper · openclaw/openclaw@435e1a7
steipete
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { escapeRegExp, formatEnvelopeTimestamp } from "openclaw/plugin-sdk/channel-test-helpers"; |
2 | 2 | import type { GetReplyOptions, MsgContext } from "openclaw/plugin-sdk/reply-runtime"; |
| 3 | +import { sanitizeTerminalText } from "openclaw/plugin-sdk/test-fixtures"; |
3 | 4 | import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; |
4 | | -import { stripAnsi } from "../../../src/terminal/ansi.js"; |
5 | 5 | import type { TelegramBotOptions } from "./bot.types.js"; |
6 | 6 | const harness = await import("./bot.create-telegram-bot.test-harness.js"); |
7 | 7 | const conversationRuntime = await import("openclaw/plugin-sdk/conversation-runtime"); |
@@ -248,7 +248,7 @@ describe("createTelegramBot", () => {
|
248 | 248 | errorHandler?.(new Error("handler boom")); |
249 | 249 | const errorCalls = (runtime.error as unknown as { mock: { calls: Array<[unknown]> } }).mock |
250 | 250 | .calls; |
251 | | -const errorMessage = stripAnsi(String(errorCalls[0]?.[0])); |
| 251 | +const errorMessage = sanitizeTerminalText(String(errorCalls[0]?.[0])); |
252 | 252 | expect(errorMessage.startsWith("telegram bot error: Error: handler boom")).toBe(true); |
253 | 253 | }); |
254 | 254 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,8 +2,8 @@ import { rmSync } from "node:fs";
|
2 | 2 | import fs from "node:fs/promises"; |
3 | 3 | import path from "node:path"; |
4 | 4 | import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; |
| 5 | +import { sanitizeTerminalText } from "openclaw/plugin-sdk/test-fixtures"; |
5 | 6 | import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
6 | | -import { stripAnsi } from "../../../src/terminal/ansi.js"; |
7 | 7 | import { loginWeb } from "./login.js"; |
8 | 8 | import { renderQrTerminal } from "./qr-terminal.js"; |
9 | 9 | import { createWaSocket, formatError, waitForWaConnection } from "./session.js"; |
@@ -83,7 +83,7 @@ async function flushTasks() {
|
83 | 83 | |
84 | 84 | function runtimeMessageCalls(fn: RuntimeEnv["log"]) { |
85 | 85 | const calls = (fn as unknown as { mock: { calls: Array<[unknown]> } }).mock.calls; |
86 | | -return calls.map((call) => stripAnsi(String(call[0]))); |
| 86 | +return calls.map((call) => sanitizeTerminalText(String(call[0]))); |
87 | 87 | } |
88 | 88 | |
89 | 89 | describe("loginWeb coverage", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。