1.0.0 • Published 5 years ago
@noxx/jest-unhandled-rejection-reporter v1.0.0
Jest Unhandled Rejection Reporter
A Jest reporter that tells you where Unhandled Rejections are emanating from.
Usage
Install the module
npm i -D @noxx/jest-unhandled-rejection-reporter
Then wire the reporter up
1. First off, you must use the --runInBand
(or -i
) flag to run your tests.
When run in parallel, the reporting of test paths is inconsistent.
1. In your jest.config.js
file you need to add these lines
// You can have other `reporters`, but this one has to be included as well.
reporters: [
'@noxx/jest-unhandled-rejection-reporter',
],
// You can call the file whatever you'd like, the important bit is that you
// have a `setupFilesAfterEnv` section and a setup file.
setupFilesAfterEnv: [
'./testSetupFile.js',
],
- At the bottom of your setup file, you'll need to add this.
process.on('unhandledRejection', require('@noxx/jest-unhandled-rejection-reporter').rejectionHandler);
1.0.0
5 years ago