Socket
Socket
Sign inDemoInstall

sinon-sandbox

Package Overview
Dependencies
13
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sinon-sandbox

A testing utility for framework agnostic cleanup of sinon stubs


Version published
Weekly downloads
754
decreased by-22.11%
Maintainers
4
Install size
4.98 kB
Created
Weekly downloads
 

Readme

Source

sinon-sandbox

Build Status devDependency Status devDependency Status

Sinon-sandbox is a testing utility to make it easy to restore stubs after every test, agnostic of your team's testing framework of choice.

Installation

$ npm install sinon-sandbox --save-dev

Usage

In order to restore your sinon stubs after every test, call restore in an afterEach hook.

// in a file included at the beginning of your test suite
var sinon = require('sinon-sandbox');

afterEach(function() {
  sinon.restore();
})

When writing tests, require sinon-sandbox. Since it returns an instance of a sandbox, you can treat it just like the original sinon module.

var sinon = require('sinon-sandbox');

sinon.stub().returns('a stubbed return value');

Keywords

FAQs

Last updated on 03 Sep 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc