Jest has this feature to log the line that outputs to console
methods.
In some cases, this can become annoying:
JavaScript
x
12
12
1
console.log _modules/log.js:37
2
ℹ login.0 screenshot start
3
4
console.time _modules/init.js:409
5
login.0.screenshot: 0.33ms
6
7
console.time _modules/init.js:394
8
0 | login.0: 0.524ms
9
10
console.log _modules/log.js:37
11
ℹ login.1 screenshot start
12
Any idea how I can turn it off?
Advertisement
Answer
None of the above options worked for me.
The (current) simplest solution is this:
1: Create a file with this code (e.g. config.js)
JavaScript
1
3
1
import console from "console"
2
global.console = console
3
2: Add this line to your jest.config.js
JavaScript
1
2
1
setupFilesAfterEnv: ["./config.js"]
2
Before:
After:
Enjoi!