jest-snapshot-remove-properties
v1.1.4
Published
Remove properties from generated snapshots
Readme
Remove 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
# With npm
npm install --save-dev jest-snapshot-remove-properties
# With yarn
yarn add --dev jest-snapshot-remove-propertiesRegister serializer with Jest in setupTestFrameworkScript.js:
import snapshotRemoveProperties from "jest-snapshot-remove-properties";
expect.addSnapshotSerializer(snapshotRemoveProperties(["bolluck-attr"]));Vanilla JS Example
test('should remove data attributes', () => {
expect(<Component bolluck-attr="bye" id="keep-me">Children</Component>).toMatchSnapshot();
});Will output:
exports[`should remove data attributes`] = `
<div
id="keep-me"
>
Children
</div>
`;