Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@jest/expect-utils
Advanced tools
This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/).
@jest/expect-utils is a utility package for Jest that provides additional matchers and utilities to enhance the testing experience. It is designed to work seamlessly with Jest's built-in expect function, allowing for more expressive and readable test assertions.
toBeArray
Checks if the value is an array.
expect([1, 2, 3]).toBeArray();
toBeObject
Checks if the value is an object.
expect({ key: 'value' }).toBeObject();
toBeEmpty
Checks if the value is empty. This can be used for arrays, objects, or strings.
expect([]).toBeEmpty();
toContainKey
Checks if the object contains the specified key.
expect({ key: 'value' }).toContainKey('key');
toContainValue
Checks if the object contains the specified value.
expect({ key: 'value' }).toContainValue('value');
jest-extended provides a large number of additional matchers for Jest. It offers a wide range of matchers similar to @jest/expect-utils, such as toBeArray, toBeObject, and toBeEmpty, but also includes many more specialized matchers.
Chai is an assertion library for Node.js and the browser that can be paired with any testing framework. It provides a rich set of matchers and is highly extensible. While it is not specifically designed for Jest, it offers similar functionalities through its expect/should interfaces.
expect-more is a set of additional matchers for Jest and Jasmine. It provides a variety of matchers for different data types and use cases, similar to @jest/expect-utils, and aims to make tests more expressive and readable.
@jest/expect-utils
This module exports some utils for the expect
function used in Jest.
You probably don't want to use this package directly. E.g. if you're writing custom matcher, you should use the injected this.equals
.
29.7.0
[create-jest]
Add npm init
/ yarn create
initialiser for Jest projects (#14465)[jest-validate]
Allow deprecation warnings for unknown options (#14499)[jest-resolver]
Replace unmatched capture groups in moduleNameMapper
with empty string instead of undefined
(#14507)[jest-snapshot]
Allow for strings as well as template literals in inline snapshots (#14465)[@jest/test-sequencer]
Calculate test runtime if perStats.duration
is missing (#14473)[@jest/create-cache-key-function]
Cache access of NODE_ENV
and BABEL_ENV
(#14455)[jest-cli]
Move internal config initialisation logic to the create-jest
package (#14465)FAQs
This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/).
The npm package @jest/expect-utils receives a total of 15,572,142 weekly downloads. As such, @jest/expect-utils popularity was classified as popular.
We found that @jest/expect-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.