Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 16 days 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 (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-27T12:23:10.000Z (over 1 year ago)
- Last Synced: 2024-10-12T09:17:50.784Z (about 1 month ago)
- Topics: jest, nodejs, tests
- Language: JavaScript
- Homepage:
- Size: 886 KB
- Stars: 22
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jest-partial
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
**Partial Matcher for Jest Expect**
![animation of jest-partial matcher](./docs/jest-partial.gif)
`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!