1.0.0 • Published 4 years ago

jest-matcher-specific-error v1.0.0

Weekly downloads
610
License
MIT
Repository
github
Last release
4 years ago

jest-matcher-specific-error

Make sure your function really throws what you expect

Workaround for https://github.com/facebook/jest/issues/8140

Installation

With npm:

npm install --save-dev jest-matcher-specific-error

With yarn:

yarn add -D jest-matcher-specific-error

Setup

Same as Other jest matchers

Usage

await expect(yourPromise).rejects.toMatchError(expectedError);
await expect(yourFunction).rejects.toMatchError(expectedError);
expect(yourError).toMatchError(expectedError);

Match logic

Errors threated as equal if ALL conditions satisfied:

  • Errors are instances of same class (strict === comparison by reference)
  • Error messages are equal
  • All error public fields are deeply equal (default jest helper comparison)

Error stack traces are ignored.

1.0.0

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.4

4 years ago

0.0.1

4 years ago