Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
assertly-sinon
Advanced tools
An assertly (npm) add-on package for sinon (npm).
If you are using sinon, this module expands Assertly with new words specific to testing spy and spyCall objects created by sinon. For example:
expect(spy).to.always.return(42);
To install using npm
:
$ npm install assertly-sinon --save-dev
To install using yarn
:
$ yarn add assertly-sinon --dev
To use this add-on, pass its init()
method to Assert.register()
like so:
const Assert = require('assertly');
const AssertlySinon = require('assertly-sinon');
Assert.register(AssertlySinon.init);
By default, spys and spyCalls do not print cleanly using Node.js inspect()
method. To
improve this, you can use prettySpy
:
let spy = AssertlySinon.prettySpy(sinon.spy(object, method));
The prettySpy
method ensures that the spy and any spyCalls it returns from getCall
have a suitable inspect()
method.
The sinon
API provides many kinds of helpers for spying and mocking. The API's
provided by this add-on are designed to make BDD-style assertions for sinon's spys
and spyCalls. To make it clear which sinon types work in specific contexts, the
names used for parameters are chosen to convey this as shown below:
spy
- A spy created by sinon.spy()
spyCall
- A call to a spy returned by sinon.spy().getCall()
spyOrCall
- Either a spy
or a spyCall
See these documents for the mapping of the sinon Spy API and Spy Call API.
This add-on adds new modifiers to Assertly.
The always
modifier is used by return
and throw
assertions when operating on
a spy.
FAQs
Assertly add-on for sinon
We found that assertly-sinon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.