What is jest-extended?
jest-extended is a set of additional matchers for Jest, a popular JavaScript testing framework. It extends Jest's built-in matchers with a variety of new ones, making it easier to write more expressive and comprehensive tests.
What are jest-extended's main functionalities?
Array Matchers
Checks if the value is an array.
expect([1, 2, 3]).toBeArray();
Object Matchers
Checks if the object contains the specified key.
expect({ a: 1 }).toContainKey('a');
String Matchers
Checks if the string starts with the given substring.
expect('hello world').toStartWith('hello');
Number Matchers
Checks if the number is within the specified range.
expect(10).toBeWithin(5, 15);
Date Matchers
Checks if the date is after the specified date.
expect(new Date('2023-01-01')).toBeAfter(new Date('2022-12-31'));
Other packages similar to jest-extended
chai
Chai is an assertion library for Node.js and the browser that can be delightfully paired with any JavaScript testing framework. It provides a variety of assertion styles (should, expect, assert) and is highly extensible.
should
Should.js is an expressive, readable, and powerful assertion library for Node.js and the browser. It extends Object.prototype to provide a more natural way to write assertions.
expect
Expect is a minimalistic assertion library for JavaScript. It is often used with Jest but can be used standalone. It provides a set of simple and intuitive matchers.
jest-extended
🃏💪
Additional Jest matchers
Problem
Jest is an amazing test runner and has some awesome assertion APIs built in by default. However, there are times when
having more specific matchers (assertions) would be far more convenient.
Solution
jest-extended aims to add additional matchers to Jest's default ones making it easy to test everything 🙌
Contributing
If you've come here to help contribute - Thanks! Take a look at the contributing docs as a way of getting started.
Installation
See the Installation Guide on Jest Extended documentation site.
Setup
See the Setup instructions on Jest Extended documentation site.
Matchers
See all available matchers and interactive repl on Jest Extended documentation site.
LICENSE
MIT