sinon-spy-utils
Advanced tools
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13
10027
4
85
+ Added@sinonjs/commons@1.8.6(transitive)
+ Added@sinonjs/formatio@3.2.2(transitive)
+ Added@sinonjs/samsam@3.3.3(transitive)
+ Added@sinonjs/text-encoding@0.7.3(transitive)
+ Addedarray-from@2.1.1(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedjust-extend@4.2.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlolex@4.2.05.1.2(transitive)
+ Addednise@1.5.3(transitive)
+ Addedsinon@7.5.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedtype-detect@4.0.8(transitive)
- Removedformatio@1.2.0(transitive)
- Removedlolex@1.6.0(transitive)
- Removednative-promise-only@0.8.1(transitive)
- Removedsamsam@1.3.0(transitive)
- Removedsinon@2.4.1(transitive)
- Removedtext-encoding@0.6.4(transitive)
- Removedtype-detect@4.1.0(transitive)
Updatedsinon@^7.2.6