sinon-sandbox
A testing utility for framework agnostic cleanup of sinon stubs
Last updated a year ago by johncarlo .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install sinon-sandbox 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.0.6                                ...           latest (a year ago)

6 Versions

  • 2.0.6                                ...           a year ago
  • 2.0.5                                ...           a year ago
  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           2 years ago
  • 1.0.2                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 7
Last Month 12
Dependencies (0)
None
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |