Last active
August 29, 2018 16:52
-
-
Save stipsan/702f4de53b62fe589a27c2a7d74faec1 to your computer and use it in GitHub Desktop.
Testing with Jest: Tip #9
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
// In Node v7 unhandled promise rejections will terminate the process | |
if (!process.env.LISTENING_TO_UNHANDLED_REJECTION) { | |
process.on('unhandledRejection', reason => { | |
throw reason | |
}) | |
// Avoid memory leak by adding too many listeners | |
process.env.LISTENING_TO_UNHANDLED_REJECTION = true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment