https://github.com/smeijer/jest-partial
A partial matcher for Jest to simplify validation of complex structures.
https://github.com/smeijer/jest-partial
jest nodejs tests
Last synced: 3 months ago
JSON representation
A partial matcher for Jest to simplify validation of complex structures.
- Host: GitHub
- URL: https://github.com/smeijer/jest-partial
- Owner: smeijer
- License: mit
- Created: 2020-09-28T17:23:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-27T12:23:10.000Z (about 2 years ago)
- Last Synced: 2025-03-17T21:42:34.326Z (3 months ago)
- Topics: jest, nodejs, tests
- Language: JavaScript
- Homepage:
- Size: 886 KB
- Stars: 22
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jest-partial
[](#contributors-)
**Partial Matcher for Jest Expect**

`jest-partial` asserts that the `provided` object is a subset of the `expected`. We don't always want to verify the entire object that has been given. We often just
want to protect the properties that we need, and ignore everything else.## Installation
With npm:
```sh
npm install --save-dev jest-partial
```With yarn:
```sh
yarn add -D jest-partial
```## Setup
### Jest >v24
Add `jest-partial` to your Jest `setupFilesAfterEnv` configuration. [See for help](https://jestjs.io/docs/en/configuration.html#setupfilesafterenv-array)
```json
"jest": {
"setupFilesAfterEnv": ["jest-partial"]
}
```### Jest
Stephan Meijer
🤔 💻 🚇 🚧
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!