-
-
Save christian-schulze/fa73a28f6a43be4d4b9371e0f17e0e12 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