@xpbytes/moxie
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -7,8 +7,2 @@ declare type Predicate = (...args: any[]) => boolean; | ||
}; | ||
/** | ||
* @property {{ [P: string]: MockedCall[] }} expected_calls expected calls | ||
* @property {{ [P: string]: MockedCall[] }} actual_calls actual calls | ||
* | ||
* @class Mock | ||
*/ | ||
declare class Mock { | ||
@@ -22,69 +16,10 @@ expected_calls: { | ||
constructor(); | ||
/** | ||
* Helper to stringify the input args | ||
* | ||
* @param {any} args | ||
* @returns {string} | ||
* @memberof Mock | ||
*/ | ||
__print(args: any): string; | ||
/** | ||
* Mock a call to a method | ||
* | ||
* @param {string} name the method name | ||
* @param {any} retval the desired return value | ||
* @param {any[]} [args=[]] the expected arguments, or an empty array if predicate is given | ||
* @param {Predicate|undefined} [predicate=undefined] function to call with the arguments to test a match | ||
* @memberof Mock | ||
*/ | ||
expect(name: string, retval: any, args?: any[], predicate?: Predicate): void; | ||
/** | ||
* Verifies that all expected calls have actually been called | ||
* | ||
* @memberof Mock | ||
* @throws {Error} if an expected call has not been registered | ||
* @returns {true} returns if verified, throws otherwise | ||
*/ | ||
verify(): true; | ||
/** | ||
* Alias for {reset} | ||
*/ | ||
clear(): void; | ||
/** | ||
* Resets all the expected and actual calls | ||
* @memberof Mock | ||
*/ | ||
reset(): void; | ||
/** | ||
* Helper to print out an expected call | ||
* | ||
* @param {string} name | ||
* @param {any} data | ||
* @returns | ||
* @private | ||
* @memberof Mock | ||
*/ | ||
__print_call(name: string, data: any): string; | ||
/** | ||
* Compare two arguments for equality | ||
* | ||
* @param {[any, any]} args | ||
* @returns {boolean} | ||
* @memberof Mock | ||
*/ | ||
__compare([left, right]: [any, any]): boolean; | ||
/** | ||
* No-op in case this was wrapped in a Promise and a caller is checking if it's | ||
* thenable. In this case return self. | ||
* | ||
* @returns {Mock} | ||
* @memberof Mock | ||
*/ | ||
then(): this; | ||
/** | ||
* Called when the mock is called as a function | ||
* | ||
* @param {string} name the original function name | ||
* @param {...any} actual_args the original arguments | ||
*/ | ||
__call(name: string, ...actual_args: any[]): any; | ||
@@ -91,0 +26,0 @@ } |
@@ -1,2 +0,188 @@ | ||
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)}; | ||
var ArgumentError = /*@__PURE__*/(function (Error) { | ||
function ArgumentError(message) { | ||
Error.call(this, message); | ||
Error.captureStackTrace(this, this.constructor); | ||
} | ||
if ( Error ) ArgumentError.__proto__ = Error; | ||
ArgumentError.prototype = Object.create( Error && Error.prototype ); | ||
ArgumentError.prototype.constructor = ArgumentError; | ||
return ArgumentError; | ||
}(Error)); | ||
var MockVerificationError = /*@__PURE__*/(function (Error) { | ||
function MockVerificationError(message) { | ||
Error.call(this, message); | ||
Error.captureStackTrace(this, this.constructor); | ||
} | ||
if ( Error ) MockVerificationError.__proto__ = Error; | ||
MockVerificationError.prototype = Object.create( Error && Error.prototype ); | ||
MockVerificationError.prototype.constructor = MockVerificationError; | ||
return MockVerificationError; | ||
}(Error)); | ||
var Mock = function Mock() { | ||
this.expected_calls = {}; | ||
this.actual_calls = {}; | ||
}; | ||
Mock.prototype.__print = function __print (args) { | ||
return JSON.stringify(args); | ||
}; | ||
Mock.prototype.expect = function expect (name, retval, args, predicate) { | ||
if ( args === void 0 ) args = []; | ||
if (predicate instanceof Function) { | ||
if (args && (!Array.isArray(args) || args.length > 0)) { | ||
throw new ArgumentError(("args ignored when predicate is given (args: " + (this.__print(args)) + ")")); | ||
} | ||
this.expected_calls[name] = this.expected_calls[name] || []; | ||
this.expected_calls[name].push({ | ||
retval: retval, | ||
predicate: predicate | ||
}); | ||
return; | ||
} | ||
if (!Array.isArray(args)) { | ||
throw new ArgumentError("args must be an array"); | ||
} | ||
this.expected_calls[name] = this.expected_calls[name] || []; | ||
this.expected_calls[name].push({ | ||
retval: retval, | ||
args: args | ||
}); | ||
}; | ||
Mock.prototype.verify = function verify () { | ||
var this$1 = this; | ||
Object.keys(this.expected_calls).forEach(function (name) { | ||
var expected = this$1.expected_calls[name]; | ||
var actual = this$1.actual_calls[name]; | ||
if (!actual) { | ||
throw new MockVerificationError(("expected " + (this$1.__print_call(name, expected[0])))); | ||
} | ||
if (actual.length < expected.length) { | ||
throw new MockVerificationError(("expected " + (this$1.__print_call(name, expected[actual.length])) + ", got [" + (this$1.__print_call(name, actual)) + "]")); | ||
} | ||
}); | ||
return true; | ||
}; | ||
Mock.prototype.clear = function clear () { | ||
this.reset(); | ||
}; | ||
Mock.prototype.reset = function reset () { | ||
this.expected_calls = {}; | ||
this.actual_calls = {}; | ||
}; | ||
Mock.prototype.__print_call = function __print_call (name, data) { | ||
var this$1 = this; | ||
if (Array.isArray(data)) { | ||
return data.map(function (d) { return this$1.__call(name, d); }).join(', '); | ||
} | ||
return (name + "(" + ((data.args || []).join(', ')) + ") => " + (typeof data.retval) + " (" + (data.retval) + ")"); | ||
}; | ||
Mock.prototype.__compare = function __compare (ref) { | ||
var left = ref[0]; | ||
var right = ref[1]; | ||
return left === right; | ||
}; | ||
Mock.prototype.then = function then () { | ||
return this; | ||
}; | ||
Mock.prototype.__call = function __call (name) { | ||
var actual_args = [], len = arguments.length - 1; | ||
while ( len-- > 0 ) actual_args[ len ] = arguments[ len + 1 ]; | ||
var actual_calls = this.actual_calls[name] = this.actual_calls[name] || []; | ||
var index = actual_calls.length; | ||
var expected_call = (this.expected_calls[name] || [])[index]; | ||
if (!expected_call) { | ||
throw new MockVerificationError(("No more (>= " + index + ") expects available for " + name + ": " + (this.__print(actual_args)) + " (" + (this.__print(this)) + ")")); | ||
} | ||
var maybe_expected_args = expected_call.args; | ||
var retval = expected_call.retval; | ||
var predicate = expected_call.predicate; | ||
if (predicate) { | ||
actual_calls.push(expected_call); | ||
if (!predicate.apply(void 0, actual_args)) { | ||
throw new MockVerificationError(("mocked method " + name + " failed predicate w/ " + (this.__print(actual_args)))); | ||
} | ||
return retval; | ||
} | ||
var expected_args = maybe_expected_args; | ||
if (expected_args.length !== actual_args.length) { | ||
throw new MockVerificationError(("mocked method " + name + " expects " + (expected_args.length) + ", got " + (actual_args.length))); | ||
} | ||
var zipped_args = expected_args.map(function (arg, i) { return [arg, actual_args[i]]; }); | ||
var fully_matched = zipped_args.every(this.__compare); | ||
if (!fully_matched) { | ||
throw new MockVerificationError(("mocked method " + name + " called with unexpected arguments " + (this.__print(actual_args)) + ", expected " + (this.__print(expected_args)))); | ||
} | ||
actual_calls.push({ | ||
retval: retval, | ||
args: actual_args | ||
}); | ||
return retval; | ||
}; | ||
var KNOWN = [Symbol('util.inspect.custom').toString(), Symbol.toStringTag.toString(), 'inspect', 'valueOf', '$$typeof'].concat(Object.getOwnPropertyNames(Object.prototype)).concat(Object.getOwnPropertyNames(Mock.prototype)); | ||
var __handler = { | ||
get: function (mock, prop) { | ||
if (mock.hasOwnProperty(prop) || mock[prop]) { | ||
return mock[prop]; | ||
} | ||
if (mock.expected_calls[prop]) { | ||
return function () { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
return mock.__call.apply(mock, [ prop ].concat( args )); | ||
}; | ||
} | ||
var name = prop.toString(); | ||
if (KNOWN.indexOf(name) !== -1 || typeof prop === 'symbol') { | ||
return mock[prop]; | ||
} | ||
var expected_calls = Object.keys(mock.expected_calls) || ['<nothing>']; | ||
throw new ArgumentError(("unmocked method " + name + ", expected one of " + (mock.__print(expected_calls)))); | ||
} | ||
}; | ||
function createMock() { | ||
return new Proxy(new Mock(), __handler); | ||
} | ||
module.exports = createMock; | ||
//# sourceMappingURL=moxie.js.map |
@@ -1,2 +0,195 @@ | ||
!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)}}); | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.moxie = factory()); | ||
}(this, (function () { | ||
var ArgumentError = /*@__PURE__*/(function (Error) { | ||
function ArgumentError(message) { | ||
Error.call(this, message); | ||
Error.captureStackTrace(this, this.constructor); | ||
} | ||
if ( Error ) ArgumentError.__proto__ = Error; | ||
ArgumentError.prototype = Object.create( Error && Error.prototype ); | ||
ArgumentError.prototype.constructor = ArgumentError; | ||
return ArgumentError; | ||
}(Error)); | ||
var MockVerificationError = /*@__PURE__*/(function (Error) { | ||
function MockVerificationError(message) { | ||
Error.call(this, message); | ||
Error.captureStackTrace(this, this.constructor); | ||
} | ||
if ( Error ) MockVerificationError.__proto__ = Error; | ||
MockVerificationError.prototype = Object.create( Error && Error.prototype ); | ||
MockVerificationError.prototype.constructor = MockVerificationError; | ||
return MockVerificationError; | ||
}(Error)); | ||
var Mock = function Mock() { | ||
this.expected_calls = {}; | ||
this.actual_calls = {}; | ||
}; | ||
Mock.prototype.__print = function __print (args) { | ||
return JSON.stringify(args); | ||
}; | ||
Mock.prototype.expect = function expect (name, retval, args, predicate) { | ||
if ( args === void 0 ) args = []; | ||
if (predicate instanceof Function) { | ||
if (args && (!Array.isArray(args) || args.length > 0)) { | ||
throw new ArgumentError(("args ignored when predicate is given (args: " + (this.__print(args)) + ")")); | ||
} | ||
this.expected_calls[name] = this.expected_calls[name] || []; | ||
this.expected_calls[name].push({ | ||
retval: retval, | ||
predicate: predicate | ||
}); | ||
return; | ||
} | ||
if (!Array.isArray(args)) { | ||
throw new ArgumentError("args must be an array"); | ||
} | ||
this.expected_calls[name] = this.expected_calls[name] || []; | ||
this.expected_calls[name].push({ | ||
retval: retval, | ||
args: args | ||
}); | ||
}; | ||
Mock.prototype.verify = function verify () { | ||
var this$1 = this; | ||
Object.keys(this.expected_calls).forEach(function (name) { | ||
var expected = this$1.expected_calls[name]; | ||
var actual = this$1.actual_calls[name]; | ||
if (!actual) { | ||
throw new MockVerificationError(("expected " + (this$1.__print_call(name, expected[0])))); | ||
} | ||
if (actual.length < expected.length) { | ||
throw new MockVerificationError(("expected " + (this$1.__print_call(name, expected[actual.length])) + ", got [" + (this$1.__print_call(name, actual)) + "]")); | ||
} | ||
}); | ||
return true; | ||
}; | ||
Mock.prototype.clear = function clear () { | ||
this.reset(); | ||
}; | ||
Mock.prototype.reset = function reset () { | ||
this.expected_calls = {}; | ||
this.actual_calls = {}; | ||
}; | ||
Mock.prototype.__print_call = function __print_call (name, data) { | ||
var this$1 = this; | ||
if (Array.isArray(data)) { | ||
return data.map(function (d) { return this$1.__call(name, d); }).join(', '); | ||
} | ||
return (name + "(" + ((data.args || []).join(', ')) + ") => " + (typeof data.retval) + " (" + (data.retval) + ")"); | ||
}; | ||
Mock.prototype.__compare = function __compare (ref) { | ||
var left = ref[0]; | ||
var right = ref[1]; | ||
return left === right; | ||
}; | ||
Mock.prototype.then = function then () { | ||
return this; | ||
}; | ||
Mock.prototype.__call = function __call (name) { | ||
var actual_args = [], len = arguments.length - 1; | ||
while ( len-- > 0 ) actual_args[ len ] = arguments[ len + 1 ]; | ||
var actual_calls = this.actual_calls[name] = this.actual_calls[name] || []; | ||
var index = actual_calls.length; | ||
var expected_call = (this.expected_calls[name] || [])[index]; | ||
if (!expected_call) { | ||
throw new MockVerificationError(("No more (>= " + index + ") expects available for " + name + ": " + (this.__print(actual_args)) + " (" + (this.__print(this)) + ")")); | ||
} | ||
var maybe_expected_args = expected_call.args; | ||
var retval = expected_call.retval; | ||
var predicate = expected_call.predicate; | ||
if (predicate) { | ||
actual_calls.push(expected_call); | ||
if (!predicate.apply(void 0, actual_args)) { | ||
throw new MockVerificationError(("mocked method " + name + " failed predicate w/ " + (this.__print(actual_args)))); | ||
} | ||
return retval; | ||
} | ||
var expected_args = maybe_expected_args; | ||
if (expected_args.length !== actual_args.length) { | ||
throw new MockVerificationError(("mocked method " + name + " expects " + (expected_args.length) + ", got " + (actual_args.length))); | ||
} | ||
var zipped_args = expected_args.map(function (arg, i) { return [arg, actual_args[i]]; }); | ||
var fully_matched = zipped_args.every(this.__compare); | ||
if (!fully_matched) { | ||
throw new MockVerificationError(("mocked method " + name + " called with unexpected arguments " + (this.__print(actual_args)) + ", expected " + (this.__print(expected_args)))); | ||
} | ||
actual_calls.push({ | ||
retval: retval, | ||
args: actual_args | ||
}); | ||
return retval; | ||
}; | ||
var KNOWN = [Symbol('util.inspect.custom').toString(), Symbol.toStringTag.toString(), 'inspect', 'valueOf', '$$typeof'].concat(Object.getOwnPropertyNames(Object.prototype)).concat(Object.getOwnPropertyNames(Mock.prototype)); | ||
var __handler = { | ||
get: function (mock, prop) { | ||
if (mock.hasOwnProperty(prop) || mock[prop]) { | ||
return mock[prop]; | ||
} | ||
if (mock.expected_calls[prop]) { | ||
return function () { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
return mock.__call.apply(mock, [ prop ].concat( args )); | ||
}; | ||
} | ||
var name = prop.toString(); | ||
if (KNOWN.indexOf(name) !== -1 || typeof prop === 'symbol') { | ||
return mock[prop]; | ||
} | ||
var expected_calls = Object.keys(mock.expected_calls) || ['<nothing>']; | ||
throw new ArgumentError(("unmocked method " + name + ", expected one of " + (mock.__print(expected_calls)))); | ||
} | ||
}; | ||
function createMock() { | ||
return new Proxy(new Mock(), __handler); | ||
} | ||
return createMock; | ||
}))); | ||
//# sourceMappingURL=moxie.umd.js.map |
12
moxie.ts
@@ -57,3 +57,3 @@ // @ts-check | ||
*/ | ||
expect(name: string, retval: any, args: any[] = [], predicate: Predicate = undefined) { | ||
expect(name: string, retval: any, args: any[] = [], predicate?: Predicate) { | ||
if (predicate instanceof Function) { | ||
@@ -174,3 +174,3 @@ if (args && (!Array.isArray(args) || args.length > 0)) { | ||
const { args: expected_args, retval, predicate } = expected_call | ||
const { args: maybe_expected_args, retval, predicate } = expected_call | ||
@@ -188,2 +188,4 @@ if (predicate) { | ||
const expected_args = maybe_expected_args!! | ||
if (expected_args.length !== actual_args.length) { | ||
@@ -195,3 +197,3 @@ throw new MockVerificationError( | ||
const zipped_args = expected_args.map((arg, i) => [arg, actual_args[i]]) | ||
const zipped_args = expected_args.map((arg, i) => [arg, actual_args[i]]) as [any, any][] | ||
// Intentional == to coerce | ||
@@ -235,3 +237,3 @@ // TODO: allow for === case equailty style matching later | ||
*/ | ||
get: function(mock: Mock, prop: string) { | ||
get: function(mock: Mock & { [P: string]: any }, prop: string) { | ||
if (mock.hasOwnProperty(prop) || mock[prop]) { | ||
@@ -251,3 +253,3 @@ return mock[prop] | ||
const expected_calls = Object.keys(mock.expected_calls) || ['<nothing>'] | ||
throw new Error( | ||
throw new ArgumentError( | ||
`unmocked method ${name}, expected one of ${mock.__print(expected_calls)}` | ||
@@ -254,0 +256,0 @@ ) |
{ | ||
"name": "@xpbytes/moxie", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Proxy based mock for node and v8", | ||
@@ -19,3 +19,3 @@ "main": "dist/moxie.js", | ||
"scripts": { | ||
"build": "microbundle", | ||
"build": "microbundle --no-compress", | ||
"dev": "microbundle watch", | ||
@@ -30,3 +30,4 @@ "pretest": "yarn build", | ||
"microbundle": "^0.9.0", | ||
"rimraf": "^2.6.3" | ||
"rimraf": "^2.6.3", | ||
"terser": "^3.16.1" | ||
}, | ||
@@ -33,0 +34,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
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
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
65689
688
5