Gathering detailed insights and metrics for snapshot-diff-serializer
Gathering detailed insights and metrics for snapshot-diff-serializer
Gathering detailed insights and metrics for snapshot-diff-serializer
Gathering detailed insights and metrics for snapshot-diff-serializer
A serializer that lets you generate snapshot diffs between two values
npm install snapshot-diff-serializer
Typescript
Module System
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
3 Commits
1 Watchers
1 Branches
1 Contributors
Updated on May 16, 2018
Latest Version
1.0.0
Package Id
snapshot-diff-serializer@1.0.0
Size
1.48 kB
Published on
May 02, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
1
3
This is a simple diffing utility for Jest that is inspired by snapshot-diff. The key difference here is that snapshot-diff-serializer
only comes as a serializer and is agnostic of other serializers, meaning you get nice diffs with Enzyme, or other serializers applied (something that snapshot-diff
doesn't do).
# npm
npm install --dev snapshot-diff-serializer
# yarn
yarn add -D snapshot-diff-serializer
Add the serializer to your snapshotSerializers
array in your Jest config (example using package.json)
1{ 2 "jest": { 3 "snapshotSerializers": [ 4 "jest-glamor-react", 5 "enzyme-to-json/serializer", 6 "<rootDir>/snapshot-diff-serializer" 7 ], 8 }, 9}
Here is an example of using this serializer:
1const Component = ({ foo, bar }) => ( 2 <div> 3 {foo != null && foo} 4 {bar != null && bar} 5 </div> 6)
1import { shallow } from 'enzyme' 2// Test 3describe('Component', () => { 4 test('variants', () => { 5 expect({ 6 diffA: shallow(<Component foo={3} />), 7 diffB: shallow(<Component bar={5} />), 8 }).toMatchSnapshot() 9 }) 10})
The produced snapshot would look like this:
exports[`Component variants 1`] = `
- Diff A
+ Diff B
<div>
- 3
+ 5
</div>
`;
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no SAST tool detected
Details
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
64 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More