/
githubmirror
/
lerna
Обзор
Документация
Войти
/
githubmirror
/
lerna
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
libs/child-process/src/colorize.ts
25 строк
562 B
James Henry
chore(repo): migrate from jest to vitest (#4389)
13 июл 2026, 20:06
Не верифицирован
13 июл 2026, 20:06
1f7e109
Код
Авторство
О чём код?
import { styleText } from "node:util"; export type StyleFormat = Parameters<typeof styleText>[0]; let enabled = true; /** * Apply terminal color/style formatting to text. * Wraps util.styleText with a programmatic kill switch for tests, * since test runner workers set FORCE_COLOR=1 which overrides NO_COLOR. */ export function colorize(format: StyleFormat, text: string): string { if (!enabled) { return text; } return styleText(format, text); } colorize.disable = () => { enabled = false; }; colorize.enable = () => { enabled = true; };