Gathering detailed insights and metrics for hamjest-sinon
Gathering detailed insights and metrics for hamjest-sinon
Gathering detailed insights and metrics for hamjest-sinon
Gathering detailed insights and metrics for hamjest-sinon
npm install hamjest-sinon
Typescript
Module System
Min. Node Version
Node Version
NPM Version
71.8
Supply Chain
98.9
Quality
75.5
Maintenance
100
Vulnerability
98.9
License
JavaScript (97.21%)
TypeScript (2.79%)
Total Downloads
19,733
Last Day
5
Last Week
41
Last Month
344
Last Year
1,083
MIT License
3 Stars
76 Commits
3 Watchers
5 Branches
1 Contributors
Updated on Jul 14, 2023
Minified
Minified + Gzipped
Latest Version
2.0.3
Package Id
hamjest-sinon@2.0.3
Unpacked Size
34.30 kB
Size
7.67 kB
File Count
23
NPM Version
8.15.0
Node Version
18.7.0
Published on
Sep 16, 2023
Cumulative downloads
Total Downloads
Last Day
0%
5
Compared to previous day
Last Week
-30.5%
41
Compared to previous week
Last Month
295.4%
344
Compared to previous month
Last Year
-53.5%
1,083
Compared to previous year
1npm install hamjest sinon hamjest-sinon --save-dev
Add the sinon matcher to hamjest by require the module
1const __ = require('hamjest'); 2// auto extend hamjest 3require('hamjest-sinon'); 4// or 5require('hamjest-sinon').extendHamjest(__); 6 7// use matcher from hamjest 8__.assertThat(stub, __.wasCalled());
Mock matchers is an extension to Sinon matchers which supports the Jest Mock as well.
Sinon matchers are used for testing function calls. Replace the function with a sinon stub or spy and assert the call of the function by your code with these matchers.
Assert that a sinon stub was called:
1 __.assertThat(stub, __.wasCalled());
Assert that a sinon stub was called a specific amount of times:
1 __.assertThat(stub, __.wasCalled(2));
Assert that a sinon stub was called a variable amount of times:
1 __.assertThat(stub, __.wasCalled(__.greaterThan(1)));
Assert that a sinon stub was not called:
1 __.assertThat(stub, __.wasCalled(0));
2 // or
3 __.assertThat(stub, __.not(__.wasCalled()));
Assert that a sinon stub was called with empty args:
1 __.assertThat(stub, __.wasCalledWith());
2 // or
3 __.assertThat(stub, __.wasCalledWith(__.undefined()));
Assert that a sinon stub was called with a specific arg:
1 __.assertThat(stub, __.wasCalledWith('something'));
Assert that a sinon stub was called a variable arg:
1 __.assertThat(stub, __.wasCalledWith(__.containsString('something')));
Assert that a sinon stub was not called with empty arg:
1 __.assertThat(stub, __.not(__.wasCalledWith()));
2 // or
3 __.assertThat(stub, __.not(__.wasCalledWith(__.undefined())));
Assert that a sinon stub was called in order with specific args:
1 __.assertThat(stub, __.wasCalledInOrder('first call with args', 'second call with args'));
Assert that a sinon stub was called in order with variable args:
1 __.assertThat(stub, __.wasCalledInOrder(__.containsString('first'), __.containsString('second')));
Assert that a sinon stub was not called:
1 __.assertThat(stub, __.wasCalledInOrder());
2 // or
3 __.assertThat(stub, __.wasCalled(0));
Licensed under the MIT License (enclosed).
This library is inspired by and based on the work of Hamjest.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
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
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
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