Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > AnsiEscape

AnsiEscape class

Operations for working with text strings that contain ANSI escape codes. The most commonly used escape codes set the foreground/background color for console output.

Signature:

export declare class AnsiEscape 

Methods

MethodModifiersDescription
formatForTests(text, options)staticReplaces ANSI escape codes with human-readable tokens. This is useful for unit tests that compare text strings in test assertions or snapshot files.
removeCodes(text)staticReturns the input text with all ANSI escape codes removed. For example, this is useful when saving colorized console output to a log file.