mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 14:01:24 +08:00
13 lines
449 B
TypeScript
13 lines
449 B
TypeScript
import { stripAnsi } from "../../packages/terminal-core/src/ansi.js";
|
|
|
|
// Snapshot text normalization for terminal output tests.
|
|
|
|
/** Strip ANSI, normalize line endings, ellipses, and emoji/surrogate pairs. */
|
|
export function normalizeTestText(input: string): string {
|
|
return stripAnsi(input)
|
|
.replaceAll("\r\n", "\n")
|
|
.replaceAll("…", "...")
|
|
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "?")
|
|
.replace(/[\uD800-\uDFFF]/g, "?");
|
|
}
|