node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



Build Status

This library provides a mapping layer allowing assertions using Jest expect API to execute via Unexpected and leverage it's output capabilities.

Jest-Unexpected aims to be a drop-in such that using it within an existing test suite is as simple as npm install jest-unexpected and adding a require:

const expect = require('jest-unexpected');
describe('a null value', () => {
    it('should equal null', () => {


Almost the entirety of Jest expect API in implemented with only the following missing methods which the library will highlight during execution (an exception will be thrown with a clear message indicating the method name):

  • toBeCloseTo()
  • snapshot related functionality
    • toMatchSnapshot()
    • toThrowErrorMatchingSnapshot()
    • expect.addSnapshotSerializer()
  • extension related functionality
    • expect.extend()

This library supports and is tested against node version 4 and above.