@xpbytes/moxie
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -1,2 +0,2 @@ | ||
var t=function(t){function e(e){t.call(this,e),t.captureStackTrace(this,this.constructor)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),e=function(t){function e(e){t.call(this,e),t.captureStackTrace(this,this.constructor)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),r=function(){this.expected_calls={},this.actual_calls={}};r.prototype.__print=function(t){return JSON.stringify(t)},r.prototype.expect=function(e,r,n,o){if(void 0===n&&(n=[]),void 0===o&&(o=void 0),o instanceof Function){if(n&&(!Array.isArray(n)||n.length>0))throw new t("args ignored when predicate is given (args: "+this.__print(n)+")");return this.expected_calls[e]=this.expected_calls[e]||[],void this.expected_calls[e].push({retval:r,predicate:o})}if(!Array.isArray(n))throw new t("args must be an array");this.expected_calls[e]=this.expected_calls[e]||[],this.expected_calls[e].push({retval:r,args:n})},r.prototype.verify=function(){var t=this;return Object.keys(this.expected_calls).forEach(function(r){var n=t.expected_calls[r],o=t.actual_calls[r];if(!o)throw new e("expected "+t.__print_call(r,n[0]));if(o.length<n.length)throw new e("expected "+t.__print_call(r,n[o.size])+", got ["+t.__print_call(r,o)+"]")}),!0},r.prototype.clear=function(){this.reset()},r.prototype.reset=function(){this.expected_calls={},this.actual_calls={}},r.prototype.__print_call=function(t,e){var r=this;return Array.isArray(e)?e.map(function(e){return r.__call(t,e)}).join(", "):t+"("+(e.args||[]).join(", ")+") => "+typeof e.retval+" ("+e.retval+")"},r.prototype.__compare=function(t){return t[0]===t[1]},r.prototype.then=function(){return this},r.prototype.__call=function(t){for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];var o=this.actual_calls[t]=this.actual_calls[t]||[],c=o.length,i=(this.expected_calls[t]||[])[c];if(!i)throw new e("No more (>= "+c+") expects available for "+t+": "+this.__print(r)+" ("+this.__print(this)+")");var a=i.args,p=i.retval,l=i.predicate;if(l){if(o.push(i),!l.apply(void 0,r))throw new e("mocked method "+t+" failed predicate w/ "+this.__print(r));return p}if(a.length!==r.length)throw new e("mocked method "+t+" expects "+a.length+", got "+r.length);if(!a.map(function(t,e){return[t,r[e]]}).every(this.__compare))throw new e("mocked method "+t+" called with unexpected arguments "+this.__print(r)+", expected "+this.__print(a));return o.push({retval:p,args:r}),p};var n=[Symbol("util.inspect.custom").toString(),Symbol.toStringTag.toString(),"inspect","valueOf","$$typeof"].concat(Object.getOwnPropertyNames(Object.prototype)).concat(Object.getOwnPropertyNames(r.prototype)),o={get:function(t,e){if(t.hasOwnProperty(e)||t[e])return t[e];if(t.expected_calls[e])return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return t.__call.apply(t,[e].concat(r))};var r=e.toString();if(-1!==n.indexOf(r)||"symbol"==typeof e)return t[e];var o=Object.keys(t.expected_calls)||["<nothing>"];throw new Error("unmocked method "+r+", expected one of "+t.__print(o))}};module.exports=function(){return new Proxy(new r,o)}; | ||
var t=function(t){function e(e){t.call(this,e),t.captureStackTrace(this,this.constructor)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),e=function(t){function e(e){t.call(this,e),t.captureStackTrace(this,this.constructor)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),r=function(){this.expected_calls={},this.actual_calls={}};r.prototype.__print=function(t){return JSON.stringify(t)},r.prototype.expect=function(e,r,n,o){if(void 0===n&&(n=[]),void 0===o&&(o=void 0),o instanceof Function){if(n&&(!Array.isArray(n)||n.length>0))throw new t("args ignored when predicate is given (args: "+this.__print(n)+")");return this.expected_calls[e]=this.expected_calls[e]||[],void this.expected_calls[e].push({retval:r,predicate:o})}if(!Array.isArray(n))throw new t("args must be an array");this.expected_calls[e]=this.expected_calls[e]||[],this.expected_calls[e].push({retval:r,args:n})},r.prototype.verify=function(){var t=this;return Object.keys(this.expected_calls).forEach(function(r){var n=t.expected_calls[r],o=t.actual_calls[r];if(!o)throw new e("expected "+t.__print_call(r,n[0]));if(o.length<n.length)throw new e("expected "+t.__print_call(r,n[o.length])+", got ["+t.__print_call(r,o)+"]")}),!0},r.prototype.clear=function(){this.reset()},r.prototype.reset=function(){this.expected_calls={},this.actual_calls={}},r.prototype.__print_call=function(t,e){var r=this;return Array.isArray(e)?e.map(function(e){return r.__call(t,e)}).join(", "):t+"("+(e.args||[]).join(", ")+") => "+typeof e.retval+" ("+e.retval+")"},r.prototype.__compare=function(t){return t[0]===t[1]},r.prototype.then=function(){return this},r.prototype.__call=function(t){for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];var o=this.actual_calls[t]=this.actual_calls[t]||[],c=o.length,i=(this.expected_calls[t]||[])[c];if(!i)throw new e("No more (>= "+c+") expects available for "+t+": "+this.__print(r)+" ("+this.__print(this)+")");var a=i.args,p=i.retval,l=i.predicate;if(l){if(o.push(i),!l.apply(void 0,r))throw new e("mocked method "+t+" failed predicate w/ "+this.__print(r));return p}if(a.length!==r.length)throw new e("mocked method "+t+" expects "+a.length+", got "+r.length);if(!a.map(function(t,e){return[t,r[e]]}).every(this.__compare))throw new e("mocked method "+t+" called with unexpected arguments "+this.__print(r)+", expected "+this.__print(a));return o.push({retval:p,args:r}),p};var n=[Symbol("util.inspect.custom").toString(),Symbol.toStringTag.toString(),"inspect","valueOf","$$typeof"].concat(Object.getOwnPropertyNames(Object.prototype)).concat(Object.getOwnPropertyNames(r.prototype)),o={get:function(t,e){if(t.hasOwnProperty(e)||t[e])return t[e];if(t.expected_calls[e])return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return t.__call.apply(t,[e].concat(r))};var r=e.toString();if(-1!==n.indexOf(r)||"symbol"==typeof e)return t[e];var o=Object.keys(t.expected_calls)||["<nothing>"];throw new Error("unmocked method "+r+", expected one of "+t.__print(o))}};module.exports=function(){return new Proxy(new r,o)}; | ||
//# sourceMappingURL=moxie.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.moxie=e()}(this,function(){var t=function(t){function e(e){t.call(this,e),t.captureStackTrace(this,this.constructor)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),e=function(t){function e(e){t.call(this,e),t.captureStackTrace(this,this.constructor)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),r=function(){this.expected_calls={},this.actual_calls={}};r.prototype.__print=function(t){return JSON.stringify(t)},r.prototype.expect=function(e,r,n,o){if(void 0===n&&(n=[]),void 0===o&&(o=void 0),o instanceof Function){if(n&&(!Array.isArray(n)||n.length>0))throw new t("args ignored when predicate is given (args: "+this.__print(n)+")");return this.expected_calls[e]=this.expected_calls[e]||[],void this.expected_calls[e].push({retval:r,predicate:o})}if(!Array.isArray(n))throw new t("args must be an array");this.expected_calls[e]=this.expected_calls[e]||[],this.expected_calls[e].push({retval:r,args:n})},r.prototype.verify=function(){var t=this;return Object.keys(this.expected_calls).forEach(function(r){var n=t.expected_calls[r],o=t.actual_calls[r];if(!o)throw new e("expected "+t.__print_call(r,n[0]));if(o.length<n.length)throw new e("expected "+t.__print_call(r,n[o.size])+", got ["+t.__print_call(r,o)+"]")}),!0},r.prototype.clear=function(){this.reset()},r.prototype.reset=function(){this.expected_calls={},this.actual_calls={}},r.prototype.__print_call=function(t,e){var r=this;return Array.isArray(e)?e.map(function(e){return r.__call(t,e)}).join(", "):t+"("+(e.args||[]).join(", ")+") => "+typeof e.retval+" ("+e.retval+")"},r.prototype.__compare=function(t){return t[0]===t[1]},r.prototype.then=function(){return this},r.prototype.__call=function(t){for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];var o=this.actual_calls[t]=this.actual_calls[t]||[],c=o.length,i=(this.expected_calls[t]||[])[c];if(!i)throw new e("No more (>= "+c+") expects available for "+t+": "+this.__print(r)+" ("+this.__print(this)+")");var a=i.args,p=i.retval,l=i.predicate;if(l){if(o.push(i),!l.apply(void 0,r))throw new e("mocked method "+t+" failed predicate w/ "+this.__print(r));return p}if(a.length!==r.length)throw new e("mocked method "+t+" expects "+a.length+", got "+r.length);if(!a.map(function(t,e){return[t,r[e]]}).every(this.__compare))throw new e("mocked method "+t+" called with unexpected arguments "+this.__print(r)+", expected "+this.__print(a));return o.push({retval:p,args:r}),p};var n=[Symbol("util.inspect.custom").toString(),Symbol.toStringTag.toString(),"inspect","valueOf","$$typeof"].concat(Object.getOwnPropertyNames(Object.prototype)).concat(Object.getOwnPropertyNames(r.prototype)),o={get:function(t,e){if(t.hasOwnProperty(e)||t[e])return t[e];if(t.expected_calls[e])return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return t.__call.apply(t,[e].concat(r))};var r=e.toString();if(-1!==n.indexOf(r)||"symbol"==typeof e)return t[e];var o=Object.keys(t.expected_calls)||["<nothing>"];throw new Error("unmocked method "+r+", expected one of "+t.__print(o))}};return function(){return new Proxy(new r,o)}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.moxie=e()}(this,function(){var t=function(t){function e(e){t.call(this,e),t.captureStackTrace(this,this.constructor)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),e=function(t){function e(e){t.call(this,e),t.captureStackTrace(this,this.constructor)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),r=function(){this.expected_calls={},this.actual_calls={}};r.prototype.__print=function(t){return JSON.stringify(t)},r.prototype.expect=function(e,r,n,o){if(void 0===n&&(n=[]),void 0===o&&(o=void 0),o instanceof Function){if(n&&(!Array.isArray(n)||n.length>0))throw new t("args ignored when predicate is given (args: "+this.__print(n)+")");return this.expected_calls[e]=this.expected_calls[e]||[],void this.expected_calls[e].push({retval:r,predicate:o})}if(!Array.isArray(n))throw new t("args must be an array");this.expected_calls[e]=this.expected_calls[e]||[],this.expected_calls[e].push({retval:r,args:n})},r.prototype.verify=function(){var t=this;return Object.keys(this.expected_calls).forEach(function(r){var n=t.expected_calls[r],o=t.actual_calls[r];if(!o)throw new e("expected "+t.__print_call(r,n[0]));if(o.length<n.length)throw new e("expected "+t.__print_call(r,n[o.length])+", got ["+t.__print_call(r,o)+"]")}),!0},r.prototype.clear=function(){this.reset()},r.prototype.reset=function(){this.expected_calls={},this.actual_calls={}},r.prototype.__print_call=function(t,e){var r=this;return Array.isArray(e)?e.map(function(e){return r.__call(t,e)}).join(", "):t+"("+(e.args||[]).join(", ")+") => "+typeof e.retval+" ("+e.retval+")"},r.prototype.__compare=function(t){return t[0]===t[1]},r.prototype.then=function(){return this},r.prototype.__call=function(t){for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];var o=this.actual_calls[t]=this.actual_calls[t]||[],c=o.length,i=(this.expected_calls[t]||[])[c];if(!i)throw new e("No more (>= "+c+") expects available for "+t+": "+this.__print(r)+" ("+this.__print(this)+")");var a=i.args,p=i.retval,l=i.predicate;if(l){if(o.push(i),!l.apply(void 0,r))throw new e("mocked method "+t+" failed predicate w/ "+this.__print(r));return p}if(a.length!==r.length)throw new e("mocked method "+t+" expects "+a.length+", got "+r.length);if(!a.map(function(t,e){return[t,r[e]]}).every(this.__compare))throw new e("mocked method "+t+" called with unexpected arguments "+this.__print(r)+", expected "+this.__print(a));return o.push({retval:p,args:r}),p};var n=[Symbol("util.inspect.custom").toString(),Symbol.toStringTag.toString(),"inspect","valueOf","$$typeof"].concat(Object.getOwnPropertyNames(Object.prototype)).concat(Object.getOwnPropertyNames(r.prototype)),o={get:function(t,e){if(t.hasOwnProperty(e)||t[e])return t[e];if(t.expected_calls[e])return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return t.__call.apply(t,[e].concat(r))};var r=e.toString();if(-1!==n.indexOf(r)||"symbol"==typeof e)return t[e];var o=Object.keys(t.expected_calls)||["<nothing>"];throw new Error("unmocked method "+r+", expected one of "+t.__print(o))}};return function(){return new Proxy(new r,o)}}); | ||
//# sourceMappingURL=moxie.umd.js.map |
{ | ||
"name": "@xpbytes/moxie", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Proxy based mock for node and v8", | ||
@@ -8,3 +8,3 @@ "main": "dist/moxie.js", | ||
"module": "dist/moxie.mjs", | ||
"source": "moxie.js", | ||
"source": "moxie.ts", | ||
"repository": "https://xpbytes.com/moxie", | ||
@@ -17,3 +17,3 @@ "author": "Derk-Jan Karrenbeld <derk-jan@xpbytes.com>", | ||
"/dist", | ||
"moxie.js" | ||
"moxie.ts" | ||
], | ||
@@ -23,3 +23,5 @@ "scripts": { | ||
"dev": "microbundle watch", | ||
"test": "ava" | ||
"pretest": "yarn build", | ||
"test": "ava", | ||
"prepublish": "rimraf dist && yarn test" | ||
}, | ||
@@ -29,3 +31,4 @@ "devDependencies": { | ||
"esm": "^3.2.4", | ||
"microbundle": "^0.9.0" | ||
"microbundle": "^0.9.0", | ||
"rimraf": "^2.6.3" | ||
}, | ||
@@ -32,0 +35,0 @@ "ava": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
53330
11
351
4
1