Skip to content

A Sinon Sandbox - allowing test framework agnostic cleanup of sinon stubs

Notifications You must be signed in to change notification settings

lencioni/sinon-sandbox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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');

About

A Sinon Sandbox - allowing test framework agnostic cleanup of sinon stubs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%