node package manager
Stop wasting time. Easily manage code sharing in your team. Create a free org »

jest-unexpected

Jest-Unexpected

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', () => {
        expect(null).toEqual(null);
    });
});

Compatibility

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.