Skip to content

Commit fccc736

Browse files
committed
do not mock chalk
1 parent dcb1e97 commit fccc736

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

packages/bundle-size/src/reporters/cliReporter.test.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1-
// Mock "chalk" to avoid special characters in output
2-
/** @param {string} val */
3-
function colorNoop(val) {
4-
return val;
5-
}
6-
7-
jest.mock('chalk', () => ({
8-
bold: colorNoop,
9-
10-
cyan: colorNoop,
11-
green: colorNoop,
12-
red: colorNoop,
13-
}));
1+
const chalk = require('chalk');
2+
chalk.level = 0;
143

154
const cliReporter = require('./cliReporter');
165
const sampleReport = require('./sampleReport');
176

7+
function noop() {
8+
/* does nothing */
9+
}
10+
1811
describe('cliReporter', () => {
1912
it('renders a report to CLI output', async () => {
20-
const log = jest.spyOn(console, 'log').mockImplementation(() => {
21-
/* does nothing */
22-
});
13+
const log = jest.spyOn(console, 'log').mockImplementation(noop);
2314
await cliReporter(sampleReport);
2415

2516
expect(log.mock.calls[0][0]).toMatchInlineSnapshot(`

0 commit comments

Comments
 (0)