diff --git a/package.json b/package.json index b768729f..001ab6fd 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "@testing-library/jest-dom": "^5.11.6", "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0", - "chalk": "^4.1.2", + "colorette": "^2.0.20", "dotenv-cli": "^4.0.0", "jest-diff": "^29.7.0", "kcd-scripts": "^13.0.0", diff --git a/tests/failOnUnexpectedConsoleCalls.js b/tests/failOnUnexpectedConsoleCalls.js index 83e0c641..f56a306b 100644 --- a/tests/failOnUnexpectedConsoleCalls.js +++ b/tests/failOnUnexpectedConsoleCalls.js @@ -25,7 +25,7 @@ SOFTWARE. /* eslint-disable prefer-template */ /* eslint-disable func-names */ const util = require('util') -const chalk = require('chalk') +const colorette = require('colorette') const shouldIgnoreConsoleError = require('./shouldIgnoreConsoleError') const patchConsoleMethod = (methodName, unexpectedConsoleCallStacks) => { @@ -69,23 +69,23 @@ const flushUnexpectedConsoleCalls = ( if (unexpectedConsoleCallStacks.length > 0) { const messages = unexpectedConsoleCallStacks.map( ([stack, message]) => - `${chalk.red(message)}\n` + + `${colorette.red(message)}\n` + `${stack .split('\n') - .map(line => chalk.gray(line)) + .map(line => colorette.gray(line)) .join('\n')}`, ) const message = - `Expected test not to call ${chalk.bold( + `Expected test not to call ${colorette.bold( `console.${methodName}()`, )}.\n\n` + 'If the warning is expected, test for it explicitly by:\n' + - `1. Using the ${chalk.bold('.' + expectedMatcher + '()')} ` + + `1. Using the ${colorette.bold('.' + expectedMatcher + '()')} ` + `matcher, or...\n` + - `2. Mock it out using ${chalk.bold( + `2. Mock it out using ${colorette.bold( 'spyOnDev', - )}(console, '${methodName}') or ${chalk.bold( + )}(console, '${methodName}') or ${colorette.bold( 'spyOnProd', )}(console, '${methodName}'), and test that the warning occurs.`