Skip to content

Commit 820347e

Browse files
committed
chore(jest-cli): replace chalk with picocolors
1 parent b853195 commit 820347e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

packages/jest-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
"@jest/core": "workspace:*",
1919
"@jest/test-result": "workspace:*",
2020
"@jest/types": "workspace:*",
21-
"chalk": "^4.0.0",
2221
"exit": "^0.1.2",
2322
"import-local": "^3.0.2",
2423
"jest-config": "workspace:*",
2524
"jest-util": "workspace:*",
2625
"jest-validate": "workspace:*",
26+
"picocolors": "^1.0.1",
2727
"yargs": "^17.3.1"
2828
},
2929
"devDependencies": {

packages/jest-cli/src/run.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import * as path from 'path';
9-
import chalk = require('chalk');
109
import exit = require('exit');
10+
import * as pico from 'picocolors';
1111
import yargs = require('yargs');
1212
import {getVersion, runCLI} from '@jest/core';
1313
import type {AggregatedResult} from '@jest/test-result';
@@ -31,9 +31,9 @@ export async function run(
3131
clearLine(process.stderr);
3232
clearLine(process.stdout);
3333
if (error?.stack) {
34-
console.error(chalk.red(error.stack));
34+
console.error(pico.red(error.stack));
3535
} else {
36-
console.error(chalk.red(error));
36+
console.error(pico.red(error));
3737
}
3838

3939
exit(1);
@@ -117,7 +117,7 @@ const readResultsAndExit = (
117117
if (globalConfig.forceExit) {
118118
if (!globalConfig.detectOpenHandles) {
119119
console.warn(
120-
`${chalk.bold(
120+
`${pico.bold(
121121
'Force exiting Jest: ',
122122
)}Have you considered using \`--detectOpenHandles\` to detect ` +
123123
'async operations that kept running after all tests finished?',
@@ -132,12 +132,14 @@ const readResultsAndExit = (
132132
const timeout = globalConfig.openHandlesTimeout;
133133
setTimeout(() => {
134134
console.warn(
135-
chalk.yellow.bold(
136-
`Jest did not exit ${
137-
timeout === 1000 ? 'one second' : `${timeout / 1000} seconds`
138-
} after the test run has completed.\n\n'`,
135+
pico.yellow(
136+
pico.bold(
137+
`Jest did not exit ${
138+
timeout === 1000 ? 'one second' : `${timeout / 1000} seconds`
139+
} after the test run has completed.\n\n'`,
140+
),
139141
) +
140-
chalk.yellow(
142+
pico.yellow(
141143
'This usually means that there are asynchronous operations that ' +
142144
"weren't stopped in your tests. Consider running Jest with " +
143145
'`--detectOpenHandles` to troubleshoot this issue.',

0 commit comments

Comments
 (0)