diff --git a/test/utils/console.js b/test/utils/console.js index fba52722d6..e3a89bc164 100644 --- a/test/utils/console.js +++ b/test/utils/console.js @@ -1,22 +1,22 @@ /* eslint-disable no-console */ -export default function mockConsole(levels = 'all') { +export default function mockLog(levels = 'all', logger = console) { if (levels === 'all') { levels = ['trace', 'debug', 'log', 'info', 'warn', 'error'] } beforeAll(() => { for (let level of levels) { - console[level] = jest.fn() + logger[level] = jest.fn() } }) beforeEach(() => { for (let level of levels) { - console[level].mockClear() + logger[level].mockClear() } }) afterAll(() => { for (let level of levels) { - console[level].mockRestore() + logger[level].mockRestore() } }) - return console + return logger }