1.0.0 • Published 5 years ago

@noxx/jest-unhandled-rejection-reporter v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Jest Unhandled Rejection Reporter

Build Status npm version

A Jest reporter that tells you where Unhandled Rejections are emanating from.

example of reporter output


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',
],
  1. At the bottom of your setup file, you'll need to add this.
process.on('unhandledRejection', require('@noxx/jest-unhandled-rejection-reporter').rejectionHandler);