Last active
August 10, 2018 17:43
-
-
Save stipsan/7e86d969e0fdc094fef41a2c3b45397a to your computer and use it in GitHub Desktop.
Testing with Jest: Tip #8
This file contains hidden or 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
{ | |
"jest": { | |
"setupFiles": [ | |
"<rootDir>/test-setup.js" | |
] | |
} | |
} |
This file contains hidden or 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
// eslint-disable-next-line no-console | |
const error = console.error | |
// eslint-disable-next-line no-console | |
console.error = (warning, ...args) => { | |
if (/(Invalid prop|Failed prop type)/gi.test(warning)) { | |
throw new Error(warning) | |
} | |
error.apply(console, [warning, ...args]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment