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

sinon-spy-utils

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinon-spy-utils - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

105

lib/index.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,39 +6,18 @@ Object.defineProperty(exports, "__esModule", {

});
exports.SpyAndDo = exports.StubAndDo = exports.Mock = undefined;
exports.SpyAndDo = exports.StubAndDo = exports.Mock = void 0;
var _sinon = require('sinon');
var _sinon = _interopRequireDefault(require("sinon"));
var _sinon2 = _interopRequireDefault(_sinon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Mock = exports.Mock = function Mock() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
var Mock = function Mock() {
var obj = {};
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
var obj = {};
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = funcs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var func = _step.value;
obj[func] = _sinon2.default.stub();
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
for (var _i = 0; _i < funcs.length; _i++) {
var func = funcs[_i];
obj[func] = _sinon.default.stub();
}

@@ -49,2 +28,4 @@

exports.Mock = Mock;
var XXXAndDo = function XXXAndDo(sinonFunc, object, rest) {

@@ -54,23 +35,22 @@ var methods = rest.slice(0, rest.length - 1),

var results = {};
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator2 = methods[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _method = _step2.value;
results[_method] = _sinon2.default[sinonFunc](object, _method);
for (var _iterator = methods[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _method = _step.value;
results[_method] = _sinon.default[sinonFunc](object, _method);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
if (_didIteratorError) {
throw _iteratorError;
}

@@ -83,23 +63,22 @@ }

} finally {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator3 = methods[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var method = _step3.value;
for (var _iterator2 = methods[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var method = _step2.value;
results[method].restore();
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
if (_didIteratorError2) {
throw _iteratorError2;
}

@@ -111,4 +90,4 @@ }

var StubAndDo = exports.StubAndDo = function StubAndDo(object) {
for (var _len2 = arguments.length, rest = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
var StubAndDo = function StubAndDo(object) {
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
rest[_key2 - 1] = arguments[_key2];

@@ -120,4 +99,6 @@ }

var SpyAndDo = exports.SpyAndDo = function SpyAndDo(object) {
for (var _len3 = arguments.length, rest = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
exports.StubAndDo = StubAndDo;
var SpyAndDo = function SpyAndDo(object) {
for (var _len3 = arguments.length, rest = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
rest[_key3 - 1] = arguments[_key3];

@@ -127,2 +108,4 @@ }

XXXAndDo('spy', object, rest);
};
};
exports.SpyAndDo = SpyAndDo;
{
"name": "sinon-spy-utils",
"version": "1.0.2",
"description": "Utils functions for Sinon Spies and Stubs",
"version": "1.0.3",
"description": "Utility functions for Sinon Spies and Stubs",
"author": "Louis Brunner <louis.brunner.fr@gmail.com> (https://github.com/LouisBrunner)",

@@ -19,9 +19,10 @@ "license": "MIT",

"build:lib": "babel src --out-dir lib --ignore _spec.js",
"build:dist": "webpack",
"build:dist": "webpack --mode production",
"build": "npm run build:lib && npm run build:dist",
"lint": "eslint .",
"test": "NODE_ENV=test NODE_PATH=$NODE_PATH:$PWD/src nyc mocha --opts ./.mocha.opts",
"test:watch": "watch-run -i -p 'src/**/*' npm run test",
"travis-test": "NODE_ENV=test NODE_PATH=$NODE_PATH:$PWD/src nyc --reporter=lcov mocha --opts ./.mocha.opts",
"travis-coverage": "cat ./coverage/lcov.info | coveralls",
"test": "jest --config jest.config.js",
"test:watch": "npm run test -- --watch",
"travis:test": "CI=yes npm run test",
"travis:coverage": "cat ./coverage/lcov.info | coveralls",
"prepush": "npm run lint && npm run test && npm run build:dist",
"prepare": "npm run clean && npm run lint && npm run test && npm run build:lib"

@@ -38,23 +39,19 @@ },

"dependencies": {
"sinon": "^2.1.0"
"sinon": "^7.2.6"
},
"devDependencies": {
"babel-cli": "^6.24.0",
"babel-eslint": "^7.2.0",
"babel-loader": "^6.4.1",
"babel-plugin-istanbul": "^4.0.0",
"babel-preset-es2015": "^6.24.0",
"babel-register": "^6.24.0",
"chai": "^3.5.0",
"coveralls": "^2.12.0",
"eslint": "^3.18.0",
"eslint-loader": "^1.6.3",
"mocha": "^3.2.0",
"nyc": "^10.1.2",
"sinon-chai": "^2.9.0",
"watch-run": "^1.2.5",
"webpack": "^2.3.1",
"webpack-dev-server": "^2.4.2",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.1.0",
"babel-loader": "^8.0.5",
"coveralls": "^3.0.3",
"eslint": "^5.15.0",
"eslint-loader": "^2.1.2",
"jest": "^24.1.0",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3",
"webpack-merge": "^4.1.0"
}
}

Sorry, the diff of this file is not supported yet

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