Installations
npm install mocha-chai-jest-snapshot
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
20.15.0
NPM Version
10.7.0
Score
75.9
Supply Chain
77.9
Quality
73.6
Maintenance
100
Vulnerability
98.2
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (86.93%)
JavaScript (13.07%)
Developer
mochiya98
Download Statistics
Total Downloads
2,284,751
Last Day
2,724
Last Week
12,865
Last Month
57,038
Last Year
741,835
GitHub Statistics
31 Stars
29 Commits
5 Forks
2 Watching
1 Branches
3 Contributors
Bundle Size
1.66 MB
Minified
439.29 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.6
Package Id
mocha-chai-jest-snapshot@1.1.6
Unpacked Size
52.39 kB
Size
13.80 kB
File Count
85
NPM Version
10.7.0
Node Version
20.15.0
Publised On
01 Sept 2024
Total Downloads
Cumulative downloads
Total Downloads
2,284,751
Last day
-1.1%
2,724
Compared to previous day
Last week
0.8%
12,865
Compared to previous week
Last month
11.9%
57,038
Compared to previous month
Last year
1.6%
741,835
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
🍵mocha-chai-jest-snapshot📷
provides snapshot testing like jest
Features
- ✅ Simple to use
- ✅ Output the same snapshot file as jest
- ✅ Output the same snapshot summary as jest
- ✅ Detect obsolete snapshots
- ✅ Support custom serializer
- ✅ Support typescript
Usage
1npm i -D mocha-chai-jest-snapshot
then add it to the test setup:
1// e.g. setup.js (mocha --file setup.js) 2const chai = require("chai"); 3const { jestSnapshotPlugin } = require("mocha-chai-jest-snapshot"); 4 5chai.use(jestSnapshotPlugin());
enjoy.
1const { expect } = require("chai"); 2it("foo", function () { 3 expect({ foo: "bar" }).toMatchSnapshot(); 4});
> chai-snapshot@1.0.0 test /mnt/x/chai-snapshot
> npx mocha --file setup.js -r ts-node/register test/**/*.ts
✓ foo
Snapshot Summary
› 1 snapshot written from 1 test suite.
1 passing (9ms)
1// Jest Snapshot v1, https://goo.gl/fbAQLP 2 3exports[`foo 1`] = ` 4Object { 5 "foo": "bar", 6} 7`;
update snapshots
1# set envoriment 2UPDATE_SNAPSHOT=1 mocha ... 3# or add command line argument 4mocha ... --update
report at the end
1npx mocha ... --reporter mocha-chai-jest-snapshot/reporters/spec
with options
jest options (setup)
1const chai = require("chai"); 2const { jestSnapshotPlugin } = require("mocha-chai-jest-snapshot"); 3 4chai.use( 5 jestSnapshotPlugin({ 6 rootDir: "../", 7 snapshotResolver: "<rootDir>/jest/snapshotResolver", 8 snapshotSerializers: ["jest-serializer-vue"], 9 }) 10);
jest options (package.json)
1{ 2 "jest": { 3 "rootDir": "../", 4 "snapshotResolver": "<rootDir>/jest/snapshotResolver", 5 "snapshotSerializers": ["jest-serializer-vue"] 6 } 7}
jest options (jest.config.js)
1module.exports = { 2 rootDir: "../", 3 snapshotResolver: "<rootDir>/jest/snapshotResolver", 4 snapshotSerializers: ["jest-serializer-vue"], 5};
custom serializer
1const chai = require("chai"); 2const { 3 jestSnapshotPlugin, 4 addSerializer, 5} = require("mocha-chai-jest-snapshot"); 6const customSerializer = require("..."); 7 8chai.use(jestSnapshotPlugin()); 9addSerializer(customSerializer);
or
1const { expect } = require("chai"); 2const customSerializer = require("..."); 3 4expect.addSnapshotSerializer(customSerializer);
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
1 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/mochiya98/mocha-chai-jest-snapshot/node.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/mochiya98/mocha-chai-jest-snapshot/node.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/mochiya98/mocha-chai-jest-snapshot/node.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/mochiya98/mocha-chai-jest-snapshot/node.yml/master?enable=pin
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 2 out of 2 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Score
3.5
/10
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