@noxx/jest-unhandled-rejection-reporter
v1.0.0
Published
A Jest reporter that tells you where Unhandled Rejections are emanating from
Downloads
2
Readme
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
- 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. - 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);