{"repo":"jest-community/snapshot-diff","free":true,"listed":false,"github":"https://github.com/jest-community/snapshot-diff","clone":"git clone https://github.com/jest-community/snapshot-diff.git","description":"Diffing snapshot utility for Jest","language":"JavaScript","stars":604,"topics":["snapshot","snapshot-testing","jest","react"],"license":"MIT","category":"ui-components","readme_excerpt":"snapshot-diff Diffing snapshot utility for Jest. Takes two values, and return their difference as a string, ready to be snapshotted with toMatchSnapshot() . Especially helpful when testing the difference between different React component states. Installation Usage With default jest matcher With custom matcher ... alternatively import it once, for instance in your tests setup file: Produced snapshot: Custom serializers By default, snapshot-diff uses a built in React serializer based on react-test-renderer . The serializers used can be set by calling setSerializers with an array of serializers to use. The order of serializers in this array may be important to you as serializers are tested in order until a match is found. setSerializers can be used to add new serializers for unsupported data types, or to set a different serializer for React components. If you want to keep the default React serializer in place, don't forget to add the default serializers to your list of serializers! Adding a new custom serializer Serializing React components with a different serializer You can replace the default React serializer by omitting it from the serializer list. The following uses enzymes to-json serializer instead: Snapshot serializer By default Jest adds extra quotes around strings so it makes diff snapshots of objects too noisy. To fix this – snapshot-diff comes with custom serializer, which you can add directly in your tests or in setupFiles script: ...or add it globally to your jest ","default_branch":null,"files":null,"tree":[],"storefront":"/r/jest-community","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jest-community/snapshot-diff/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}