@noxx/jest-unhandled-rejection-reporter

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @noxx/jest-unhandled-rejection-reporter

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

5.42 kB

Total Files

4

Last publish

Collaborators

  • noxx