Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/terminal > AnsiEscape > formatForTests

AnsiEscape.formatForTests() method

Replaces ANSI escape codes with human-readable tokens. This is useful for unit tests that compare text strings in test assertions or snapshot files.

Signature:

static formatForTests(text: string, options?: IAnsiEscapeConvertForTestsOptions): string;

Parameters

Parameter

Type

Description

text

string

options

IAnsiEscapeConvertForTestsOptions

(Optional)

Returns:

string