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

auto-release-sinon

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-release-sinon - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

52

autoReleaseSinon.js
function keys(obj) {
// non-itterables will throw here, but checking
// typeof === "object" skips things like functions
try { return Object.keys(obj); }
catch (e) { return []; }
}
function own(obj, fn) {
var keys;
try { keys = Object.keys(obj); } catch (e) {} // non-itterables will throw here
(keys || []).forEach(function (k) {
keys(obj).forEach(function (k) {
fn(obj[k], k, obj);

@@ -10,21 +15,24 @@ });

module.exports = function hook(sinon, afterEach) {
var toWrap = {
stub: null,
spy: null,
useFakeTimers: function (clock) {
// timeouts are indexed by their id in an array,
// the holes make the .length property "wrong"
clock.timeoutCount = function () {
return clock.timeoutList().length;
};
var toRestore = [];
var toWrap = {
stub: null,
spy: null,
useFakeTimers: function (clock) {
// timeouts are indexed by their id in an array,
// the holes make the .length property "wrong"
clock.timeoutCount = function () {
return clock.timeoutList().length;
};
clock.timeoutList = function () {
return clock.timeouts ? clock.timeouts.filter(Boolean) : [];
};
}
};
clock.timeoutList = function () {
return clock.timeouts ? clock.timeouts.filter(Boolean) : [];
};
}
};
function setupAutoRelease(actualSinon, afterEach) {
var sinon = module.exports = Object.create(actualSinon);
sinon.setupAutoRelease = setupAutoRelease;
var toRestore = [];
own(toWrap, function (modify, method) {

@@ -56,2 +64,6 @@ var orig = sinon[method];

return sinon;
};
}
module.exports = {
setupAutoRelease: setupAutoRelease
};
{
"name": "auto-release-sinon",
"version": "1.0.2",
"version": "1.0.3",
"description": "Basic sinon wrapper that automatically releases it's stubs, works with mocha's BDD interface",

@@ -5,0 +5,0 @@ "main": "autoReleaseSinon.js",

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