@noxx/jest-unhandled-rejection-reporter

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

Usage no npm install needed!

<script type="module">
  import noxxJestUnhandledRejectionReporter from 'https://cdn.skypack.dev/@noxx/jest-unhandled-rejection-reporter';
</script>

README

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.
  2. 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);