Gathering detailed insights and metrics for snapshot-diff-serializer
Gathering detailed insights and metrics for snapshot-diff-serializer
npm install snapshot-diff-serializer
Typescript
Module System
21.4
Supply Chain
42
Quality
63.2
Maintenance
25
Vulnerability
93.4
License
JavaScript (100%)
Total Downloads
22,345
Last Day
1
Last Week
3
Last Month
10
Last Year
398
1 Stars
3 Commits
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.0
Package Id
snapshot-diff-serializer@1.0.0
Size
1.48 kB
Publised On
02 May 2018
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
3
Compared to previous week
Last month
-73%
10
Compared to previous month
Last year
-0.5%
398
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
Found 0/3 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
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
63 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
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