Created
August 23, 2021 21:37
-
-
Save bvaughn/d415afbff48ea6009726bc4d6045aa45 to your computer and use it in GitHub Desktop.
Jest config to remove extra console location / formatting noise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { CustomConsole } from '@jest/console'; | |
function formatter(type, message) { | |
switch(type) { | |
case 'error': | |
return "\x1b[31m" + message + "\x1b[0m"; | |
case 'warn': | |
return "\x1b[33m" + message + "\x1b[0m"; | |
case 'log': | |
default: | |
return message; | |
} | |
} | |
global.console = new CustomConsole( | |
process.stdout, | |
process.stderr, | |
formatter, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See before:
and after: