(text: string, ansiColorCode: number)
| 19 | }); |
| 20 | |
| 21 | function output(text: string, ansiColorCode: number): string { |
| 22 | if (noColor) { |
| 23 | return text; |
| 24 | } |
| 25 | |
| 26 | // Uses ANSI escape color codes. |
| 27 | // https://en.wikipedia.org/wiki/ANSI_escape_code#Colors |
| 28 | return `\x1b[${ansiColorCode}m${text}\x1b[0m`; |
| 29 | } |
| 30 | |
| 31 | const successOutput = (text: string) => output(text, ansiColorCodes.green); |
| 32 | const warningOutput = (text: string) => output(text, ansiColorCodes.yellow); |
no outgoing calls
no test coverage detected