Home > @rushstack/node-core-library > 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