New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sinon-test

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinon-test - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

191

dist/sinon-test.js

@@ -1,1 +0,190 @@

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):n.sinonTest=e()}(this,function(){"use strict";function n(n){return void 0===n.createSandbox&&!!n.sandbox&&"object"==typeof n.sandbox&&"function"==typeof n.sandbox.create}function e(n,e,t){if(e){if(n.restore(),t)return;throw e}n.verifyAndRestore()}function t(n,t){return t&&c.isPromise(t)?t.then(function(t){return e(n),t},function(t){e(n,t||Error("Promise rejected with no/falsy error"))}):(e(n),t)}function o(n,o,r){if(o&&c.isPromise(o)){if(!r)return void t(n,o);e(n,Error("Your test should take a callback *or* return a promise. It should not do both."))}r||e(n)}function r(n,r){function i(n,t,o,i){(r=f(r)).injectInto=r.injectIntoThis&&n||r.injectInto;var c,s=u(r),a=t.length&&t[t.length-1];"function"==typeof a&&(t[t.length-1]=function(n){e(s,n,!0),a(n)});try{c=o.apply(n,t.concat(s.args))}catch(n){e(s,n)}return i(s,c,"function"==typeof a)}if(!c.isSinon(n))throw new TypeError("expected sinon object");var u=n.createSandbox||n.sandbox.create;return function(n){var e=typeof n;if("function"!==e)throw new TypeError("sinon.test needs to wrap a test function, got "+e);return n.length?function(e){return i(this,s.call(arguments),n,o)}:function(){return i(this,s.call(arguments),n,t)}}}function i(n,e){return a.configure(n,e)}var c={isPromise:function(n){return"object"==typeof n&&"function"==typeof n.then},isSinon:function(e){return!!e&&"object"==typeof e&&(n(e)||"function"==typeof e.createSandbox)}},u={injectIntoThis:!0,injectInto:null,properties:["spy","stub","mock","clock","server","requests"],useFakeTimers:!0,useFakeServer:!0},f=function(n){var e,t={};n=n||{};for(e in u)u.hasOwnProperty(e)&&(t[e]=n.hasOwnProperty(e)?n[e]:u[e]);return t},s=Array.prototype.slice,a={configure:r};return i.configureTest=function(n,e){return console.log("sinonTest.configureTest is deprecated and will be removed from the public API in a future version of sinon-test"),a.configure(n,e)},i});
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.sinonTest = factory());
}(this, (function () { 'use strict';
/**
* Internal utilities for sinon-test
*
* @author Christian Johansen (christian@cjohansen.no)
* @license BSD
*
* Copyright (c) 2010-2013 Christian Johansen
*/
/**
* From version 3.1 Sinon uses factory methods for sandboxes and deprecates
* sinon.sandbox. It - and its exports - will in time be removed/internalized, but
* we can still support backwards compatibility easily.
* See Sinon pull request #1515
*/
function isOlderSinonVersion(sinonObj) {
return typeof sinonObj.createSandbox === "undefined"
&& !!sinonObj.sandbox
&& typeof sinonObj.sandbox === "object"
&& typeof sinonObj.sandbox.create === "function";
}
var isPromise = function (object) {
return typeof object === "object" && typeof object.then === "function";
};
var isSinon = function (obj) {
return !!obj && typeof obj === "object"
&& (isOlderSinonVersion(obj) || typeof obj.createSandbox === "function");
};
var utils = {
isPromise: isPromise,
isSinon: isSinon
};
var defaultConfig = {
injectIntoThis: true,
injectInto: null,
properties: ["spy", "stub", "mock", "clock", "server", "requests"],
useFakeTimers: true,
useFakeServer: true
};
var getConfig = function getConfig(custom) {
var config = {};
var prop;
custom = custom || {};
for (prop in defaultConfig) {
if (defaultConfig.hasOwnProperty(prop)) {
config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaultConfig[prop];
}
}
return config;
};
var slice = Array.prototype.slice;
function finish(sandbox, error, dontThrow) {
if (error) {
sandbox.restore();
if (dontThrow) {
return;
}
throw error;
}
sandbox.verifyAndRestore();
}
function handleFn(sandbox, result) {
if (result && utils.isPromise(result)) {
return result.then(
function sinonHandlePromiseResolve(value) {
finish(sandbox);
return value;
},
function sinonHandlePromiseReject(error) {
finish(
sandbox,
error || new Error("Promise rejected with no/falsy error")
);
}
);
}
finish(sandbox);
return result;
}
function handleAsyncFn(sandbox, result, isAsync) {
if (result && utils.isPromise(result)) {
if (!isAsync) { // # issue #75
handleFn(sandbox, result);
return;
}
finish(sandbox, new Error(
"Your test should take a callback *or* return a promise. "
+ "It should not do both."
));
}
// the function had an arity of 1 or more, but it was not passed a callback
if (!isAsync) {
finish(sandbox);
}
return;
}
function configure(sinon, config) {
if (!utils.isSinon(sinon)) {
throw new TypeError("expected sinon object");
}
var sandboxFactory = sinon.createSandbox || sinon.sandbox.create;
function callSandboxedFn(context, args, fn, handler) {
config = getConfig(config);
config.injectInto = config.injectIntoThis && context || config.injectInto;
var sandbox = sandboxFactory(config);
var done = args.length && args[args.length - 1];
var result;
if (typeof done === "function") {
args[args.length - 1] = function sinonDone(error) {
finish(sandbox, error, true);
done(error);
};
}
try {
result = fn.apply(context, args.concat(sandbox.args));
} catch (e) {
finish(sandbox, e);
}
return handler(sandbox, result, typeof done === "function");
}
return function test(callback) {
var type = typeof callback;
if (type !== "function") {
throw new TypeError("sinon.test needs to wrap a test function, got " + type);
}
return callback.length
? function sinonAsyncSandboxedTest(_) { // eslint-disable-line no-unused-vars
return callSandboxedFn(this, slice.call(arguments), callback, handleAsyncFn);
}
: function sinonSandboxedTest() {
return callSandboxedFn(this, slice.call(arguments), callback, handleFn);
}
;
};
}
var configure_1 = configure;
var test = {
configure: configure_1
};
function sinonTest(sinon, config) {
return test.configure(sinon, config);
}
sinonTest.configureTest = function (sinon, config) {
console.log("sinonTest.configureTest is deprecated and will be removed from the public API in a future version of sinon-test"); // eslint-disable-line
return test.configure(sinon, config);
};
var lib = sinonTest;
return lib;
})));
2.1.4 / 2018-05-25
==================
* Update all dependencies
* Support Sinon 5
2.1.3 / 2018-01-29

@@ -3,0 +9,0 @@ ==================

35

package.json
{
"name": "sinon-test",
"version": "2.1.3",
"version": "2.1.4",
"description": "",

@@ -8,3 +8,3 @@ "main": "lib/index.js",

"build": "run-s build:dist-folder build:bundle",
"build:bundle": "rollup -c | uglifyjs --mangle --compress if_return,dead_code,unsafe,unsafe_comps,join_vars,comparisons,loops,collapse_vars,pure_getters > dist/sinon-test.js",
"build:bundle": "rollup -c > dist/sinon-test.js",
"build:dist-folder": "mkdirp dist",

@@ -36,21 +36,20 @@ "coverage": "nyc report --reporter text-lcov | coveralls",

"devDependencies": {
"es6-promise": "4.0.5",
"eslint": "4.16.0",
"eslint-config-sinon": "1.0.3",
"eslint-plugin-ie11": "1.0.0",
"mkdirp": "0.5.1",
"mocha": "3.4.1",
"npm-run-all": "4.0.2",
"nyc": "10.1.2",
"phantomjs-prebuilt": "2.1.7",
"pre-commit": "1.1.2",
"referee": "1.2.0",
"rollup": "0.41.4",
"rollup-plugin-commonjs": "8.0.2",
"sinon": "4.x.x",
"uglify-js": "3.0.7"
"@sinonjs/referee": "^2.1.1",
"es6-promise": "^4.2.4",
"eslint": "^4.19.1",
"eslint-config-sinon": "^1.0.3",
"eslint-plugin-ie11": "^1.0.0",
"mkdirp": "^0.5.1",
"mocha": "^5.2.0",
"npm-run-all": "^4.1.3",
"nyc": "^10.3.2",
"phantomjs-prebuilt": "^2.1.16",
"pre-commit": "^1.2.2",
"rollup": "^0.41.6",
"rollup-plugin-commonjs": "^8.4.1",
"sinon": "^5.0.10"
},
"peerDependencies": {
"sinon": "2.x - 4.x"
"sinon": "2.x - 5.x"
}
}
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