Gathering detailed insights and metrics for jest-fs-snapshot
Gathering detailed insights and metrics for jest-fs-snapshot
npm install jest-fs-snapshot
Typescript
Module System
Node Version
NPM Version
JavaScript (99.9%)
CSS (0.1%)
Total Downloads
295,654
Last Day
253
Last Week
1,111
Last Month
7,479
Last Year
130,503
7 Stars
54 Commits
1 Forks
4 Watching
4 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
0.3.0
Package Id
jest-fs-snapshot@0.3.0
Unpacked Size
50.39 kB
Size
12.04 kB
File Count
10
NPM Version
6.14.18
Node Version
14.21.3
Publised On
11 Mar 2024
Cumulative downloads
Total Downloads
Last day
14%
253
Compared to previous day
Last week
-39%
1,111
Compared to previous week
Last month
-0.4%
7,479
Compared to previous month
Last year
7.3%
130,503
Compared to previous year
1
Jest matcher for filesystem snapshotting.
1yarn add jest-fs-snapshot
expect
1import { toMatchFilesystemSnapshot } from 'jest-fs-snapshot'; 2 3expect.extend({ toMatchFilesystemSnapshot });
1test('if build directory matches snapshot', () => { 2 const pathToBuildDir = path.resolve(process.cwd(), '.build'); 3 expect(pathToBuildDir).toMatchFilesystemSnapshot(); 4});
This will create a __fs_snapshots__
folder next to your test file with a snapshot file. On next runs it will chech if
the snapshot against the source directory and with throw on mismatches.
pathToSnapshot
(String): An optional full path to a snapshot file.options
(Object): An optional object with additional configurations.
customCompare
({check: Function, compare: Function}[]): Any custom compare function will be applied only if
the check method returns true. If multiple checks return true, the first hit will be used.1const diff = require('jest-diff'); 2 3const snapshotOptions = { 4 customCompare: [ 5 { 6 check: path => path.endsWith('package.json'), 7 compare: (actualBuffer, expectedBuffer) => { 8 const actual = JSON.parse(actualBuffer); 9 const expected = JSON.parse(expectedBuffer); 10 11 // we want to ignore the peerModules 12 delete actual.peerModules; 13 delete expected.peerModules; 14 15 return diff(actual, expected); 16 }, 17 }, 18 { 19 // test.js files will be ignored 20 check: path => path.endsWith('.test.js'), 21 compare: () => true, 22 }, 23 ], 24}; 25 26describe('...', () => { 27 it('...', () => { 28 /** 29 * ... 30 */ 31 expect(pathToBuildDir).toMatchFilesystemSnapshot(undefined, snapshotOptions); 32 }); 33});
Many files for encodings
fixture have been taken from https://github.com/mbbill/fencview.
This package is released using the MIT license. For more information see the license file.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/6 approved changesets -- 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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-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