Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-matcher-specific-error

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-matcher-specific-error

Make sure your function really throws what you expect

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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.

FAQs

Package last updated on 09 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc