Delete properties from snapshot
Use this serializer to remove any unwanted properties from snapshot, keeping it sparkling clean ✨
Install
Add the package as a dev dependency
# With npm npm install --save-dev jest-snapshot-delete-properties # With yarn yarn add --dev jest-snapshot-delete-properties
Register serializer with Jest in your setupTests.js
:
; expect;
Vanilla JS Example
;
Will output:
exports`should remove data attributes` = `<div id="keep-me"> Children</div>`;