Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neotan/jest-snapshot-delete-properties
Use this serializer to remove any unwanted properties from snapshot, keeping it sparkling clean ✨
https://github.com/neotan/jest-snapshot-delete-properties
Last synced: about 1 month ago
JSON representation
Use this serializer to remove any unwanted properties from snapshot, keeping it sparkling clean ✨
- Host: GitHub
- URL: https://github.com/neotan/jest-snapshot-delete-properties
- Owner: neotan
- License: mit
- Created: 2020-06-23T12:30:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T03:24:39.000Z (almost 2 years ago)
- Last Synced: 2024-12-08T05:40:49.576Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/jest-snapshot-delete-properties
- Size: 270 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Delete properties from snapshot
Use this serializer to remove any unwanted properties from snapshot, keeping it sparkling clean :sparkles:
## Install
Add the package as a dev dependency
```bash
# With npm
npm install --save-dev jest-snapshot-delete-properties# With yarn
yarn add --dev jest-snapshot-delete-properties
```[Register serializer with Jest](jest-snapshot-delete-properties) in your `setupTests.js`:
```js
import snapshotDeleteProperties from "jest-snapshot-delete-properties";expect.addSnapshotSerializer(snapshotDeleteProperties(["want-to-delete-attr1", "want-to-delete-attr2"]));
```## Vanilla JS Example
```js
test('should remove data attributes', () => {
expect(Children).toMatchSnapshot();
});
```Will output:
```js
exports[`should remove data attributes`] = `
Children
`;
```