Gathering detailed insights and metrics for jest-specific-snapshot
Gathering detailed insights and metrics for jest-specific-snapshot
Gathering detailed insights and metrics for jest-specific-snapshot
Gathering detailed insights and metrics for jest-specific-snapshot
Jest matcher for multiple snapshot files per test
npm install jest-specific-snapshot
Typescript
Module System
Node Version
NPM Version
59.4
Supply Chain
49.3
Quality
70.9
Maintenance
100
Vulnerability
97
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
58 Stars
115 Commits
13 Forks
1 Watchers
1 Branches
10 Contributors
Updated on Mar 25, 2025
Latest Version
8.0.0
Package Id
jest-specific-snapshot@8.0.0
Unpacked Size
9.75 kB
Size
4.18 kB
File Count
12
NPM Version
8.0.0
Node Version
16.11.0
Published on
Mar 05, 2023
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
Jest matcher for multiple snapshot files per test
You can read about the implementation here
1npm i -D jest-specific-snapshot
1const path = require('path'); 2// extend jest to have 'toMatchSpecificSnapshot' matcher 3require('jest-specific-snapshot'); 4 5test('test', () => { 6 // provides snapshot file with absolute file 7 const pathToSnap = path.resolve(process.cwd(), './example/specific/dir/my.shot'); 8 expect(100).toMatchSpecificSnapshot(pathToSnap); 9 10 //same snapshot but with relative file 11 expect(14).toMatchSpecificSnapshot('./specific/dir/my.shot'); 12 13 // another snapshot file in the same test 14 expect(19).toMatchSpecificSnapshot('./specific/another_dir/another.shot'); 15});
1// extend jest to have 'toMatchSpecificSnapshot' matcher
2const addSerializer = require('jest-specific-snapshot').addSerializer;
3
4addSerializer(/* Add custom serializer here */);
5
6test('test', () => {
7 expect(/* thing that matches the custom serializer */).toMatchSpecificSnapshot(
8 './specific/custom_serializer/test.shot'
9 );
10});
toMatchSpecificSnapshot
1const toMatchSpecificSnapshot = require('jest-specific-snapshot').toMatchSpecificSnapshot; 2 3expect.extend({ 4 toMatchDecoratedSpecificSnapshot(received, snapshotFile) { 5 // You can modify received data or create dynamic snapshot path 6 const data = doSomeThing(received); 7 return toMatchSpecificSnapshot.call(this, data, snapshotFile); 8 }, 9});
.snap
, since it conflicts with jest.--updateSnapshot
(-u
) parameter provided from CLI, there is an abuse of the SnapshotState._updateSnapshot
private field. TBD - try to use the globalConfig
to get this state..toMatchSpecificSnapshot
does ignore a custom serializers strategy. In order to support custom serializers, you should use the addSerializer
method explicitly.No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
6 existing vulnerabilities detected
Details
Reason
Found 3/13 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
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
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
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