JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32441
  • Score
    100M100P100Q149951F
  • License MIT

Write Beautiful Specs with Custom Matchers

Package Exports

  • expect-more-jest

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (expect-more-jest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

expect-more-jest

Write Beautiful Specs with Custom Matchers for Jest

NPM version NPM downloads Dependency Status Build Status Code Climate Gitter Chat for expect-more Donate via PayPal Donate via Gratipay Analytics Follow JamieMason on GitHub Follow fold_left on Twitter

Screenshot of expect-more-jest in VS Code

What

A huge library of test matchers a range of common use-cases.

Why

Custom Matchers make tests easier to read and produce relevant and useful messages when they fail.

How

By avoiding vague messages such as "expected false to be true" in favour of useful cues such as "expected 3 to be even number" and avoiding implementation noise such as expect(paws.length % 2 === 0).toEqual(true) in favour of simply stating that you expect(paws.length).toBeEvenNumber().

Status

expect-more-jest is a recent TypeScript rewrite of jasmine-expect NPM downloads for jasmine-expect. Most effort is required on documentation and any contributions in this area would be really welcome.

Installation

npm install expect-more-jest --save-dev

Setup

The simplest way to integrate is to include the following in your jest.config.js:

module.exports = {
  // ...
  setupTestFrameworkScriptFile: require.resolve('expect-more-jest')
  // ...
};

If your project requires more setup than just these matchers, point your setupTestFrameworkScriptFile entry to a JavaScript file somewhere in your project like so:

module.exports = {
  // ...
  setupTestFrameworkScriptFile: '<rootDir>/test/setup-test-framework-script-file.js'
  // ...
};

In that file (in this example we have chosen ./test/setup-test-framework-script-file.js) include:

import 'expect-more-jest';
// ...then your other setup code

or:

require('expect-more-jest');
// ...then your other setup code

API

Asymmetric Matchers

Matchers