包详细信息

sinon-sandbox

wealthfront917Apache-2.02.0.6

A testing utility for framework agnostic cleanup of sinon stubs

sinon, sandbox

自述文件

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

更新日志

2.0.6

  • Internal: Upgrade eslint-utils dependency.

2.0.5

  • Internal: Remove wealthfront-javascript dependency.

2.0.3

  • Internal: Upgrade lodash dependency.

2.0.2

  • Internal: Upgrade mocha, chai, and wealthfront-javascript dependencies

2.0.1

  • Internal: Upgrade wealthfront-javascript build dependency

2.0.0

  • Support for Sinon 5+

1.0.1

  • Internal: Using Travis

1.0.0

  • Initial Release