Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sinon

Package Overview
Dependencies
Maintainers
4
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinon - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

pkg/sinon-2.3.2.js

7

Changelog.txt
2.3.2 / 2017-05-26
==================
* Fix failing sandbox.resetBehavior() (#1428)
* Fix restoring getters/setters/values for previously unexisting props (#1419)
* Called in order takes callCount into account. Closes #1398.
2.3.1 / 2017-05-23

@@ -3,0 +10,0 @@ ==================

20

lib/sinon/default-behaviors.js
"use strict";
var getPropertyDescriptor = require("./util/core/get-property-descriptor");
var slice = [].slice;

@@ -185,3 +183,4 @@ var useLeftMostCallback = -1;

Object.defineProperty(rootStub.rootObj, rootStub.propName, {
get: getterFunction
get: getterFunction,
configurable: true
});

@@ -196,3 +195,4 @@

Object.defineProperty(rootStub.rootObj, rootStub.propName, { // eslint-disable-line accessor-pairs
set: setterFunction
set: setterFunction,
configurable: true
});

@@ -206,14 +206,8 @@

var oldVal = getPropertyDescriptor(rootStub.rootObj, rootStub.propName).value;
Object.defineProperty(rootStub.rootObj, rootStub.propName, {
value: newVal
value: newVal,
enumerable: true,
configurable: true
});
fake.restore = function restore() {
Object.defineProperty(rootStub.rootObj, rootStub.propName, {
value: oldVal
});
};
return fake;

@@ -220,0 +214,0 @@ }

@@ -48,3 +48,8 @@ "use strict";

s.restore = function restore() {
Object.defineProperty(object, property, actualDescriptor);
if (actualDescriptor !== undefined) {
Object.defineProperty(object, property, actualDescriptor);
return;
}
delete object[property];
};

@@ -51,0 +56,0 @@

"use strict";
var every = Array.prototype.every;
module.exports = function calledInOrder(spies) {
var callMap = {};
function hasCallsLeft(spy) {
if (callMap[spy.id] === undefined) {
callMap[spy.id] = 0;
}
return callMap[spy.id] < spy.callCount;
}
if (arguments.length > 1) {

@@ -8,9 +20,16 @@ spies = arguments;

for (var i = 1, l = spies.length; i < l; i++) {
if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) {
return false;
return every.call(spies, function checkAdjacentCalls(spy, i) {
var calledBeforeNext = true;
if (i !== spies.length - 1) {
calledBeforeNext = spy.calledBefore(spies[i + 1]);
}
}
return true;
if (hasCallsLeft(spy) && calledBeforeNext) {
callMap[spy.id] += 1;
return true;
}
return false;
});
};

@@ -103,3 +103,6 @@ "use strict";

server.requestCount = 0;
server.queue = [];
server.responses = [];
this.xhr.onCreate = function (xhrObj) {

@@ -170,6 +173,2 @@ xhrObj.unsafeHeadersEnabled = function () {

if (xhr.async) {
if (!this.queue) {
this.queue = [];
}
push.call(this.queue, xhr);

@@ -204,6 +203,2 @@ } else {

if (!this.responses) {
this.responses = [];
}
if (arguments.length === 1) {

@@ -210,0 +205,0 @@ body = method;

{
"name": "sinon",
"description": "JavaScript test spies, stubs and mocks.",
"version": "2.3.1",
"version": "2.3.2",
"homepage": "http://sinonjs.org/",

@@ -6,0 +6,0 @@ "author": "Christian Johansen",

# Sinon.JS
[![npm version](https://img.shields.io/npm/v/sinon.svg?style=flat)](https://www.npmjs.com/package/sinon) [![Join the chat at https://gitter.im/sinonjs/sinon](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sinonjs/sinon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build status](https://secure.travis-ci.org/sinonjs/sinon.svg?branch=master)](http://travis-ci.org/sinonjs/sinon) [![bitHound Score](https://www.bithound.io/github/sinonjs/sinon/badges/score.svg)](https://www.bithound.io/github/sinonjs/sinon) [![Sauce Test Status](https://saucelabs.com/buildstatus/sinonjs)](https://saucelabs.com/u/sinonjs) [![Coverage Status](https://coveralls.io/repos/github/sinonjs/sinon/badge.svg)](https://coveralls.io/github/sinonjs/sinon) [![OpenCollective](https://opencollective.com/sinon/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/sinon/sponsors/badge.svg)](#sponsors)
[![OpenCollective](https://opencollective.com/sinon/sponsors/badge.svg)](#sponsors) ![npm downloads per month](https://img.shields.io/npm/dm/sinon.svg)

@@ -6,0 +6,0 @@ Standalone and test framework agnostic JavaScript test spies, stubs and mocks (pronounced "sigh-non", named after [Sinon, the warrior](https://en.wikipedia.org/wiki/Sinon)).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc