@@ -9,9 +9,9 @@ import * as path from 'path';
99import { fileURLToPath } from 'url' ;
1010import { types } from 'util' ;
1111import { codeFrameColumns } from '@babel/code-frame' ;
12- import chalk = require( 'chalk' ) ;
1312import * as fs from 'graceful-fs' ;
1413import micromatch = require( 'micromatch' ) ;
14+ import * as pico from 'picocolors' ;
1515import slash = require( 'slash' ) ;
1616import StackUtils = require( 'stack-utils' ) ;
1717import type { Config , TestResult } from '@jest/types' ;
@@ -58,8 +58,8 @@ const TITLE_INDENT = ' ';
5858const MESSAGE_INDENT = ' ' ;
5959const STACK_INDENT = ' ' ;
6060const ANCESTRY_SEPARATOR = ' \u203A ' ;
61- const TITLE_BULLET = chalk . bold ( '\u25CF ' ) ;
62- const STACK_TRACE_COLOR = chalk . dim ;
61+ const TITLE_BULLET = pico . bold ( '\u25CF ' ) ;
62+ const STACK_TRACE_COLOR = pico . dim ;
6363const STACK_PATH_REGEXP = / \s * a t .* \( ? ( : \d * : \d * | n a t i v e ) \) ? / ;
6464const EXEC_ERROR_MESSAGE = 'Test suite failed to run' ;
6565const NOT_EMPTY_LINE_REGEXP = / ^ (? ! $ ) / gm;
@@ -111,10 +111,14 @@ function checkForCommonEnvironmentErrors(error: string) {
111111
112112function warnAboutWrongTestEnvironment ( error : string , env : 'jsdom' | 'node' ) {
113113 return (
114- chalk . bold . red (
115- `The error below may be caused by using the wrong test environment, see ${ chalk . dim . underline (
116- 'https://jestjs.io/docs/configuration#testenvironment-string' ,
117- ) } .\nConsider using the "${ env } " test environment.\n\n`,
114+ pico . bold (
115+ pico . red (
116+ `The error below may be caused by using the wrong test environment, see ${ pico . dim (
117+ pico . underline (
118+ 'https://jestjs.io/docs/configuration#testenvironment-string' ,
119+ ) ,
120+ ) } .\nConsider using the "${ env } " test environment.\n\n`,
121+ ) ,
118122 ) + error
119123 ) ;
120124}
@@ -305,7 +309,7 @@ export const formatPath = (
305309 micromatch ( [ filePath ] , config . testMatch ) . length > 0 ) ||
306310 filePath === relativeTestPath
307311 ) {
308- filePath = chalk . reset . cyan ( filePath ) ;
312+ filePath = pico . reset ( pico . cyan ( filePath ) ) ;
309313 }
310314 return STACK_TRACE_COLOR ( match [ 1 ] ) + filePath + STACK_TRACE_COLOR ( match [ 3 ] ) ;
311315} ;
@@ -488,12 +492,14 @@ export const formatResultsErrors = (
488492 content ,
489493 ) ;
490494
491- const title = `${ chalk . bold . red (
492- TITLE_INDENT +
493- TITLE_BULLET +
494- result . ancestorTitles . join ( ANCESTRY_SEPARATOR ) +
495- ( result . ancestorTitles . length > 0 ? ANCESTRY_SEPARATOR : '' ) +
496- result . title ,
495+ const title = `${ pico . bold (
496+ pico . red (
497+ TITLE_INDENT +
498+ TITLE_BULLET +
499+ result . ancestorTitles . join ( ANCESTRY_SEPARATOR ) +
500+ ( result . ancestorTitles . length > 0 ? ANCESTRY_SEPARATOR : '' ) +
501+ result . title ,
502+ ) ,
497503 ) } \n`;
498504
499505 return `${ title } \n${ formatErrorStack (
0 commit comments