You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

sinon

Package Overview
Dependencies
Maintainers
4
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 15.0.0 to 16.1.0

lib/sinon/create-stub-instance.js

18

CONTRIBUTING.md

@@ -107,2 +107,18 @@ # Contributing to Sinon.JS

### Tooling
To transparently handle all issues with different tool versions we recommend using [_ASDF: The Multiple Runtime Manager_][asdf]. You would then need the Ruby and Node plugins.
<details>
```
asdf plugin add ruby
asdf plugin add nodejs
asdf install
```
</details>
[asdf]: https://asdf-vm.com
### Run the tests

@@ -137,2 +153,2 @@

$ node build.js
$ node build.cjs

22

lib/sinon.js
"use strict";
var behavior = require("./sinon/behavior");
var createSandbox = require("./sinon/create-sandbox");
var extend = require("./sinon/util/core/extend");
var fakeTimers = require("./sinon/util/fake-timers");
var nise = require("nise");
var Sandbox = require("./sinon/sandbox");
var stub = require("./sinon/stub");
var promise = require("./sinon/promise");
const behavior = require("./sinon/behavior");
const createSandbox = require("./sinon/create-sandbox");
const extend = require("./sinon/util/core/extend");
const fakeTimers = require("./sinon/util/fake-timers");
const nise = require("nise");
const Sandbox = require("./sinon/sandbox");
const stub = require("./sinon/stub");
const promise = require("./sinon/promise");
var apiMethods = {
const apiMethods = {
createSandbox: createSandbox,

@@ -44,6 +44,6 @@ assert: require("./sinon/assert"),

var sandbox = new Sandbox();
const sandbox = new Sandbox();
var api = extend(sandbox, apiMethods);
const api = extend(sandbox, apiMethods);
module.exports = api;
"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var calledInOrder = require("@sinonjs/commons").calledInOrder;
var createMatcher = require("@sinonjs/samsam").createMatcher;
var orderByFirstCall = require("@sinonjs/commons").orderByFirstCall;
var timesInWords = require("./util/core/times-in-words");
var inspect = require("util").inspect;
var stringSlice = require("@sinonjs/commons").prototypes.string.slice;
var globalObject = require("@sinonjs/commons").global;
const arrayProto = require("@sinonjs/commons").prototypes.array;
const calledInOrder = require("@sinonjs/commons").calledInOrder;
const createMatcher = require("@sinonjs/samsam").createMatcher;
const orderByFirstCall = require("@sinonjs/commons").orderByFirstCall;
const timesInWords = require("./util/core/times-in-words");
const inspect = require("util").inspect;
const stringSlice = require("@sinonjs/commons").prototypes.string.slice;
const globalObject = require("@sinonjs/commons").global;
var arraySlice = arrayProto.slice;
var concat = arrayProto.concat;
var forEach = arrayProto.forEach;
var join = arrayProto.join;
var splice = arrayProto.splice;
const arraySlice = arrayProto.slice;
const concat = arrayProto.concat;
const forEach = arrayProto.forEach;
const join = arrayProto.join;
const splice = arrayProto.splice;
function createAssertObject() {
var assert;
const assert = {
failException: "AssertError",
fail: function fail(message) {
const error = new Error(message);
error.name = this.failException || assert.failException;
throw error;
},
pass: function pass() {
return;
},
callOrder: function assertCallOrder() {
verifyIsStub.apply(null, arguments);
let expected = "";
let actual = "";
if (!calledInOrder(arguments)) {
try {
expected = join(arguments, ", ");
const calls = arraySlice(arguments);
let i = calls.length;
while (i) {
if (!calls[--i].called) {
splice(calls, i, 1);
}
}
actual = join(orderByFirstCall(calls), ", ");
} catch (e) {
// If this fails, we'll just fall back to the blank string
}
failAssertion(
this,
`expected ${expected} to be called in order but were called as ${actual}`
);
} else {
assert.pass("callOrder");
}
},
callCount: function assertCallCount(method, count) {
verifyIsStub(method);
let msg;
if (typeof count !== "number") {
msg =
`expected ${inspect(count)} to be a number ` +
`but was of type ${typeof count}`;
failAssertion(this, msg);
} else if (method.callCount !== count) {
msg =
`expected %n to be called ${timesInWords(count)} ` +
`but was called %c%C`;
failAssertion(this, method.printf(msg));
} else {
assert.pass("callCount");
}
},
expose: function expose(target, options) {
if (!target) {
throw new TypeError("target is null or undefined");
}
const o = options || {};
const prefix =
(typeof o.prefix === "undefined" && "assert") || o.prefix;
const includeFail =
typeof o.includeFail === "undefined" || Boolean(o.includeFail);
const instance = this;
forEach(Object.keys(instance), function (method) {
if (
method !== "expose" &&
(includeFail || !/^(fail)/.test(method))
) {
target[exposedName(prefix, method)] = instance[method];
}
});
return target;
},
match: function match(actual, expectation) {
const matcher = createMatcher(expectation);
if (matcher.test(actual)) {
assert.pass("match");
} else {
const formatted = [
"expected value to match",
` expected = ${inspect(expectation)}`,
` actual = ${inspect(actual)}`,
];
failAssertion(this, join(formatted, "\n"));
}
},
};
function verifyIsStub() {
var args = arraySlice(arguments);
const args = arraySlice(arguments);

@@ -64,4 +164,4 @@ forEach(args, function (method) {

function failAssertion(object, msg) {
var obj = object || globalObject;
var failMethod = obj.fail || assert.fail;
const obj = object || globalObject;
const failMethod = obj.fail || assert.fail;
failMethod.call(obj, msg);

@@ -71,4 +171,4 @@ }

function mirrorPropAsAssertion(name, method, message) {
var msg = message;
var meth = method;
let msg = message;
let meth = method;
if (arguments.length === 2) {

@@ -82,4 +182,4 @@ msg = method;

var args = arraySlice(arguments, 1);
var failed = false;
const args = arraySlice(arguments, 1);
let failed = false;

@@ -119,104 +219,2 @@ verifyIsValidAssertion(name, args);

assert = {
failException: "AssertError",
fail: function fail(message) {
var error = new Error(message);
error.name = this.failException || assert.failException;
throw error;
},
pass: function pass() {
return;
},
callOrder: function assertCallOrder() {
verifyIsStub.apply(null, arguments);
var expected = "";
var actual = "";
if (!calledInOrder(arguments)) {
try {
expected = join(arguments, ", ");
var calls = arraySlice(arguments);
var i = calls.length;
while (i) {
if (!calls[--i].called) {
splice(calls, i, 1);
}
}
actual = join(orderByFirstCall(calls), ", ");
} catch (e) {
// If this fails, we'll just fall back to the blank string
}
failAssertion(
this,
`expected ${expected} to be called in order but were called as ${actual}`
);
} else {
assert.pass("callOrder");
}
},
callCount: function assertCallCount(method, count) {
verifyIsStub(method);
var msg;
if (typeof count !== "number") {
msg =
`expected ${inspect(count)} to be a number ` +
`but was of type ${typeof count}`;
failAssertion(this, msg);
} else if (method.callCount !== count) {
msg =
`expected %n to be called ${timesInWords(count)} ` +
`but was called %c%C`;
failAssertion(this, method.printf(msg));
} else {
assert.pass("callCount");
}
},
expose: function expose(target, options) {
if (!target) {
throw new TypeError("target is null or undefined");
}
var o = options || {};
var prefix =
(typeof o.prefix === "undefined" && "assert") || o.prefix;
var includeFail =
typeof o.includeFail === "undefined" || Boolean(o.includeFail);
var instance = this;
forEach(Object.keys(instance), function (method) {
if (
method !== "expose" &&
(includeFail || !/^(fail)/.test(method))
) {
target[exposedName(prefix, method)] = instance[method];
}
});
return target;
},
match: function match(actual, expectation) {
var matcher = createMatcher(expectation);
if (matcher.test(actual)) {
assert.pass("match");
} else {
var formatted = [
"expected value to match",
` expected = ${inspect(expectation)}`,
` actual = ${inspect(actual)}`,
];
failAssertion(this, join(formatted, "\n"));
}
},
};
mirrorPropAsAssertion(

@@ -223,0 +221,0 @@ "called",

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var extend = require("./util/core/extend");
var functionName = require("@sinonjs/commons").functionName;
var nextTick = require("./util/core/next-tick");
var valueToString = require("@sinonjs/commons").valueToString;
var exportAsyncBehaviors = require("./util/core/export-async-behaviors");
const arrayProto = require("@sinonjs/commons").prototypes.array;
const extend = require("./util/core/extend");
const functionName = require("@sinonjs/commons").functionName;
const nextTick = require("./util/core/next-tick");
const valueToString = require("@sinonjs/commons").valueToString;
const exportAsyncBehaviors = require("./util/core/export-async-behaviors");
var concat = arrayProto.concat;
var join = arrayProto.join;
var reverse = arrayProto.reverse;
var slice = arrayProto.slice;
const concat = arrayProto.concat;
const join = arrayProto.join;
const reverse = arrayProto.reverse;
const slice = arrayProto.slice;
var useLeftMostCallback = -1;
var useRightMostCallback = -2;
const useLeftMostCallback = -1;
const useRightMostCallback = -2;
function getCallback(behavior, args) {
var callArgAt = behavior.callArgAt;
const callArgAt = behavior.callArgAt;

@@ -25,3 +25,3 @@ if (callArgAt >= 0) {

var argumentList;
let argumentList;

@@ -36,5 +36,5 @@ if (callArgAt === useLeftMostCallback) {

var callArgProp = behavior.callArgProp;
const callArgProp = behavior.callArgProp;
for (var i = 0, l = argumentList.length; i < l; ++i) {
for (let i = 0, l = argumentList.length; i < l; ++i) {
if (!callArgProp && typeof argumentList[i] === "function") {

@@ -58,3 +58,3 @@ return argumentList[i];

if (behavior.callArgAt < 0) {
var msg;
let msg;

@@ -86,4 +86,4 @@ if (behavior.callArgProp) {

// callsArg => callArgAt
var property = name.replace(/sArg/, "ArgAt");
var index = behavior[property];
const property = name.replace(/sArg/, "ArgAt");
const index = behavior[property];

@@ -102,3 +102,3 @@ if (index >= args.length) {

ensureArgs("callsArg", behavior, args);
var func = getCallback(behavior, args);
const func = getCallback(behavior, args);

@@ -127,5 +127,5 @@ if (typeof func !== "function") {

var proto = {
const proto = {
create: function create(stub) {
var behavior = extend({}, proto);
const behavior = extend({}, proto);
delete behavior.create;

@@ -166,3 +166,3 @@ delete behavior.addBehavior;

*/
var returnValue = callCallback(this, args);
const returnValue = callCallback(this, args);

@@ -197,3 +197,3 @@ if (this.exception) {

} else if (this.callsThrough) {
var wrappedMethod = this.effectiveWrappedMethod();
const wrappedMethod = this.effectiveWrappedMethod();

@@ -203,7 +203,7 @@ return wrappedMethod.apply(context, args);

// Get the original method (assumed to be a constructor in this case)
var WrappedClass = this.effectiveWrappedMethod();
const WrappedClass = this.effectiveWrappedMethod();
// Turn the arguments object into a normal array
var argsArray = slice(args);
const argsArray = slice(args);
// Call the constructor
var F = WrappedClass.bind.apply(
const F = WrappedClass.bind.apply(
WrappedClass,

@@ -223,3 +223,3 @@ concat([null], argsArray)

effectiveWrappedMethod: function effectiveWrappedMethod() {
for (var stubb = this.stub; stubb; stubb = stubb.parent) {
for (let stubb = this.stub; stubb; stubb = stubb.parent) {
if (stubb.wrappedMethod) {

@@ -280,4 +280,4 @@ return stubb.wrappedMethod;

var asyncBehaviors = exportAsyncBehaviors(proto);
const asyncBehaviors = exportAsyncBehaviors(proto);
module.exports = extend.nonEnum({}, proto, asyncBehaviors);
"use strict";
var walk = require("./util/core/walk");
var getPropertyDescriptor = require("./util/core/get-property-descriptor");
var hasOwnProperty =
const walk = require("./util/core/walk");
const getPropertyDescriptor = require("./util/core/get-property-descriptor");
const hasOwnProperty =
require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var push = require("@sinonjs/commons").prototypes.array.push;
const push = require("@sinonjs/commons").prototypes.array.push;

@@ -20,3 +20,3 @@ function collectMethod(methods, object, prop, propOwner) {

function collectOwnMethods(object) {
var methods = [];
const methods = [];

@@ -23,0 +23,0 @@ walk(object, collectMethod.bind(null, methods, object));

"use strict";
var supportsColor = require("supports-color");
const supportsColor = require("supports-color");

@@ -5,0 +5,0 @@ function colorize(str, color) {

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var Sandbox = require("./sandbox");
const arrayProto = require("@sinonjs/commons").prototypes.array;
const Sandbox = require("./sandbox");
var forEach = arrayProto.forEach;
var push = arrayProto.push;
const forEach = arrayProto.forEach;
const push = arrayProto.push;
function prepareSandboxFromConfig(config) {
var sandbox = new Sandbox();
const sandbox = new Sandbox();

@@ -49,11 +49,11 @@ if (config.useFakeServer) {

var configuredSandbox = prepareSandboxFromConfig(config);
const configuredSandbox = prepareSandboxFromConfig(config);
configuredSandbox.args = configuredSandbox.args || [];
configuredSandbox.injectedKeys = [];
configuredSandbox.injectInto = config.injectInto;
var exposed = configuredSandbox.inject({});
const exposed = configuredSandbox.inject({});
if (config.properties) {
forEach(config.properties, function (prop) {
var value =
const value =
exposed[prop] || (prop === "sandbox" && configuredSandbox);

@@ -60,0 +60,0 @@ exposeValue(configuredSandbox, config, prop, value);

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var isPropertyConfigurable = require("./util/core/is-property-configurable");
var exportAsyncBehaviors = require("./util/core/export-async-behaviors");
var extend = require("./util/core/extend");
const arrayProto = require("@sinonjs/commons").prototypes.array;
const isPropertyConfigurable = require("./util/core/is-property-configurable");
const exportAsyncBehaviors = require("./util/core/export-async-behaviors");
const extend = require("./util/core/extend");
var slice = arrayProto.slice;
const slice = arrayProto.slice;
var useLeftMostCallback = -1;
var useRightMostCallback = -2;
const useLeftMostCallback = -1;
const useRightMostCallback = -2;

@@ -18,3 +18,5 @@ function throwsException(fake, error, message) {

fake.exceptionCreator = function () {
var newException = new Error(message || "");
const newException = new Error(
message || `Sinon-provided ${error}`
);
newException.name = error;

@@ -32,5 +34,7 @@ return newException;

var defaultBehaviors = {
const defaultBehaviors = {
callsFake: function callsFake(fake, fn) {
fake.fakeFn = fn;
fake.exception = undefined;
fake.exceptionCreator = undefined;
},

@@ -195,3 +199,3 @@

rejects: function rejects(fake, error, message) {
var reason;
let reason;
if (typeof error === "string") {

@@ -237,3 +241,3 @@ reason = new Error(message || "");

get: function get(fake, getterFunction) {
var rootStub = fake.stub || fake;
const rootStub = fake.stub || fake;

@@ -252,3 +256,3 @@ Object.defineProperty(rootStub.rootObj, rootStub.propName, {

set: function set(fake, setterFunction) {
var rootStub = fake.stub || fake;
const rootStub = fake.stub || fake;

@@ -272,3 +276,3 @@ Object.defineProperty(

value: function value(fake, newVal) {
var rootStub = fake.stub || fake;
const rootStub = fake.stub || fake;

@@ -288,4 +292,4 @@ Object.defineProperty(rootStub.rootObj, rootStub.propName, {

var asyncBehaviors = exportAsyncBehaviors(defaultBehaviors);
const asyncBehaviors = exportAsyncBehaviors(defaultBehaviors);
module.exports = extend({}, defaultBehaviors, asyncBehaviors);
"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var createProxy = require("./proxy");
var nextTick = require("./util/core/next-tick");
const arrayProto = require("@sinonjs/commons").prototypes.array;
const createProxy = require("./proxy");
const nextTick = require("./util/core/next-tick");
var slice = arrayProto.slice;
var promiseLib = Promise;
const slice = arrayProto.slice;
let promiseLib = Promise;

@@ -190,7 +190,7 @@ module.exports = fake;

fake.yields = function yields() {
var values = slice(arguments);
const values = slice(arguments);
// eslint-disable-next-line jsdoc/require-jsdoc
function f() {
var callback = arguments[arguments.length - 1];
const callback = arguments[arguments.length - 1];
if (typeof callback !== "function") {

@@ -227,7 +227,7 @@ throw new TypeError("Expected last argument to be a function");

fake.yieldsAsync = function yieldsAsync() {
var values = slice(arguments);
const values = slice(arguments);
// eslint-disable-next-line jsdoc/require-jsdoc
function f() {
var callback = arguments[arguments.length - 1];
const callback = arguments[arguments.length - 1];
if (typeof callback !== "function") {

@@ -244,3 +244,3 @@ throw new TypeError("Expected last argument to be a function");

var uuid = 0;
let uuid = 0;
/**

@@ -254,5 +254,4 @@ * Creates a proxy (sinon concept) from the passed function.

function wrapFunc(f) {
var proxy;
var fakeInstance = function () {
var firstArg, lastArg;
const fakeInstance = function () {
let firstArg, lastArg;

@@ -264,5 +263,6 @@ if (arguments.length > 0) {

var callback =
const callback =
lastArg && typeof lastArg === "function" ? lastArg : undefined;
/* eslint-disable no-use-before-define */
proxy.firstArg = firstArg;

@@ -274,3 +274,3 @@ proxy.lastArg = lastArg;

};
proxy = createProxy(fakeInstance, f || fakeInstance);
const proxy = createProxy(fakeInstance, f || fakeInstance);

@@ -277,0 +277,0 @@ proxy.displayName = "fake";

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var proxyInvoke = require("./proxy-invoke");
var proxyCallToString = require("./proxy-call").toString;
var timesInWords = require("./util/core/times-in-words");
var extend = require("./util/core/extend");
var match = require("@sinonjs/samsam").createMatcher;
var stub = require("./stub");
var assert = require("./assert");
var deepEqual = require("@sinonjs/samsam").deepEqual;
var inspect = require("util").inspect;
var valueToString = require("@sinonjs/commons").valueToString;
const arrayProto = require("@sinonjs/commons").prototypes.array;
const proxyInvoke = require("./proxy-invoke");
const proxyCallToString = require("./proxy-call").toString;
const timesInWords = require("./util/core/times-in-words");
const extend = require("./util/core/extend");
const match = require("@sinonjs/samsam").createMatcher;
const stub = require("./stub");
const assert = require("./assert");
const deepEqual = require("@sinonjs/samsam").deepEqual;
const inspect = require("util").inspect;
const valueToString = require("@sinonjs/commons").valueToString;
var every = arrayProto.every;
var forEach = arrayProto.forEach;
var push = arrayProto.push;
var slice = arrayProto.slice;
const every = arrayProto.every;
const forEach = arrayProto.forEach;
const push = arrayProto.push;
const slice = arrayProto.slice;

@@ -29,7 +29,7 @@ function callCountInWords(callCount) {

function expectedCallCountInWords(expectation) {
var min = expectation.minCalls;
var max = expectation.maxCalls;
const min = expectation.minCalls;
const max = expectation.maxCalls;
if (typeof min === "number" && typeof max === "number") {
var str = timesInWords(min);
let str = timesInWords(min);

@@ -51,3 +51,3 @@ if (min !== max) {

function receivedMinCalls(expectation) {
var hasMinLimit = typeof expectation.minCalls === "number";
const hasMinLimit = typeof expectation.minCalls === "number";
return !hasMinLimit || expectation.callCount >= expectation.minCalls;

@@ -65,3 +65,3 @@ }

function verifyMatcher(possibleMatcher, arg) {
var isMatcher = match.isMatcher(possibleMatcher);
const isMatcher = match.isMatcher(possibleMatcher);

@@ -71,3 +71,3 @@ return (isMatcher && possibleMatcher.test(arg)) || true;

var mockExpectation = {
const mockExpectation = {
minCalls: 1,

@@ -77,3 +77,3 @@ maxCalls: 1,

create: function create(methodName) {
var expectation = extend.nonEnum(stub(), mockExpectation);
const expectation = extend.nonEnum(stub(), mockExpectation);
delete expectation.create;

@@ -151,3 +151,3 @@ expectation.method = methodName;

verifyCallAllowed: function verifyCallAllowed(thisValue, args) {
var expectedArguments = this.expectedArguments;
const expectedArguments = this.expectedArguments;

@@ -224,3 +224,3 @@ if (receivedMaxCalls(this)) {

allowsCall: function allowsCall(thisValue, args) {
var expectedArguments = this.expectedArguments;
const expectedArguments = this.expectedArguments;

@@ -240,3 +240,3 @@ if (this.met() && receivedMaxCalls(this)) {

// eslint-disable-next-line no-underscore-dangle
var _args = args || [];
const _args = args || [];

@@ -284,3 +284,3 @@ if (_args.length < expectedArguments.length) {

toString: function () {
var args = slice(this.expectedArguments || []);
const args = slice(this.expectedArguments || []);

@@ -291,3 +291,3 @@ if (!this.expectsExactArgCount) {

var callStr = proxyCallToString.call({
const callStr = proxyCallToString.call({
proxy: this.method || "anonymous mock expectation",

@@ -297,3 +297,3 @@ args: args,

var message = `${callStr.replace(
const message = `${callStr.replace(
", [...",

@@ -325,3 +325,3 @@ "[, ..."

fail: function fail(message) {
var exception = new Error(message);
const exception = new Error(message);
exception.name = "ExpectationError";

@@ -328,0 +328,0 @@

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var mockExpectation = require("./mock-expectation");
var proxyCallToString = require("./proxy-call").toString;
var extend = require("./util/core/extend");
var deepEqual = require("@sinonjs/samsam").deepEqual;
var wrapMethod = require("./util/core/wrap-method");
var usePromiseLibrary = require("./util/core/use-promise-library");
const arrayProto = require("@sinonjs/commons").prototypes.array;
const mockExpectation = require("./mock-expectation");
const proxyCallToString = require("./proxy-call").toString;
const extend = require("./util/core/extend");
const deepEqual = require("@sinonjs/samsam").deepEqual;
const wrapMethod = require("./util/core/wrap-method");
const usePromiseLibrary = require("./util/core/use-promise-library");
var concat = arrayProto.concat;
var filter = arrayProto.filter;
var forEach = arrayProto.forEach;
var every = arrayProto.every;
var join = arrayProto.join;
var push = arrayProto.push;
var slice = arrayProto.slice;
var unshift = arrayProto.unshift;
const concat = arrayProto.concat;
const filter = arrayProto.filter;
const forEach = arrayProto.forEach;
const every = arrayProto.every;
const join = arrayProto.join;
const push = arrayProto.push;
const slice = arrayProto.slice;
const unshift = arrayProto.unshift;

@@ -29,3 +29,3 @@ function mock(object) {

function each(collection, callback) {
var col = collection || [];
const col = collection || [];

@@ -51,3 +51,3 @@ forEach(col, callback);

var mockObject = extend.nonEnum({}, mock, { object: object });
const mockObject = extend.nonEnum({}, mock, { object: object });
delete mockObject.create;

@@ -71,3 +71,3 @@

this.expectations[method] = [];
var mockObject = this;
const mockObject = this;

@@ -81,3 +81,3 @@ wrapMethod(this.object, method, function () {

var expectation = mockExpectation.create(method);
const expectation = mockExpectation.create(method);
expectation.wrappedMethod = this.object[method].wrappedMethod;

@@ -91,3 +91,3 @@ push(this.expectations[method], expectation);

restore: function restore() {
var object = this.object;
const object = this.object;

@@ -102,5 +102,5 @@ each(this.proxies, function (proxy) {

verify: function verify() {
var expectations = this.expectations || {};
var messages = this.failures ? slice(this.failures) : [];
var met = [];
const expectations = this.expectations || {};
const messages = this.failures ? slice(this.failures) : [];
const met = [];

@@ -137,13 +137,13 @@ each(this.proxies, function (proxy) {

/* eslint consistent-return: "off" */
var expectations =
const expectations =
this.expectations && this.expectations[method]
? this.expectations[method]
: [];
var currentArgs = args || [];
var available;
const currentArgs = args || [];
let available;
var expectationsWithMatchingArgs = filter(
const expectationsWithMatchingArgs = filter(
expectations,
function (expectation) {
var expectedArgs = expectation.expectedArguments || [];
const expectedArgs = expectation.expectedArguments || [];

@@ -158,3 +158,3 @@ return arrayEquals(

var expectationsToApply = filter(
const expectationsToApply = filter(
expectationsWithMatchingArgs,

@@ -173,4 +173,4 @@ function (expectation) {

var messages = [];
var exhausted = 0;
const messages = [];
let exhausted = 0;

@@ -201,3 +201,3 @@ forEach(expectationsWithMatchingArgs, function (expectation) {

var err = new Error();
const err = new Error();
if (!err.stack) {

@@ -204,0 +204,0 @@ // PhantomJS does not serialize the stack trace until the error has been thrown

"use strict";
var fake = require("./fake");
var isRestorable = require("./util/core/is-restorable");
const fake = require("./fake");
const isRestorable = require("./util/core/is-restorable");
var STATUS_PENDING = "pending";
var STATUS_RESOLVED = "resolved";
var STATUS_REJECTED = "rejected";
const STATUS_PENDING = "pending";
const STATUS_RESOLVED = "resolved";
const STATUS_REJECTED = "rejected";

@@ -37,4 +37,4 @@ /**

function promise(executor) {
var fakeExecutor = getFakeExecutor(executor);
var sinonPromise = new Promise(fakeExecutor);
const fakeExecutor = getFakeExecutor(executor);
const sinonPromise = new Promise(fakeExecutor);

@@ -41,0 +41,0 @@ sinonPromise.status = STATUS_PENDING;

"use strict";
var push = require("@sinonjs/commons").prototypes.array.push;
const push = require("@sinonjs/commons").prototypes.array.push;

@@ -42,9 +42,9 @@ exports.incrementCallCount = function incrementCallCount(proxy) {

var currentCall;
var matches = 0;
var returnValues = [];
let currentCall;
let matches = 0;
const returnValues = [];
for (var i = 0, l = this.callCount; i < l; i += 1) {
for (let i = 0, l = this.callCount; i < l; i += 1) {
currentCall = this.getCall(i);
var returnValue = currentCall[actual || method].apply(
const returnValue = currentCall[actual || method].apply(
currentCall,

@@ -51,0 +51,0 @@ arguments

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var match = require("@sinonjs/samsam").createMatcher;
var deepEqual = require("@sinonjs/samsam").deepEqual;
var functionName = require("@sinonjs/commons").functionName;
var inspect = require("util").inspect;
var valueToString = require("@sinonjs/commons").valueToString;
const arrayProto = require("@sinonjs/commons").prototypes.array;
const match = require("@sinonjs/samsam").createMatcher;
const deepEqual = require("@sinonjs/samsam").deepEqual;
const functionName = require("@sinonjs/commons").functionName;
const inspect = require("util").inspect;
const valueToString = require("@sinonjs/commons").valueToString;
var concat = arrayProto.concat;
var filter = arrayProto.filter;
var join = arrayProto.join;
var map = arrayProto.map;
var reduce = arrayProto.reduce;
var slice = arrayProto.slice;
const concat = arrayProto.concat;
const filter = arrayProto.filter;
const join = arrayProto.join;
const map = arrayProto.map;
const reduce = arrayProto.reduce;
const slice = arrayProto.slice;

@@ -23,3 +23,3 @@ /**

function throwYieldError(proxy, text, args) {
var msg = functionName(proxy) + text;
let msg = functionName(proxy) + text;
if (args.length) {

@@ -31,3 +31,3 @@ msg += ` Received [${join(slice(args), ", ")}]`;

var callProto = {
const callProto = {
calledOn: function calledOn(thisValue) {

@@ -41,4 +41,4 @@ if (match.isMatcher(thisValue)) {

calledWith: function calledWith() {
var self = this;
var calledWithArgs = slice(arguments);
const self = this;
const calledWithArgs = slice(arguments);

@@ -59,4 +59,4 @@ if (calledWithArgs.length > self.args.length) {

calledWithMatch: function calledWithMatch() {
var self = this;
var calledWithMatchArgs = slice(arguments);
const self = this;
const calledWithMatchArgs = slice(arguments);

@@ -70,3 +70,3 @@ if (calledWithMatchArgs.length > self.args.length) {

function (prev, expectation, i) {
var actual = self.args[i];
const actual = self.args[i];

@@ -145,3 +145,3 @@ return prev && match(expectation).test(actual);

this.ensureArgIsAFunction(pos);
var args = slice(arguments, 2);
const args = slice(arguments, 2);
return this.args[pos].apply(thisValue, args);

@@ -165,4 +165,4 @@ },

yieldOn: function (thisValue) {
var args = slice(this.args);
var yieldFn = filter(args, function (arg) {
const args = slice(this.args);
const yieldFn = filter(args, function (arg) {
return typeof arg === "function";

@@ -190,7 +190,7 @@ })[0];

yieldToOn: function (prop, thisValue) {
var args = slice(this.args);
var yieldArg = filter(args, function (arg) {
const args = slice(this.args);
const yieldArg = filter(args, function (arg) {
return arg && typeof arg[prop] === "function";
})[0];
var yieldFn = yieldArg && yieldArg[prop];
const yieldFn = yieldArg && yieldArg[prop];

@@ -211,5 +211,2 @@ if (!yieldFn) {

toString: function () {
var callStr = this.proxy ? `${String(this.proxy)}(` : "";
var formattedArgs;
if (!this.args) {

@@ -219,3 +216,4 @@ return ":(";

formattedArgs = map(this.args, function (arg) {
let callStr = this.proxy ? `${String(this.proxy)}(` : "";
const formattedArgs = map(this.args, function (arg) {
return inspect(arg);

@@ -290,3 +288,3 @@ });

var firstArg, lastArg;
let firstArg, lastArg;

@@ -298,4 +296,4 @@ if (args.length > 0) {

var proxyCall = Object.create(callProto);
var callback =
const proxyCall = Object.create(callProto);
const callback =
lastArg && typeof lastArg === "function" ? lastArg : undefined;

@@ -302,0 +300,0 @@

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var proxyCallUtil = require("./proxy-call-util");
const arrayProto = require("@sinonjs/commons").prototypes.array;
const proxyCallUtil = require("./proxy-call-util");
var push = arrayProto.push;
var forEach = arrayProto.forEach;
var concat = arrayProto.concat;
var ErrorConstructor = Error.prototype.constructor;
var bind = Function.prototype.bind;
const push = arrayProto.push;
const forEach = arrayProto.forEach;
const concat = arrayProto.concat;
const ErrorConstructor = Error.prototype.constructor;
const bind = Function.prototype.bind;
var callId = 0;
let callId = 0;
module.exports = function invoke(func, thisValue, args) {
var matchings = this.matchingFakes(args);
var currentCallId = callId++;
var exception, returnValue;
const matchings = this.matchingFakes(args);
const currentCallId = callId++;
let exception, returnValue;

@@ -37,3 +37,3 @@ proxyCallUtil.incrementCallCount(this);

var thisCall = this.getCall(this.callCount - 1);
const thisCall = this.getCall(this.callCount - 1);

@@ -47,3 +47,6 @@ if (thisCall.calledWithNew()) {

if (typeof returnValue !== "object") {
if (
typeof returnValue !== "object" &&
typeof returnValue !== "function"
) {
returnValue = thisValue;

@@ -67,3 +70,3 @@ }

var err = new ErrorConstructor();
const err = new ErrorConstructor();
// 1. Please do not get stack at this point. It may be so very slow, and not actually used

@@ -70,0 +73,0 @@ // 2. PhantomJS does not serialize the stack trace until the error has been thrown:

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var extend = require("./util/core/extend");
var functionToString = require("./util/core/function-to-string");
var proxyCall = require("./proxy-call");
var proxyCallUtil = require("./proxy-call-util");
var proxyInvoke = require("./proxy-invoke");
var inspect = require("util").inspect;
const arrayProto = require("@sinonjs/commons").prototypes.array;
const extend = require("./util/core/extend");
const functionToString = require("./util/core/function-to-string");
const proxyCall = require("./proxy-call");
const proxyCallUtil = require("./proxy-call-util");
const proxyInvoke = require("./proxy-invoke");
const inspect = require("util").inspect;
var push = arrayProto.push;
var forEach = arrayProto.forEach;
var slice = arrayProto.slice;
const push = arrayProto.push;
const forEach = arrayProto.forEach;
const slice = arrayProto.slice;
var emptyFakes = Object.freeze([]);
const emptyFakes = Object.freeze([]);
// Public API
var proxyApi = {
const proxyApi = {
toString: functionToString,

@@ -23,3 +23,3 @@

this.displayName = name;
var nameDescriptor = Object.getOwnPropertyDescriptor(this, "name");
const nameDescriptor = Object.getOwnPropertyDescriptor(this, "name");
if (nameDescriptor && nameDescriptor.configurable) {

@@ -45,3 +45,3 @@ // IE 11 functions don't have a name.

getCall: function getCall(index) {
var i = index;
let i = index;
if (i < 0) {

@@ -67,4 +67,4 @@ // Negative indices means counting backwards from the last call

getCalls: function () {
var calls = [];
var i;
const calls = [];
let i;

@@ -122,5 +122,5 @@ for (i = 0; i < this.callCount; i++) {

printf: function (format) {
var spyInstance = this;
var args = slice(arguments, 1);
var formatter;
const spyInstance = this;
const args = slice(arguments, 1);
let formatter;

@@ -142,3 +142,3 @@ return (format || "").replace(/%(.)/g, function (match, specifier) {

if (this.invoking) {
var err = new Error(
const err = new Error(
"Cannot reset Sinon function while invoking it. " +

@@ -180,3 +180,3 @@ "Move the call to .resetHistory outside of the callback."

var delegateToCalls = proxyCallUtil.delegateToCalls;
const delegateToCalls = proxyCallUtil.delegateToCalls;
delegateToCalls(proxyApi, "calledOn", true);

@@ -250,3 +250,3 @@ delegateToCalls(proxyApi, "alwaysCalledOn", false, "calledOn");

function createProxy(func, originalFunc) {
var proxy = wrapFunction(func, originalFunc);
const proxy = wrapFunction(func, originalFunc);

@@ -264,4 +264,4 @@ // Inherit function properties:

function wrapFunction(func, originalFunc) {
var arity = originalFunc.length;
var p;
const arity = originalFunc.length;
let p;
// Do not change this to use an eval. Projects that depend on sinon block the use of eval.

@@ -343,3 +343,6 @@ // ref: https://github.com/sinonjs/sinon/issues/710

}
var nameDescriptor = Object.getOwnPropertyDescriptor(originalFunc, "name");
const nameDescriptor = Object.getOwnPropertyDescriptor(
originalFunc,
"name"
);
if (nameDescriptor && nameDescriptor.configurable) {

@@ -346,0 +349,0 @@ // IE 11 functions don't have a name.

"use strict";
var walkObject = require("./util/core/walk-object");
const walkObject = require("./util/core/walk-object");

@@ -5,0 +5,0 @@ function filter(object, property) {

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var logger = require("@sinonjs/commons").deprecated;
var collectOwnMethods = require("./collect-own-methods");
var getPropertyDescriptor = require("./util/core/get-property-descriptor");
var isPropertyConfigurable = require("./util/core/is-property-configurable");
var match = require("@sinonjs/samsam").createMatcher;
var sinonAssert = require("./assert");
var sinonClock = require("./util/fake-timers");
var sinonMock = require("./mock");
var sinonSpy = require("./spy");
var sinonStub = require("./stub");
var sinonFake = require("./fake");
var valueToString = require("@sinonjs/commons").valueToString;
var fakeServer = require("nise").fakeServer;
var fakeXhr = require("nise").fakeXhr;
var usePromiseLibrary = require("./util/core/use-promise-library");
const arrayProto = require("@sinonjs/commons").prototypes.array;
const logger = require("@sinonjs/commons").deprecated;
const collectOwnMethods = require("./collect-own-methods");
const getPropertyDescriptor = require("./util/core/get-property-descriptor");
const isPropertyConfigurable = require("./util/core/is-property-configurable");
const match = require("@sinonjs/samsam").createMatcher;
const sinonAssert = require("./assert");
const sinonClock = require("./util/fake-timers");
const sinonMock = require("./mock");
const sinonSpy = require("./spy");
const sinonStub = require("./stub");
const sinonCreateStubInstance = require("./create-stub-instance");
const sinonFake = require("./fake");
const valueToString = require("@sinonjs/commons").valueToString;
const fakeServer = require("nise").fakeServer;
const fakeXhr = require("nise").fakeXhr;
const usePromiseLibrary = require("./util/core/use-promise-library");
var DEFAULT_LEAK_THRESHOLD = 10000;
const DEFAULT_LEAK_THRESHOLD = 10000;
var filter = arrayProto.filter;
var forEach = arrayProto.forEach;
var push = arrayProto.push;
var reverse = arrayProto.reverse;
const filter = arrayProto.filter;
const forEach = arrayProto.forEach;
const push = arrayProto.push;
const reverse = arrayProto.reverse;
function applyOnEach(fakes, method) {
var matchingFakes = filter(fakes, function (fake) {
const matchingFakes = filter(fakes, function (fake) {
return typeof fake[method] === "function";

@@ -37,9 +38,43 @@ });

function throwOnAccessors(descriptor) {
if (typeof descriptor.get === "function") {
throw new Error("Use sandbox.replaceGetter for replacing getters");
}
if (typeof descriptor.set === "function") {
throw new Error("Use sandbox.replaceSetter for replacing setters");
}
}
function verifySameType(object, property, replacement) {
if (typeof object[property] !== typeof replacement) {
throw new TypeError(
`Cannot replace ${typeof object[
property
]} with ${typeof replacement}`
);
}
}
function checkForValidArguments(descriptor, property, replacement) {
if (typeof descriptor === "undefined") {
throw new TypeError(
`Cannot replace non-existent property ${valueToString(
property
)}. Perhaps you meant sandbox.define()?`
);
}
if (typeof replacement === "undefined") {
throw new TypeError("Expected replacement argument to be defined");
}
}
function Sandbox() {
var sandbox = this;
var fakeRestorers = [];
var promiseLib;
const sandbox = this;
let fakeRestorers = [];
let promiseLib;
var collection = [];
var loggedLeakWarning = false;
let collection = [];
let loggedLeakWarning = false;
sandbox.leakThreshold = DEFAULT_LEAK_THRESHOLD;

@@ -69,11 +104,6 @@

// this is for testing only
sandbox.getRestorers = function () {
return fakeRestorers;
};
sandbox.createStubInstance = function createStubInstance() {
var stubbed = sinonStub.createStubInstance.apply(null, arguments);
const stubbed = sinonCreateStubInstance.apply(null, arguments);
var ownMethods = collectOwnMethods(stubbed);
const ownMethods = collectOwnMethods(stubbed);

@@ -110,2 +140,6 @@ forEach(ownMethods, function (method) {

obj.define = function () {
return sandbox.define.apply(null, arguments);
};
obj.replace = function () {

@@ -138,3 +172,3 @@ return sandbox.replace.apply(null, arguments);

sandbox.mock = function mock() {
var m = sinonMock.apply(null, arguments);
const m = sinonMock.apply(null, arguments);

@@ -158,3 +192,3 @@ addToCollection(m);

function privateResetHistory(f) {
var method = f.resetHistory || f.reset;
const method = f.resetHistory || f.reset;
if (method) {

@@ -165,19 +199,3 @@ method.call(f);

forEach(collection, function (fake) {
if (typeof fake === "function") {
privateResetHistory(fake);
return;
}
var methods = [];
if (fake.get) {
push(methods, fake.get);
}
if (fake.set) {
push(methods, fake.set);
}
forEach(methods, privateResetHistory);
});
forEach(collection, privateResetHistory);
};

@@ -205,21 +223,29 @@

sandbox.restoreContext = function restoreContext() {
var injectedKeys = sandbox.injectedKeys;
var injectInto = sandbox.injectInto;
if (!injectedKeys) {
if (!sandbox.injectedKeys) {
return;
}
forEach(injectedKeys, function (injectedKey) {
delete injectInto[injectedKey];
forEach(sandbox.injectedKeys, function (injectedKey) {
delete sandbox.injectInto[injectedKey];
});
injectedKeys = [];
sandbox.injectedKeys.length = 0;
};
function getFakeRestorer(object, property) {
var descriptor = getPropertyDescriptor(object, property);
/**
* Creates a restorer function for the property
*
* @param {object|Function} object
* @param {string} property
* @param {boolean} forceAssignment
* @returns {Function} restorer function
*/
function getFakeRestorer(object, property, forceAssignment = false) {
const descriptor = getPropertyDescriptor(object, property);
const value = object[property];
function restorer() {
if (descriptor.isOwn) {
if (forceAssignment) {
object[property] = value;
} else if (descriptor?.isOwn) {
Object.defineProperty(object, property, descriptor);

@@ -230,2 +256,3 @@ } else {

}
restorer.object = object;

@@ -249,41 +276,68 @@ restorer.property = property;

/**
* Replace an existing property
*
* @param {object|Function} object
* @param {string} property
* @param {*} replacement a fake, stub, spy or any other value
* @returns {*}
*/
sandbox.replace = function replace(object, property, replacement) {
var descriptor = getPropertyDescriptor(object, property);
const descriptor = getPropertyDescriptor(object, property);
checkForValidArguments(descriptor, property, replacement);
throwOnAccessors(descriptor);
verifySameType(object, property, replacement);
if (typeof descriptor === "undefined") {
throw new TypeError(
`Cannot replace non-existent property ${valueToString(
property
)}`
);
}
verifyNotReplaced(object, property);
if (typeof replacement === "undefined") {
throw new TypeError("Expected replacement argument to be defined");
}
// store a function for restoring the replaced property
push(fakeRestorers, getFakeRestorer(object, property));
if (typeof descriptor.get === "function") {
throw new Error("Use sandbox.replaceGetter for replacing getters");
}
object[property] = replacement;
if (typeof descriptor.set === "function") {
throw new Error("Use sandbox.replaceSetter for replacing setters");
}
return replacement;
};
if (typeof object[property] !== typeof replacement) {
sandbox.replace.usingAccessor = function replaceUsingAccessor(
object,
property,
replacement
) {
const descriptor = getPropertyDescriptor(object, property);
checkForValidArguments(descriptor, property, replacement);
verifySameType(object, property, replacement);
verifyNotReplaced(object, property);
// store a function for restoring the replaced property
push(fakeRestorers, getFakeRestorer(object, property, true));
object[property] = replacement;
return replacement;
};
sandbox.define = function define(object, property, value) {
const descriptor = getPropertyDescriptor(object, property);
if (descriptor) {
throw new TypeError(
`Cannot replace ${typeof object[
`Cannot define the already existing property ${valueToString(
property
]} with ${typeof replacement}`
)}. Perhaps you meant sandbox.replace()?`
);
}
if (typeof value === "undefined") {
throw new TypeError("Expected value argument to be defined");
}
verifyNotReplaced(object, property);
// store a function for restoring the replaced property
// store a function for restoring the defined property
push(fakeRestorers, getFakeRestorer(object, property));
object[property] = replacement;
object[property] = value;
return replacement;
return value;
};

@@ -296,3 +350,3 @@

) {
var descriptor = getPropertyDescriptor(object, property);
const descriptor = getPropertyDescriptor(object, property);

@@ -335,3 +389,3 @@ if (typeof descriptor === "undefined") {

) {
var descriptor = getPropertyDescriptor(object, property);
const descriptor = getPropertyDescriptor(object, property);

@@ -371,10 +425,9 @@ if (typeof descriptor === "undefined") {

function commonPostInitSetup(args, spy) {
var object = args[0];
var property = args[1];
const [object, property, types] = args;
var isSpyingOnEntireObject =
const isSpyingOnEntireObject =
typeof property === "undefined" && typeof object === "object";
if (isSpyingOnEntireObject) {
var ownMethods = collectOwnMethods(spy);
const ownMethods = collectOwnMethods(spy);

@@ -386,2 +439,7 @@ forEach(ownMethods, function (method) {

usePromiseLibrary(promiseLib, ownMethods);
} else if (Array.isArray(types)) {
for (const accessorType of types) {
addToCollection(spy[accessorType]);
usePromiseLibrary(promiseLib, spy[accessorType]);
}
} else {

@@ -396,3 +454,3 @@ addToCollection(spy);

sandbox.spy = function spy() {
var createdSpy = sinonSpy.apply(sinonSpy, arguments);
const createdSpy = sinonSpy.apply(sinonSpy, arguments);
return commonPostInitSetup(arguments, createdSpy);

@@ -402,3 +460,3 @@ };

sandbox.stub = function stub() {
var createdStub = sinonStub.apply(sinonStub, arguments);
const createdStub = sinonStub.apply(sinonStub, arguments);
return commonPostInitSetup(arguments, createdStub);

@@ -409,3 +467,3 @@ };

sandbox.fake = function fake(f) {
var s = sinonFake.apply(sinonFake, arguments);
const s = sinonFake.apply(sinonFake, arguments);

@@ -418,6 +476,6 @@ addToCollection(s);

forEach(Object.keys(sinonFake), function (key) {
var fakeBehavior = sinonFake[key];
const fakeBehavior = sinonFake[key];
if (typeof fakeBehavior === "function") {
sandbox.fake[key] = function () {
var s = fakeBehavior.apply(fakeBehavior, arguments);
const s = fakeBehavior.apply(fakeBehavior, arguments);

@@ -432,3 +490,3 @@ addToCollection(s);

sandbox.useFakeTimers = function useFakeTimers(args) {
var clock = sinonClock.useFakeTimers.call(null, args);
const clock = sinonClock.useFakeTimers.call(null, args);

@@ -446,3 +504,3 @@ sandbox.clock = clock;

sandbox.verifyAndRestore = function verifyAndRestore() {
var exception;
let exception;

@@ -463,3 +521,3 @@ try {

sandbox.useFakeServer = function useFakeServer() {
var proto = sandbox.serverPrototype || fakeServer;
const proto = sandbox.serverPrototype || fakeServer;

@@ -477,3 +535,3 @@ if (!proto || !proto.create) {

sandbox.useFakeXMLHttpRequest = function useFakeXMLHttpRequest() {
var xhr = fakeXhr.useFakeXMLHttpRequest();
const xhr = fakeXhr.useFakeXMLHttpRequest();
addToCollection(xhr);

@@ -480,0 +538,0 @@ return xhr;

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var color = require("./color");
var match = require("@sinonjs/samsam").createMatcher;
var timesInWords = require("./util/core/times-in-words");
var inspect = require("util").inspect;
var jsDiff = require("diff");
const arrayProto = require("@sinonjs/commons").prototypes.array;
const color = require("./color");
const match = require("@sinonjs/samsam").createMatcher;
const timesInWords = require("./util/core/times-in-words");
const inspect = require("util").inspect;
const jsDiff = require("diff");
var join = arrayProto.join;
var map = arrayProto.map;
var push = arrayProto.push;
var slice = arrayProto.slice;
const join = arrayProto.join;
const map = arrayProto.map;
const push = arrayProto.push;
const slice = arrayProto.slice;
function colorSinonMatchText(matcher, calledArg, calledArgMessage) {
var calledArgumentMessage = calledArgMessage;
let calledArgumentMessage = calledArgMessage;
let matcherMessage = matcher.message;
if (!matcher.test(calledArg)) {
matcher.message = color.red(matcher.message);
matcherMessage = color.red(matcher.message);
if (calledArgumentMessage) {

@@ -23,8 +24,8 @@ calledArgumentMessage = color.green(calledArgumentMessage);

}
return `${calledArgumentMessage} ${matcher.message}`;
return `${calledArgumentMessage} ${matcherMessage}`;
}
function colorDiffText(diff) {
var objects = map(diff, function (part) {
var text = part.value;
const objects = map(diff, function (part) {
let text = part.value;
if (part.added) {

@@ -61,5 +62,5 @@ text = color.green(text);

D: function (spyInstance, args) {
var message = "";
let message = "";
for (var i = 0, l = spyInstance.callCount; i < l; ++i) {
for (let i = 0, l = spyInstance.callCount; i < l; ++i) {
// describe multiple calls

@@ -69,12 +70,12 @@ if (l > 1) {

}
var calledArgs = spyInstance.getCall(i).args;
var expectedArgs = slice(args);
const calledArgs = spyInstance.getCall(i).args;
const expectedArgs = slice(args);
for (
var j = 0;
let j = 0;
j < calledArgs.length || j < expectedArgs.length;
++j
) {
var calledArg = calledArgs[j];
var expectedArg = expectedArgs[j];
let calledArg = calledArgs[j];
let expectedArg = expectedArgs[j];
if (calledArg) {

@@ -90,3 +91,3 @@ calledArg = quoteStringValue(calledArg);

var calledArgMessage =
const calledArgMessage =
j < calledArgs.length ? inspect(calledArg) : "";

@@ -100,5 +101,5 @@ if (match.isMatcher(expectedArg)) {

} else {
var expectedArgMessage =
const expectedArgMessage =
j < expectedArgs.length ? inspect(expectedArg) : "";
var diff = jsDiff.diffJson(
const diff = jsDiff.diffJson(
calledArgMessage,

@@ -116,7 +117,7 @@ expectedArgMessage

C: function (spyInstance) {
var calls = [];
const calls = [];
for (var i = 0, l = spyInstance.callCount; i < l; ++i) {
for (let i = 0, l = spyInstance.callCount; i < l; ++i) {
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
var stringifiedCall = ` ${spyInstance.getCall(i).toString()}`;
let stringifiedCall = ` ${spyInstance.getCall(i).toString()}`;
if (/\n/.test(calls[i - 1])) {

@@ -132,5 +133,5 @@ stringifiedCall = `\n${stringifiedCall}`;

t: function (spyInstance) {
var objects = [];
const objects = [];
for (var i = 0, l = spyInstance.callCount; i < l; ++i) {
for (let i = 0, l = spyInstance.callCount; i < l; ++i) {
push(objects, inspect(spyInstance.thisValues[i]));

@@ -137,0 +138,0 @@ }

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var createProxy = require("./proxy");
var extend = require("./util/core/extend");
var functionName = require("@sinonjs/commons").functionName;
var getPropertyDescriptor = require("./util/core/get-property-descriptor");
var deepEqual = require("@sinonjs/samsam").deepEqual;
var isEsModule = require("./util/core/is-es-module");
var proxyCallUtil = require("./proxy-call-util");
var walkObject = require("./util/core/walk-object");
var wrapMethod = require("./util/core/wrap-method");
var valueToString = require("@sinonjs/commons").valueToString;
const arrayProto = require("@sinonjs/commons").prototypes.array;
const createProxy = require("./proxy");
const extend = require("./util/core/extend");
const functionName = require("@sinonjs/commons").functionName;
const getPropertyDescriptor = require("./util/core/get-property-descriptor");
const deepEqual = require("@sinonjs/samsam").deepEqual;
const isEsModule = require("./util/core/is-es-module");
const proxyCallUtil = require("./proxy-call-util");
const walkObject = require("./util/core/walk-object");
const wrapMethod = require("./util/core/wrap-method");
const valueToString = require("@sinonjs/commons").valueToString;
/* cache references to library methods so that they also can be stubbed without problems */
var forEach = arrayProto.forEach;
var pop = arrayProto.pop;
var push = arrayProto.push;
var slice = arrayProto.slice;
var filter = Array.prototype.filter;
const forEach = arrayProto.forEach;
const pop = arrayProto.pop;
const push = arrayProto.push;
const slice = arrayProto.slice;
const filter = Array.prototype.filter;
var uuid = 0;
let uuid = 0;
function matches(fake, args, strict) {
var margs = fake.matchingArguments;
const margs = fake.matchingArguments;
if (

@@ -36,6 +36,6 @@ margs.length <= args.length &&

// Public API
var spyApi = {
const spyApi = {
withArgs: function () {
var args = slice(arguments);
var matching = pop(this.matchingFakes(args, true));
const args = slice(arguments);
const matching = pop(this.matchingFakes(args, true));
if (matching) {

@@ -45,4 +45,4 @@ return matching;

var original = this;
var fake = this.instantiateFake();
const original = this;
const fake = this.instantiateFake();
fake.matchingArguments = args;

@@ -83,3 +83,3 @@ fake.parent = this;

/* eslint-disable @sinonjs/no-prototype-methods/no-prototype-methods */
var delegateToCalls = proxyCallUtil.delegateToCalls;
const delegateToCalls = proxyCallUtil.delegateToCalls;
delegateToCalls(spyApi, "callArg", false, "callArgWith", true, function () {

@@ -137,4 +137,4 @@ throw new Error(

function createSpy(func) {
var name;
var funk = func;
let name;
let funk = func;

@@ -149,3 +149,3 @@ if (typeof funk !== "function") {

var proxy = createProxy(funk, funk);
const proxy = createProxy(funk, funk);

@@ -164,4 +164,2 @@ // Inherit spy API:

function spy(object, property, types) {
var descriptor, methodDesc;
if (isEsModule(object)) {

@@ -189,4 +187,4 @@ throw new TypeError("ES Modules cannot be spied");

descriptor = {};
methodDesc = getPropertyDescriptor(object, property);
const descriptor = {};
const methodDesc = getPropertyDescriptor(object, property);

@@ -193,0 +191,0 @@ forEach(types, function (type) {

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var behavior = require("./behavior");
var behaviors = require("./default-behaviors");
var createProxy = require("./proxy");
var functionName = require("@sinonjs/commons").functionName;
var hasOwnProperty =
const arrayProto = require("@sinonjs/commons").prototypes.array;
const behavior = require("./behavior");
const behaviors = require("./default-behaviors");
const createProxy = require("./proxy");
const functionName = require("@sinonjs/commons").functionName;
const hasOwnProperty =
require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var isNonExistentProperty = require("./util/core/is-non-existent-property");
var spy = require("./spy");
var extend = require("./util/core/extend");
var getPropertyDescriptor = require("./util/core/get-property-descriptor");
var isEsModule = require("./util/core/is-es-module");
var wrapMethod = require("./util/core/wrap-method");
var throwOnFalsyObject = require("./throw-on-falsy-object");
var valueToString = require("@sinonjs/commons").valueToString;
var walkObject = require("./util/core/walk-object");
const isNonExistentProperty = require("./util/core/is-non-existent-property");
const spy = require("./spy");
const extend = require("./util/core/extend");
const getPropertyDescriptor = require("./util/core/get-property-descriptor");
const isEsModule = require("./util/core/is-es-module");
const sinonType = require("./util/core/sinon-type");
const wrapMethod = require("./util/core/wrap-method");
const throwOnFalsyObject = require("./throw-on-falsy-object");
const valueToString = require("@sinonjs/commons").valueToString;
const walkObject = require("./util/core/walk-object");
var forEach = arrayProto.forEach;
var pop = arrayProto.pop;
var slice = arrayProto.slice;
var sort = arrayProto.sort;
const forEach = arrayProto.forEach;
const pop = arrayProto.pop;
const slice = arrayProto.slice;
const sort = arrayProto.sort;
var uuid = 0;
let uuid = 0;
function createStub(originalFunc) {
var proxy;
// eslint-disable-next-line prefer-const
let proxy;
function functionStub() {
var args = slice(arguments);
var matchings = proxy.matchingFakes(args);
const args = slice(arguments);
const matchings = proxy.matchingFakes(args);
var fnStub =
const fnStub =
pop(

@@ -51,3 +53,3 @@ sort(matchings, function (a, b) {

var name = originalFunc ? functionName(originalFunc) : null;
const name = originalFunc ? functionName(originalFunc) : null;
extend.nonEnum(proxy, {

@@ -62,2 +64,4 @@ fakes: [],

sinonType.set(proxy, "stub");
return proxy;

@@ -85,12 +89,12 @@ }

var actualDescriptor = getPropertyDescriptor(object, property);
const actualDescriptor = getPropertyDescriptor(object, property);
assertValidPropertyDescriptor(actualDescriptor, property);
var isObjectOrFunction =
const isObjectOrFunction =
typeof object === "object" || typeof object === "function";
var isStubbingEntireObject =
const isStubbingEntireObject =
typeof property === "undefined" && isObjectOrFunction;
var isCreatingNewStub = !object && typeof property === "undefined";
var isStubbingNonFuncProperty =
const isCreatingNewStub = !object && typeof property === "undefined";
const isStubbingNonFuncProperty =
isObjectOrFunction &&

@@ -109,7 +113,7 @@ typeof property !== "undefined" &&

var func =
const func =
typeof actualDescriptor.value === "function"
? actualDescriptor.value
: null;
var s = createStub(func);
const s = createStub(func);

@@ -133,26 +137,2 @@ extend.nonEnum(s, {

stub.createStubInstance = function (constructor, overrides) {
if (typeof constructor !== "function") {
throw new TypeError("The constructor should be a function.");
}
var stubbedObject = stub(Object.create(constructor.prototype));
forEach(Object.keys(overrides || {}), function (propertyName) {
if (propertyName in stubbedObject) {
var value = overrides[propertyName];
if (value && value.createStubInstance) {
stubbedObject[propertyName] = value;
} else {
stubbedObject[propertyName].returns(value);
}
} else {
throw new Error(
`Cannot stub ${propertyName}. Property does not exist!`
);
}
});
return stubbedObject;
};
function assertValidPropertyDescriptor(descriptor, property) {

@@ -162,3 +142,3 @@ if (!descriptor || !property) {

}
if (!descriptor.configurable && !descriptor.writable) {
if (descriptor.isOwn && !descriptor.configurable && !descriptor.writable) {
throw new TypeError(

@@ -203,3 +183,3 @@ `Descriptor for property ${property} is non-configurable and non-writable`

function getCurrentBehavior(stubInstance) {
var currentBehavior = stubInstance.behaviors[stubInstance.callCount - 1];
const currentBehavior = stubInstance.behaviors[stubInstance.callCount - 1];
return currentBehavior && currentBehavior.isPresent()

@@ -211,3 +191,3 @@ ? currentBehavior

var proto = {
const proto = {
resetBehavior: function () {

@@ -256,3 +236,3 @@ this.defaultBehavior = null;

withArgs: function withArgs() {
var fake = spy.withArgs.apply(this, arguments);
const fake = spy.withArgs.apply(this, arguments);
if (this.defaultBehavior && this.defaultBehavior.promiseLibrary) {

@@ -259,0 +239,0 @@ fake.defaultBehavior =

"use strict";
var valueToString = require("@sinonjs/commons").valueToString;
const valueToString = require("@sinonjs/commons").valueToString;
function throwOnFalsyObject(object, property) {
if (property && !object) {
var type = object === null ? "null" : "undefined";
const type = object === null ? "null" : "undefined";
throw new Error(

@@ -8,0 +8,0 @@ `Trying to stub property '${valueToString(property)}' of ${type}`

@@ -13,2 +13,3 @@ "use strict";

"fake",
"define",
"replace",

@@ -15,0 +16,0 @@ "replaceSetter",

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var reduce = arrayProto.reduce;
const arrayProto = require("@sinonjs/commons").prototypes.array;
const reduce = arrayProto.reduce;

@@ -13,3 +13,6 @@ module.exports = function exportAsyncBehaviors(behaviorMethods) {

acc[`${method}Async`] = function () {
var result = behaviorMethods[method].apply(this, arguments);
const result = behaviorMethods[method].apply(
this,
arguments
);
this.callbackAsync = true;

@@ -16,0 +19,0 @@ return result;

"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var hasOwnProperty =
const arrayProto = require("@sinonjs/commons").prototypes.array;
const hasOwnProperty =
require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var join = arrayProto.join;
var push = arrayProto.push;
const join = arrayProto.join;
const push = arrayProto.push;
// Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
var hasDontEnumBug = (function () {
var obj = {
const hasDontEnumBug = (function () {
const obj = {
constructor: function () {

@@ -45,4 +45,4 @@ return "0";

var result = [];
for (var prop in obj) {
const result = [];
for (const prop in obj) {
if (hasOwnProperty(obj, prop)) {

@@ -55,4 +55,11 @@ push(result, obj[prop]());

/**
*
* @param target
* @param sources
* @param doCopy
* @returns {*} target
*/
function extendCommon(target, sources, doCopy) {
var source, i, prop;
let source, i, prop;

@@ -82,3 +89,4 @@ for (i = 0; i < sources.length; i++) {

/** Public: Extend target in place with all (own) properties, except 'name' when [[writable]] is false,
/**
* Public: Extend target in place with all (own) properties, except 'name' when [[writable]] is false,
* from sources in-order. Thus, last source will override properties in previous sources.

@@ -88,3 +96,2 @@ *

* @param {object[]} sources - Objects to copy properties from.
*
* @returns {object} the extended target

@@ -97,7 +104,7 @@ */

function copyValue(dest, source, prop) {
var destOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
const destOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
dest,
prop
);
var sourceOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
const sourceOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
source,

@@ -138,3 +145,4 @@ prop

/** Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will
/**
* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will
* override properties in previous sources. Define the properties as non enumerable.

@@ -144,3 +152,2 @@ *

* @param {object[]} sources - Objects to copy properties from.
*
* @returns {object} the extended target

@@ -147,0 +154,0 @@ */

"use strict";
module.exports = function toString() {
var i, prop, thisValue;
let i, prop, thisValue;
if (this.getCall && this.callCount) {

@@ -6,0 +6,0 @@ i = this.callCount;

"use strict";
module.exports = function getPropertyDescriptor(object, property) {
var proto = object;
var descriptor;
var isOwn = Boolean(
/* eslint-disable jsdoc/valid-types */
/*
* The following type def is strictly an illegal JSDoc, but the expression forms a
* legal Typescript union type and is understood by Visual Studio and the IntelliJ
* family of editors. The "TS" flavor of JSDoc is becoming the de-facto standard these
* days for that reason (and the fact that JSDoc is essentially unmaintained)
*/
/**
* @typedef {{isOwn: boolean} & PropertyDescriptor} SinonPropertyDescriptor
* a slightly enriched property descriptor
* @property {boolean} isOwn true if the descriptor is owned by this object, false if it comes from the prototype
*/
/* eslint-enable jsdoc/valid-types */
/**
* Returns a slightly modified property descriptor that one can tell is from the object or the prototype
*
* @param {*} object
* @param {string} property
* @returns {SinonPropertyDescriptor}
*/
function getPropertyDescriptor(object, property) {
let proto = object;
let descriptor;
const isOwn = Boolean(
object && Object.getOwnPropertyDescriptor(object, property)

@@ -22,2 +44,4 @@ );

return descriptor;
};
}
module.exports = getPropertyDescriptor;

@@ -11,3 +11,2 @@ "use strict";

* @param {object} object The object to examine
*
* @returns {boolean} true when the object is a module

@@ -14,0 +13,0 @@ */

"use strict";
var getPropertyDescriptor = require("./get-property-descriptor");
const getPropertyDescriptor = require("./get-property-descriptor");
function isPropertyConfigurable(obj, propName) {
var propertyDescriptor = getPropertyDescriptor(obj, propName);
const propertyDescriptor = getPropertyDescriptor(obj, propName);

@@ -8,0 +8,0 @@ return propertyDescriptor ? propertyDescriptor.configurable : true;

"use strict";
var globalObject = require("@sinonjs/commons").global;
var getNextTick = require("./get-next-tick");
const globalObject = require("@sinonjs/commons").global;
const getNextTick = require("./get-next-tick");
module.exports = getNextTick(globalObject.process, globalObject.setImmediate);
"use strict";
var array = [null, "once", "twice", "thrice"];
const array = [null, "once", "twice", "thrice"];

@@ -5,0 +5,0 @@ module.exports = function timesInWords(count) {

"use strict";
var forEach = Array.prototype.forEach;
const forEach = Array.prototype.forEach;

@@ -5,0 +5,0 @@ function usePromiseLibrary(library, fakes) {

"use strict";
var functionName = require("@sinonjs/commons").functionName;
const functionName = require("@sinonjs/commons").functionName;
var getPropertyDescriptor = require("./get-property-descriptor");
var walk = require("./walk");
const getPropertyDescriptor = require("./get-property-descriptor");
const walk = require("./walk");
function walkObject(predicate, object, filter) {
var called = false;
var name = functionName(predicate);
/**
* A utility that allows traversing an object, applying mutating functions on the properties
*
* @param {Function} mutator called on each property
* @param {object} object the object we are walking over
* @param {Function} filter a predicate (boolean function) that will decide whether or not to apply the mutator to the current property
* @returns {void} nothing
*/
function walkObject(mutator, object, filter) {
let called = false;
const name = functionName(mutator);

@@ -29,7 +37,7 @@ if (!object) {

called = true;
predicate(object, prop);
mutator(object, prop);
}
} else {
called = true;
predicate(object, prop);
mutator(object, prop);
}

@@ -40,3 +48,5 @@ }

if (!called) {
throw new Error(`Expected to ${name} methods on object but found none`);
throw new Error(
`Found no methods on object to which we could apply mutations`
);
}

@@ -43,0 +53,0 @@

"use strict";
var forEach = require("@sinonjs/commons").prototypes.array.forEach;
const forEach = require("@sinonjs/commons").prototypes.array.forEach;
function walkInternal(obj, iterator, context, originalObj, seen) {
var proto, prop;
let prop;
const proto = Object.getPrototypeOf(obj);

@@ -22,3 +23,3 @@ if (typeof Object.getOwnPropertyNames !== "function") {

seen[k] = true;
var target =
const target =
typeof Object.getOwnPropertyDescriptor(obj, k).get ===

@@ -32,3 +33,2 @@ "function"

proto = Object.getPrototypeOf(obj);
if (proto) {

@@ -35,0 +35,0 @@ walkInternal(proto, iterator, context, originalObj, seen);

"use strict";
var getPropertyDescriptor = require("./get-property-descriptor");
var extend = require("./extend");
var hasOwnProperty =
// eslint-disable-next-line no-empty-function
const noop = () => {};
const getPropertyDescriptor = require("./get-property-descriptor");
const extend = require("./extend");
const sinonType = require("./sinon-type");
const hasOwnProperty =
require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var valueToString = require("@sinonjs/commons").valueToString;
var push = require("@sinonjs/commons").prototypes.array.push;
const valueToString = require("@sinonjs/commons").valueToString;
const push = require("@sinonjs/commons").prototypes.array.push;

@@ -18,3 +21,3 @@ function isFunction(obj) {

function mirrorProperties(target, source) {
for (var prop in source) {
for (const prop in source) {
if (!hasOwnProperty(target, prop)) {

@@ -27,6 +30,6 @@ target[prop] = source[prop];

function getAccessor(object, property, method) {
var accessors = ["get", "set"];
var descriptor = getPropertyDescriptor(object, property);
const accessors = ["get", "set"];
const descriptor = getPropertyDescriptor(object, property);
for (var i = 0; i < accessors.length; i++) {
for (let i = 0; i < accessors.length; i++) {
if (

@@ -43,3 +46,3 @@ descriptor[accessors[i]] &&

// Cheap way to detect if we have ES5 support.
var hasES5Support = "keys" in Object;
const hasES5Support = "keys" in Object;

@@ -58,3 +61,3 @@ module.exports = function wrapMethod(object, property, method) {

function checkWrappedMethod(wrappedMethod) {
var error;
let error;

@@ -74,3 +77,3 @@ if (!isFunction(wrappedMethod)) {

} else if (wrappedMethod.calledBefore) {
var verb = wrappedMethod.returns ? "stubbed" : "spied on";
const verb = wrappedMethod.returns ? "stubbed" : "spied on";
error = new TypeError(

@@ -91,11 +94,5 @@ `Attempted to wrap ${valueToString(

var error,
wrappedMethods,
wrappedMethod,
i,
wrappedMethodDesc,
target,
accessor;
let error, wrappedMethod, i, wrappedMethodDesc, target, accessor;
wrappedMethods = [];
const wrappedMethods = [];

@@ -110,3 +107,3 @@ function simplePropertyAssignment() {

// Firefox has a problem when using hasOwn.call on objects from other frames.
var owned = object.hasOwnProperty
const owned = object.hasOwnProperty
? object.hasOwnProperty(property) // eslint-disable-line @sinonjs/no-prototype-methods/no-prototype-methods

@@ -116,3 +113,3 @@ : hasOwnProperty(object, property);

if (hasES5Support) {
var methodDesc =
const methodDesc =
typeof method === "function" ? { value: method } : method;

@@ -140,3 +137,3 @@ wrappedMethodDesc = getPropertyDescriptor(object, property);

var types = Object.keys(methodDesc);
const types = Object.keys(methodDesc);
for (i = 0; i < types.length; i++) {

@@ -152,2 +149,9 @@ wrappedMethod = wrappedMethodDesc[types[i]];

}
// you are not allowed to flip the configurable prop on an
// existing descriptor to anything but false (#2514)
if (!owned) {
methodDesc.configurable = true;
}
Object.defineProperty(object, property, methodDesc);

@@ -193,3 +197,3 @@

accessor = getAccessor(object, property, this.wrappedMethod);
var descriptor;
let descriptor;
// For prototype properties try to reset by delete first.

@@ -244,2 +248,7 @@ // If this fails (ex: localStorage on mobile safari) then force a reset

}
if (sinonType.get(object) === "stub-instance") {
// this is simply to avoid errors after restoring if something should
// traverse the object in a cleanup phase, ref #2477
object[property] = noop;
}
}

@@ -246,0 +255,0 @@

"use strict";
var extend = require("./core/extend");
var FakeTimers = require("@sinonjs/fake-timers");
var globalObject = require("@sinonjs/commons").global;
const extend = require("./core/extend");
const FakeTimers = require("@sinonjs/fake-timers");
const globalObject = require("@sinonjs/commons").global;
/**
*
* @param config
* @param globalCtx
*/
function createClock(config, globalCtx) {
var FakeTimersCtx = FakeTimers;
let FakeTimersCtx = FakeTimers;
if (globalCtx !== null && typeof globalCtx === "object") {
FakeTimersCtx = FakeTimers.withGlobal(globalCtx);
}
var clock = FakeTimersCtx.install(config);
const clock = FakeTimersCtx.install(config);
clock.restore = clock.uninstall;

@@ -17,4 +22,9 @@ return clock;

/**
*
* @param obj
* @param globalPropName
*/
function addIfDefined(obj, globalPropName) {
var globalProp = globalObject[globalPropName];
const globalProp = globalObject[globalPropName];
if (typeof globalProp !== "undefined") {

@@ -30,7 +40,7 @@ obj[globalPropName] = globalProp;

exports.useFakeTimers = function (dateOrConfig) {
var hasArguments = typeof dateOrConfig !== "undefined";
var argumentIsDateLike =
const hasArguments = typeof dateOrConfig !== "undefined";
const argumentIsDateLike =
(typeof dateOrConfig === "number" || dateOrConfig instanceof Date) &&
arguments.length === 1;
var argumentIsObject =
const argumentIsObject =
dateOrConfig !== null &&

@@ -53,4 +63,4 @@ typeof dateOrConfig === "object" &&

if (argumentIsObject) {
var config = extend.nonEnum({}, dateOrConfig);
var globalCtx = config.global;
const config = extend.nonEnum({}, dateOrConfig);
const globalCtx = config.global;
delete config.global;

@@ -71,3 +81,3 @@ return createClock(config, globalCtx);

var timers = {
const timers = {
setTimeout: setTimeout,

@@ -74,0 +84,0 @@ clearTimeout: clearTimeout,

@@ -18,3 +18,3 @@ {

],
"version": "15.0.0",
"version": "16.1.0",
"homepage": "https://sinonjs.org/",

@@ -48,5 +48,6 @@ "author": "Christian Johansen",

"build": "node ./build.cjs",
"dev-docs": "cd docs; cp -rl release-source releases/dev; npm run serve-docs",
"build-docs": "cd docs; bundle exec jekyll build",
"serve-docs": "cd docs; bundle exec jekyll serve --incremental --verbose",
"lint": "eslint '**/*.{js,cjs,mjs}'",
"serve-docs": "cd docs; bundle exec jekyll serve --incremental --verbose --livereload",
"lint": "eslint --max-warnings 101 '**/*.{js,cjs,mjs}'",
"unimported": "unimported .",

@@ -78,14 +79,14 @@ "pretest-webworker": "npm run build",

"dependencies": {
"@sinonjs/commons": "^2.0.0",
"@sinonjs/fake-timers": "^9.1.2",
"@sinonjs/samsam": "^7.0.1",
"diff": "^5.0.0",
"nise": "^5.1.2",
"@sinonjs/commons": "^3.0.0",
"@sinonjs/fake-timers": "^10.3.0",
"@sinonjs/samsam": "^8.0.0",
"diff": "^5.1.0",
"nise": "^5.1.4",
"supports-color": "^7.2.0"
},
"devDependencies": {
"@babel/core": "^7.16.12",
"@sinonjs/eslint-config": "^4.0.5",
"@babel/core": "^7.21.0",
"@sinonjs/eslint-config": "^4.0.6",
"@sinonjs/eslint-plugin-no-prototype-methods": "^0.1.1",
"@sinonjs/referee": "^9.1.1",
"@sinonjs/referee": "^10.0.0",
"@studio/changes": "^2.2.0",

@@ -95,18 +96,18 @@ "babel-plugin-istanbul": "^6.1.1",

"browserify": "^16.5.2",
"debug": "^4.3.1",
"debug": "^4.3.4",
"dependency-check": "^4.1.0",
"husky": "^6.0.0",
"lint-staged": "^12.3.2",
"mocha": "^9.2.0",
"mochify": "^9.1.0",
"lint-staged": "^13.2.0",
"mocha": "^10.2.0",
"mochify": "^9.2.0",
"nyc": "^15.1.0",
"prettier": "^2.5.1",
"prettier": "^2.8.4",
"proxyquire": "^2.1.3",
"proxyquire-universal": "^3.0.1",
"proxyquireify": "^3.2.1",
"puppeteer": "^13.1.2",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"shelljs": "^0.8.4",
"unimported": "^1.20.0"
"puppeteer": "^19.7.4",
"rimraf": "^4.4.0",
"semver": "^7.3.8",
"shelljs": "^0.8.5",
"unimported": "^1.26.0"
},

@@ -128,2 +129,3 @@ "files": [

".": {
"browser": "./pkg/sinon-esm.js",
"require": "./lib/sinon.js",

@@ -130,0 +132,0 @@ "import": "./pkg/sinon-esm.js"

@@ -15,4 +15,2 @@ <h1 align=center>

<a href="https://www.npmjs.com/package/sinon"><img src="https://img.shields.io/npm/v/sinon.svg?style=flat" alt="npm version"></a>
<a href="https://gitter.im/sinonjs/sinon?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/sinonjs/sinon"></a>
<a href="http://travis-ci.org/sinonjs/sinon"><img src="https://secure.travis-ci.org/sinonjs/sinon.svg?branch=master" alt="Build status"></a>
<a href="https://saucelabs.com/u/sinonjs"><img src="https://saucelabs.com/buildstatus/sinonjs" alt="Sauce Test Status"/></a>

@@ -70,34 +68,5 @@ <a href="https://codecov.io/gh/sinonjs/sinon"><img src="https://codecov.io/gh/sinonjs/sinon/branch/master/graph/badge.svg" alt="Codecov status"></a>

Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/sinon#backer)]
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/sinon#backer)]
<a href="https://opencollective.com/sinon/backer/0/website" target="_blank"><img src="https://opencollective.com/sinon/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/1/website" target="_blank"><img src="https://opencollective.com/sinon/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/2/website" target="_blank"><img src="https://opencollective.com/sinon/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/3/website" target="_blank"><img src="https://opencollective.com/sinon/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/4/website" target="_blank"><img src="https://opencollective.com/sinon/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/5/website" target="_blank"><img src="https://opencollective.com/sinon/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/6/website" target="_blank"><img src="https://opencollective.com/sinon/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/7/website" target="_blank"><img src="https://opencollective.com/sinon/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/8/website" target="_blank"><img src="https://opencollective.com/sinon/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/9/website" target="_blank"><img src="https://opencollective.com/sinon/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/10/website" target="_blank"><img src="https://opencollective.com/sinon/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/11/website" target="_blank"><img src="https://opencollective.com/sinon/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/12/website" target="_blank"><img src="https://opencollective.com/sinon/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/13/website" target="_blank"><img src="https://opencollective.com/sinon/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/14/website" target="_blank"><img src="https://opencollective.com/sinon/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/15/website" target="_blank"><img src="https://opencollective.com/sinon/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/16/website" target="_blank"><img src="https://opencollective.com/sinon/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/17/website" target="_blank"><img src="https://opencollective.com/sinon/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/18/website" target="_blank"><img src="https://opencollective.com/sinon/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/19/website" target="_blank"><img src="https://opencollective.com/sinon/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/20/website" target="_blank"><img src="https://opencollective.com/sinon/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/21/website" target="_blank"><img src="https://opencollective.com/sinon/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/22/website" target="_blank"><img src="https://opencollective.com/sinon/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/23/website" target="_blank"><img src="https://opencollective.com/sinon/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/24/website" target="_blank"><img src="https://opencollective.com/sinon/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/25/website" target="_blank"><img src="https://opencollective.com/sinon/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/26/website" target="_blank"><img src="https://opencollective.com/sinon/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/27/website" target="_blank"><img src="https://opencollective.com/sinon/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/28/website" target="_blank"><img src="https://opencollective.com/sinon/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/sinon/backer/29/website" target="_blank"><img src="https://opencollective.com/sinon/backer/29/avatar.svg"></a>
<a href="https://opencollective.com/sinon#backers" target="_blank"><img src="https://opencollective.com/sinon/backers.svg?width=890"></a>

@@ -119,21 +88,2 @@ ## Sponsors

<a href="https://opencollective.com/sinon/sponsor/10/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/11/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/12/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/13/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/14/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/15/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/16/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/17/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/18/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/19/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/20/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/21/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/22/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/23/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/24/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/25/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/26/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/27/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/28/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/sinon/sponsor/29/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/29/avatar.svg"></a>

@@ -140,0 +90,0 @@ ## Licence

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

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc