Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createSandbox: createSandbox,
assert: require("./sinon/assert"),
match: require("@sinonjs/samsam").createMatcher,
restoreObject: require("./sinon/restore-object"),
spyCall: require("./sinon/proxy-call"),
expectation: require("./sinon/mock-expectation"),
defaultConfig: require("./sinon/util/core/default-config"),
setFormatter: format.setFormatter,
// fake timers
timers: fakeTimers.timers,
// fake XHR
xhr: nise.fakeXhr.xhr,
FakeXMLHttpRequest: nise.fakeXhr.FakeXMLHttpRequest,
// fake server
fakeServer: nise.fakeServer,
fakeServerWithClock: nise.fakeServerWithClock,
createFakeServer: nise.fakeServer.create.bind(nise.fakeServer),
createFakeServerWithClock: nise.fakeServerWithClock.create.bind(nise.fakeServerWithClock),
addBehavior: function(name, fn) {
behavior.addBehavior(stub, name, fn);
}
};
var legacySandboxAPI = {
sandbox: {
create: deprecated.wrap(
createSandbox: createSandbox,
assert: require("./sinon/assert"),
match: require("@sinonjs/samsam").createMatcher,
restoreObject: require("./sinon/restore-object"),
expectation: require("./sinon/mock-expectation"),
defaultConfig: require("./sinon/util/core/default-config"),
setFormatter: format.setFormatter,
// fake timers
timers: fakeTimers.timers,
// fake XHR
xhr: nise.fakeXhr.xhr,
FakeXMLHttpRequest: nise.fakeXhr.FakeXMLHttpRequest,
// fake server
fakeServer: nise.fakeServer,
fakeServerWithClock: nise.fakeServerWithClock,
createFakeServer: nise.fakeServer.create.bind(nise.fakeServer),
createFakeServerWithClock: nise.fakeServerWithClock.create.bind(nise.fakeServerWithClock),
addBehavior: function(name, fn) {
behavior.addBehavior(stub, name, fn);
}
};
var sandbox = new Sandbox();
var api = extend(sandbox, apiMethods);
var apiMethods = {
createSandbox: createSandbox,
assert: require("./sinon/assert"),
match: require("@sinonjs/samsam").createMatcher,
restoreObject: require("./sinon/restore-object"),
expectation: require("./sinon/mock-expectation"),
defaultConfig: require("./sinon/util/core/default-config"),
setFormatter: format.setFormatter,
// fake timers
timers: fakeTimers.timers,
// fake XHR
xhr: nise.fakeXhr.xhr,
FakeXMLHttpRequest: nise.fakeXhr.FakeXMLHttpRequest,
// fake server
fakeServer: nise.fakeServer,
fakeServerWithClock: nise.fakeServerWithClock,
createFakeServer: nise.fakeServer.create.bind(nise.fakeServer),
createFakeServerWithClock: nise.fakeServerWithClock.create.bind(nise.fakeServerWithClock),
addBehavior: function(name, fn) {
behavior.addBehavior(stub, name, fn);
}
};
var sandbox = new Sandbox();
var api = extend(sandbox, apiMethods);
assert: require("./sinon/assert"),
match: require("@sinonjs/samsam").createMatcher,
restoreObject: require("./sinon/restore-object"),
spyCall: require("./sinon/proxy-call"),
expectation: require("./sinon/mock-expectation"),
defaultConfig: require("./sinon/util/core/default-config"),
setFormatter: format.setFormatter,
// fake timers
timers: fakeTimers.timers,
// fake XHR
xhr: nise.fakeXhr.xhr,
FakeXMLHttpRequest: nise.fakeXhr.FakeXMLHttpRequest,
// fake server
fakeServer: nise.fakeServer,
fakeServerWithClock: nise.fakeServerWithClock,
createFakeServer: nise.fakeServer.create.bind(nise.fakeServer),
createFakeServerWithClock: nise.fakeServerWithClock.create.bind(nise.fakeServerWithClock),
addBehavior: function(name, fn) {
behavior.addBehavior(stub, name, fn);
}
};
var legacySandboxAPI = {
sandbox: {
create: deprecated.wrap(
createSandbox,
var arrayProto = require("@sinonjs/commons").prototypes.array;
var collectOwnMethods = require("./collect-own-methods");
var getPropertyDescriptor = require("./util/core/get-property-descriptor");
var isEsModule = require("./util/core/is-es-module");
var isPropertyConfigurable = require("./util/core/is-property-configurable");
var isNonExistentOwnProperty = require("./util/core/is-non-existent-own-property");
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");
var filter = arrayProto.filter;
var forEach = arrayProto.filter;
var push = arrayProto.push;
var reverse = arrayProto.reverse;
function applyOnEach(fakes, method) {
var matchingFakes = filter(fakes, function(fake) {
return typeof fake[method] === "function";
});
forEach(matchingFakes, function(fake) {
fake[method]();
});
}