Socket
Socket
Sign inDemoInstall

jest-mock

Package Overview
Dependencies
Maintainers
2
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-mock - npm Package Compare versions

Comparing version 20.0.3 to 20.1.0-alpha.1

2262

build-es5/index.js

@@ -1,596 +0,1938 @@

'use strict';var _map = require('babel-runtime/core-js/map');var _map2 = _interopRequireDefault(_map);var _weakMap = require('babel-runtime/core-js/weak-map');var _weakMap2 = _interopRequireDefault(_weakMap);var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);var _createClass2 = require('babel-runtime/helpers/createClass');var _createClass3 = _interopRequireDefault(_createClass2);var _keys = require('babel-runtime/core-js/object/keys');var _keys2 = _interopRequireDefault(_keys);var _getOwnPropertyDescriptor = require('babel-runtime/core-js/object/get-own-property-descriptor');var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);var _getOwnPropertyNames = require('babel-runtime/core-js/object/get-own-property-names');var _getOwnPropertyNames2 = _interopRequireDefault(_getOwnPropertyNames);var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);var _create = require('babel-runtime/core-js/object/create');var _create2 = _interopRequireDefault(_create);var _assign = require('babel-runtime/core-js/object/assign');var _assign2 = _interopRequireDefault(_assign);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global['jest-mock'] = factory());
}(this, (function () { 'use strict';
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function unwrapExports (x) {
return x && x.__esModule ? x['default'] : x;
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
var _toInteger = function(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
// 7.2.1 RequireObjectCoercible(argument)
var _defined = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
// true -> String#at
// false -> String#codePointAt
var _stringAt = function(TO_STRING){
return function(that, pos){
var s = String(_defined(that))
, i = _toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
var _library = true;
var _global = createCommonjsModule(function (module) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
});
var _core = createCommonjsModule(function (module) {
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
});
var _aFunction = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
// optional / simple context binding
var _ctx = function(fn, that, length){
_aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
var _isObject = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
var _anObject = function(it){
if(!_isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
var _fails = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
// Thank's IE8 for his funny defineProperty
var _descriptors = !_fails(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
var document$1 = _global.document;
var is = _isObject(document$1) && _isObject(document$1.createElement);
var _domCreate = function(it){
return is ? document$1.createElement(it) : {};
};
var _ie8DomDefine = !_descriptors && !_fails(function(){
return Object.defineProperty(_domCreate('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
// 7.1.1 ToPrimitive(input [, PreferredType])
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var _toPrimitive = function(it, S){
if(!_isObject(it))return it;
var fn, val;
if(S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it)))return val;
if(typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it)))return val;
if(!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to primitive value");
};
var dP = Object.defineProperty;
var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes){
_anObject(O);
P = _toPrimitive(P, true);
_anObject(Attributes);
if(_ie8DomDefine)try {
return dP(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)O[P] = Attributes.value;
return O;
};
var _objectDp = {
f: f
};
var _propertyDesc = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
var _hide = _descriptors ? function(object, key, value){
return _objectDp.f(object, key, _propertyDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
var PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {})
, expProto = exports[PROTOTYPE]
, target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? _ctx(out, _global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(a, b, c){
if(this instanceof C){
switch(arguments.length){
case 0: return new C;
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if(IS_PROTO){
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if(type & $export.R && expProto && !expProto[key])_hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
var _export = $export;
var _redefine = _hide;
var hasOwnProperty = {}.hasOwnProperty;
var _has = function(it, key){
return hasOwnProperty.call(it, key);
};
var _iterators = {};
var toString = {}.toString;
var _cof = function(it){
return toString.call(it).slice(8, -1);
};
var MOCK_CONSTRUCTOR_NAME = 'mockConstructor';
// fallback for non-array-like ES3 and non-enumerable old V8 strings
// $FlowFixMe
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var RESERVED_KEYWORDS = (0, _assign2.default)((0, _create2.default)(null), { arguments: true, await: true, break: true, case: true, catch: true, class: true, const: true, continue: true,
debugger: true,
default: true,
delete: true,
do: true,
else: true,
enum: true,
eval: true,
export: true,
extends: true,
false: true,
finally: true,
for: true,
function: true,
if: true,
implements: true,
import: true,
in: true,
instanceof: true,
interface: true,
let: true,
new: true,
null: true,
package: true,
private: true,
protected: true,
public: true,
return: true,
static: true,
super: true,
switch: true,
this: true,
throw: true,
true: true,
try: true,
typeof: true,
var: true,
void: true,
while: true,
with: true,
yield: true });
var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return _cof(it) == 'String' ? it.split('') : Object(it);
};
// to indexed object, toObject with fallback for non-array-like ES3 strings
function isA(typeName, value) {
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
}
var _toIobject = function(it){
return _iobject(_defined(it));
};
function getType(ref) {
if (isA('Function', ref) || isA('AsyncFunction', ref)) {
return 'function';
} else if (Array.isArray(ref)) {
return 'array';
} else if (isA('Object', ref)) {
return 'object';
} else if (
isA('Number', ref) ||
isA('String', ref) ||
isA('Boolean', ref) ||
isA('Symbol', ref))
{
return 'constant';
} else if (isA('Map', ref) || isA('WeakMap', ref) || isA('Set', ref)) {
return 'collection';
} else if (isA('RegExp', ref)) {
return 'regexp';
} else if (ref === undefined) {
return 'undefined';
} else if (ref === null) {
return 'null';
} else {
return null;
// 7.1.15 ToLength
var min = Math.min;
var _toLength = function(it){
return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
var max = Math.max;
var min$1 = Math.min;
var _toIndex = function(index, length){
index = _toInteger(index);
return index < 0 ? max(index + length, 0) : min$1(index, length);
};
// false -> Array#indexOf
// true -> Array#includes
var _arrayIncludes = function(IS_INCLUDES){
return function($this, el, fromIndex){
var O = _toIobject($this)
, length = _toLength(O.length)
, index = _toIndex(fromIndex, length)
, value;
// Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
// Array#toIndex ignores holes, Array#includes - not
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
var SHARED = '__core-js_shared__';
var store = _global[SHARED] || (_global[SHARED] = {});
var _shared = function(key){
return store[key] || (store[key] = {});
};
var id = 0;
var px = Math.random();
var _uid = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
var shared = _shared('keys');
var _sharedKey = function(key){
return shared[key] || (shared[key] = _uid(key));
};
var arrayIndexOf = _arrayIncludes(false);
var IE_PROTO$1 = _sharedKey('IE_PROTO');
var _objectKeysInternal = function(object, names){
var O = _toIobject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO$1)_has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(names.length > i)if(_has(O, key = names[i++])){
~arrayIndexOf(result, key) || result.push(key);
}
}
return result;
};
function isReadonlyProp(object, prop) {
return (
(prop === 'arguments' ||
prop === 'caller' ||
prop === 'callee' ||
prop === 'name' ||
prop === 'length') && (
isA('Function', object) || isA('AsyncFunction', object)) ||
(prop === 'source' ||
prop === 'global' ||
prop === 'ignoreCase' ||
prop === 'multiline') &&
isA('RegExp', object));
// IE 8- don't enum bug keys
var _enumBugKeys = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var _objectKeys = Object.keys || function keys(O){
return _objectKeysInternal(O, _enumBugKeys);
};
var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties){
_anObject(O);
var keys = _objectKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)_objectDp.f(O, P = keys[i++], Properties[P]);
return O;
};
var _html = _global.document && document.documentElement;
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var IE_PROTO = _sharedKey('IE_PROTO');
var Empty = function(){ /* empty */ };
var PROTOTYPE$1 = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = _domCreate('iframe')
, i = _enumBugKeys.length
, lt = '<'
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
_html.appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
return createDict();
};
var _objectCreate = Object.create || function create(O, Properties){
var result;
if(O !== null){
Empty[PROTOTYPE$1] = _anObject(O);
result = new Empty;
Empty[PROTOTYPE$1] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : _objectDps(result, Properties);
};
var _wks = createCommonjsModule(function (module) {
var store = _shared('wks')
, Symbol = _global.Symbol
, USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function(name){
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
};
$exports.store = store;
});
var def = _objectDp.f;
var TAG = _wks('toStringTag');
var _setToStringTag = function(it, tag, stat){
if(it && !_has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
};
var IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
_hide(IteratorPrototype, _wks('iterator'), function(){ return this; });
var _iterCreate = function(Constructor, NAME, next){
Constructor.prototype = _objectCreate(IteratorPrototype, {next: _propertyDesc(1, next)});
_setToStringTag(Constructor, NAME + ' Iterator');
};
// 7.1.13 ToObject(argument)
var _toObject = function(it){
return Object(_defined(it));
};
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var IE_PROTO$2 = _sharedKey('IE_PROTO');
var ObjectProto = Object.prototype;
var _objectGpo = Object.getPrototypeOf || function(O){
O = _toObject(O);
if(_has(O, IE_PROTO$2))return O[IE_PROTO$2];
if(typeof O.constructor == 'function' && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
};
var ITERATOR = _wks('iterator');
var BUGGY = !([].keys && 'next' in [].keys());
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var VALUES = 'values';
var returnThis = function(){ return this; };
var _iterDefine = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
_iterCreate(Constructor, NAME, next);
var getMethod = function(kind){
if(!BUGGY && kind in proto)return proto[kind];
switch(kind){
case KEYS: return function keys(){ return new Constructor(this, kind); };
case VALUES: return function values(){ return new Constructor(this, kind); };
} return function entries(){ return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator'
, DEF_VALUES = DEFAULT == VALUES
, VALUES_BUG = false
, proto = Base.prototype
, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, $default = $native || getMethod(DEFAULT)
, $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
, $anyNative = NAME == 'Array' ? proto.entries || $native : $native
, methods, key, IteratorPrototype;
// Fix native
if($anyNative){
IteratorPrototype = _objectGpo($anyNative.call(new Base));
if(IteratorPrototype !== Object.prototype){
// Set @@toStringTag to native iterators
_setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if(!_library && !_has(IteratorPrototype, ITERATOR))_hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if(DEF_VALUES && $native && $native.name !== VALUES){
VALUES_BUG = true;
$default = function values(){ return $native.call(this); };
}
// Define iterator
if((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
_hide(proto, ITERATOR, $default);
}
// Plug for library
_iterators[NAME] = $default;
_iterators[TAG] = returnThis;
if(DEFAULT){
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if(FORCED)for(key in methods){
if(!(key in proto))_redefine(proto, key, methods[key]);
} else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
var $at = _stringAt(true);
// 21.1.3.27 String.prototype[@@iterator]()
_iterDefine(String, 'String', function(iterated){
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var O = this._t
, index = this._i
, point;
if(index >= O.length)return {value: undefined, done: true};
point = $at(O, index);
this._i += point.length;
return {value: point, done: false};
});
var _addToUnscopables = function(){ /* empty */ };
var _iterStep = function(done, value){
return {value: value, done: !!done};
};
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
var es6_array_iterator = _iterDefine(Array, 'Array', function(iterated, kind){
this._t = _toIobject(iterated); // target
this._i = 0; // next index
this._k = kind; // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var O = this._t
, kind = this._k
, index = this._i++;
if(!O || index >= O.length){
this._t = undefined;
return _iterStep(1);
}
if(kind == 'keys' )return _iterStep(0, index);
if(kind == 'values')return _iterStep(0, O[index]);
return _iterStep(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
_iterators.Arguments = _iterators.Array;
_addToUnscopables('keys');
_addToUnscopables('values');
_addToUnscopables('entries');
var TO_STRING_TAG = _wks('toStringTag');
for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
var NAME = collections[i]
, Collection = _global[NAME]
, proto = Collection && Collection.prototype;
if(proto && !proto[TO_STRING_TAG])_hide(proto, TO_STRING_TAG, NAME);
_iterators[NAME] = _iterators.Array;
}
function getSlots(object) {
var slots = {};
if (!object) {
return [];
var _redefineAll = function(target, src, safe){
for(var key in src){
if(safe && target[key])target[key] = src[key];
else _hide(target, key, src[key]);
} return target;
};
var _anInstance = function(it, Constructor, name, forbiddenField){
if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
throw TypeError(name + ': incorrect invocation!');
} return it;
};
// call something on iterator step with safe closing on error
var _iterCall = function(iterator, fn, value, entries){
try {
return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch(e){
var ret = iterator['return'];
if(ret !== undefined)_anObject(ret.call(iterator));
throw e;
}
};
var parent = (0, _getPrototypeOf2.default)(object);
do {
if (object === (0, _getPrototypeOf2.default)(Function)) {
break;
}
var ownNames = (0, _getOwnPropertyNames2.default)(object);
for (var i = 0; i < ownNames.length; i++) {
var prop = ownNames[i];
if (!isReadonlyProp(object, prop)) {
var propDesc = (0, _getOwnPropertyDescriptor2.default)(object, prop);
if (!propDesc.get || object.__esModule) {
slots[prop] = true;
// check on default Array iterator
var ITERATOR$1 = _wks('iterator');
var ArrayProto = Array.prototype;
var _isArrayIter = function(it){
return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR$1] === it);
};
// getting tag from 19.1.3.6 Object.prototype.toString()
var TAG$1 = _wks('toStringTag');
var ARG = _cof(function(){ return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function(it, key){
try {
return it[key];
} catch(e){ /* empty */ }
};
var _classof = function(it){
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
// builtinTag case
: ARG ? _cof(O)
// ES3 arguments fallback
: (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
var ITERATOR$2 = _wks('iterator');
var core_getIteratorMethod = _core.getIteratorMethod = function(it){
if(it != undefined)return it[ITERATOR$2]
|| it['@@iterator']
|| _iterators[_classof(it)];
};
var _forOf = createCommonjsModule(function (module) {
var BREAK = {}
, RETURN = {};
var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
var iterFn = ITERATOR ? function(){ return iterable; } : core_getIteratorMethod(iterable)
, f = _ctx(fn, that, entries ? 2 : 1)
, index = 0
, length, step, iterator, result;
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
// fast case for arrays with default iterator
if(_isArrayIter(iterFn))for(length = _toLength(iterable.length); length > index; index++){
result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
if(result === BREAK || result === RETURN)return result;
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
result = _iterCall(iterator, f, step.value, entries);
if(result === BREAK || result === RETURN)return result;
}
};
exports.BREAK = BREAK;
exports.RETURN = RETURN;
});
var SPECIES = _wks('species');
var _setSpecies = function(KEY){
var C = typeof _core[KEY] == 'function' ? _core[KEY] : _global[KEY];
if(_descriptors && C && !C[SPECIES])_objectDp.f(C, SPECIES, {
configurable: true,
get: function(){ return this; }
});
};
var _meta = createCommonjsModule(function (module) {
var META = _uid('meta')
, setDesc = _objectDp.f
, id = 0;
var isExtensible = Object.isExtensible || function(){
return true;
};
var FREEZE = !_fails(function(){
return isExtensible(Object.preventExtensions({}));
});
var setMeta = function(it){
setDesc(it, META, {value: {
i: 'O' + ++id, // object ID
w: {} // weak collections IDs
}});
};
var fastKey = function(it, create){
// return primitive with prefix
if(!_isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if(!_has(it, META)){
// can't set metadata to uncaught frozen object
if(!isExtensible(it))return 'F';
// not necessary to add metadata
if(!create)return 'E';
// add missing metadata
setMeta(it);
// return object ID
} return it[META].i;
};
var getWeak = function(it, create){
if(!_has(it, META)){
// can't set metadata to uncaught frozen object
if(!isExtensible(it))return true;
// not necessary to add metadata
if(!create)return false;
// add missing metadata
setMeta(it);
// return hash weak collections IDs
} return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function(it){
if(FREEZE && meta.NEED && isExtensible(it) && !_has(it, META))setMeta(it);
return it;
};
var meta = module.exports = {
KEY: META,
NEED: false,
fastKey: fastKey,
getWeak: getWeak,
onFreeze: onFreeze
};
});
var dP$1 = _objectDp.f;
var fastKey = _meta.fastKey;
var SIZE = _descriptors ? '_s' : 'size';
var getEntry = function(that, key){
// fast case
var index = fastKey(key), entry;
if(index !== 'F')return that._i[index];
// frozen object case
for(entry = that._f; entry; entry = entry.n){
if(entry.k == key)return entry;
}
};
var _collectionStrong = {
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
var C = wrapper(function(that, iterable){
_anInstance(that, C, NAME, '_i');
that._i = _objectCreate(null); // index
that._f = undefined; // first entry
that._l = undefined; // last entry
that[SIZE] = 0; // size
if(iterable != undefined)_forOf(iterable, IS_MAP, that[ADDER], that);
});
_redefineAll(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear(){
for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
entry.r = true;
if(entry.p)entry.p = entry.p.n = undefined;
delete data[entry.i];
}
that._f = that._l = undefined;
that[SIZE] = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var that = this
, entry = getEntry(that, key);
if(entry){
var next = entry.n
, prev = entry.p;
delete that._i[entry.i];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
if(that._f == entry)that._f = next;
if(that._l == entry)that._l = prev;
that[SIZE]--;
} return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function forEach(callbackfn /*, that = undefined */){
_anInstance(this, C, 'forEach');
var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
, entry;
while(entry = entry ? entry.n : this._f){
f(entry.v, entry.k, this);
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key){
return !!getEntry(this, key);
}
});
if(_descriptors)dP$1(C.prototype, 'size', {
get: function(){
return _defined(this[SIZE]);
}
});
return C;
},
def: function(that, key, value){
var entry = getEntry(that, key)
, prev, index;
// change existing entry
if(entry){
entry.v = value;
// create new entry
} else {
that._l = entry = {
i: index = fastKey(key, true), // <- index
k: key, // <- key
v: value, // <- value
p: prev = that._l, // <- previous entry
n: undefined, // <- next entry
r: false // <- removed
};
if(!that._f)that._f = entry;
if(prev)prev.n = entry;
that[SIZE]++;
// add to index
if(index !== 'F')that._i[index] = entry;
} return that;
},
getEntry: getEntry,
setStrong: function(C, NAME, IS_MAP){
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
_iterDefine(C, NAME, function(iterated, kind){
this._t = iterated; // target
this._k = kind; // kind
this._l = undefined; // previous
}, function(){
var that = this
, kind = that._k
, entry = that._l;
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
// get next entry
if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
// or finish the iteration
that._t = undefined;
return _iterStep(1);
}
// return step by kind
if(kind == 'keys' )return _iterStep(0, entry.k);
if(kind == 'values')return _iterStep(0, entry.v);
return _iterStep(0, [entry.k, entry.v]);
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
// add [@@species], 23.1.2.2, 23.2.2.2
_setSpecies(NAME);
}
};
// 7.2.2 IsArray(argument)
var _isArray = Array.isArray || function isArray(arg){
return _cof(arg) == 'Array';
};
var SPECIES$1 = _wks('species');
var _arraySpeciesConstructor = function(original){
var C;
if(_isArray(original)){
C = original.constructor;
// cross-realm fallback
if(typeof C == 'function' && (C === Array || _isArray(C.prototype)))C = undefined;
if(_isObject(C)){
C = C[SPECIES$1];
if(C === null)C = undefined;
}
object = parent;
} while (object && (parent = (0, _getPrototypeOf2.default)(object)) !== null);
return (0, _keys2.default)(slots);
}var
} return C === undefined ? Array : C;
};
ModuleMockerClass = function () {
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
var _arraySpeciesCreate = function(original, length){
return new (_arraySpeciesConstructor(original))(length);
};
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var _arrayMethods = function(TYPE, $create){
var IS_MAP = TYPE == 1
, IS_FILTER = TYPE == 2
, IS_SOME = TYPE == 3
, IS_EVERY = TYPE == 4
, IS_FIND_INDEX = TYPE == 6
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX
, create = $create || _arraySpeciesCreate;
return function($this, callbackfn, that){
var O = _toObject($this)
, self = _iobject(O)
, f = _ctx(callbackfn, that, 3)
, length = _toLength(self.length)
, index = 0
, result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined
, val, res;
for(;length > index; index++)if(NO_HOLES || index in self){
val = self[index];
res = f(val, index, O);
if(TYPE){
if(IS_MAP)result[index] = res; // map
else if(res)switch(TYPE){
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if(IS_EVERY)return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
};
};
/**
* @see README.md
* @param global Global object of the test environment, used to create
* mocks
*/
function ModuleMockerClass(global) {(0, _classCallCheck3.default)(this, ModuleMockerClass);
this._environmentGlobal = global;
this._mockState = new _weakMap2.default();
this._mockConfigRegistry = new _weakMap2.default();
this.ModuleMocker = ModuleMockerClass;
}(0, _createClass3.default)(ModuleMockerClass, [{ key: '_ensureMockConfig', value: function _ensureMockConfig(
var dP$2 = _objectDp.f;
var each = _arrayMethods(0);
f) {
var config = this._mockConfigRegistry.get(f);
if (!config) {
config = this._defaultMockConfig();
this._mockConfigRegistry.set(f, config);
var _collection = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
var Base = _global[NAME]
, C = Base
, ADDER = IS_MAP ? 'set' : 'add'
, proto = C && C.prototype
, O = {};
if(!_descriptors || typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function(){
new C().entries().next();
}))){
// create collection constructor
C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
_redefineAll(C.prototype, methods);
_meta.NEED = true;
} else {
C = wrapper(function(target, iterable){
_anInstance(target, C, NAME, '_c');
target._c = new Base;
if(iterable != undefined)_forOf(iterable, IS_MAP, target[ADDER], target);
});
each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','),function(KEY){
var IS_ADDER = KEY == 'add' || KEY == 'set';
if(KEY in proto && !(IS_WEAK && KEY == 'clear'))_hide(C.prototype, KEY, function(a, b){
_anInstance(this, C, KEY);
if(!IS_ADDER && IS_WEAK && !_isObject(a))return KEY == 'get' ? undefined : false;
var result = this._c[KEY](a === 0 ? 0 : a, b);
return IS_ADDER ? this : result;
});
});
if('size' in proto)dP$2(C.prototype, 'size', {
get: function(){
return this._c.size;
}
return config;
} }, { key: '_ensureMockState', value: function _ensureMockState(
});
}
f) {
var state = this._mockState.get(f);
if (!state) {
state = this._defaultMockState();
this._mockState.set(f, state);
_setToStringTag(C, NAME);
O[NAME] = C;
_export(_export.G + _export.W + _export.F, O);
if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
return C;
};
// 23.1 Map Objects
var es6_map = _collection('Map', function(get){
return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
// 23.1.3.6 Map.prototype.get(key)
get: function get(key){
var entry = _collectionStrong.getEntry(this, key);
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value){
return _collectionStrong.def(this, key === 0 ? 0 : key, value);
}
}, _collectionStrong, true);
var _arrayFromIterable = function(iter, ITERATOR){
var result = [];
_forOf(iter, false, result.push, result, ITERATOR);
return result;
};
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var _collectionToJson = function(NAME){
return function toJSON(){
if(_classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
return _arrayFromIterable(this);
};
};
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
_export(_export.P + _export.R, 'Map', {toJSON: _collectionToJson('Map')});
var map$1 = _core.Map;
var map = createCommonjsModule(function (module) {
module.exports = { "default": map$1, __esModule: true };
});
var _Map = unwrapExports(map);
var f$1 = Object.getOwnPropertySymbols;
var _objectGops = {
f: f$1
};
var f$2 = {}.propertyIsEnumerable;
var _objectPie = {
f: f$2
};
// 19.1.2.1 Object.assign(target, source, ...)
var $assign = Object.assign;
// should work with symbols and should have deterministic property order (V8 bug)
var _objectAssign = !$assign || _fails(function(){
var A = {}
, B = {}
, S = Symbol()
, K = 'abcdefghijklmnopqrst';
A[S] = 7;
K.split('').forEach(function(k){ B[k] = k; });
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
var T = _toObject(target)
, aLen = arguments.length
, index = 1
, getSymbols = _objectGops.f
, isEnum = _objectPie.f;
while(aLen > index){
var S = _iobject(arguments[index++])
, keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
} return T;
} : $assign;
var getWeak = _meta.getWeak;
var arrayFind = _arrayMethods(5);
var arrayFindIndex = _arrayMethods(6);
var id$1 = 0;
// fallback for uncaught frozen keys
var uncaughtFrozenStore = function(that){
return that._l || (that._l = new UncaughtFrozenStore);
};
var UncaughtFrozenStore = function(){
this.a = [];
};
var findUncaughtFrozen = function(store, key){
return arrayFind(store.a, function(it){
return it[0] === key;
});
};
UncaughtFrozenStore.prototype = {
get: function(key){
var entry = findUncaughtFrozen(this, key);
if(entry)return entry[1];
},
has: function(key){
return !!findUncaughtFrozen(this, key);
},
set: function(key, value){
var entry = findUncaughtFrozen(this, key);
if(entry)entry[1] = value;
else this.a.push([key, value]);
},
'delete': function(key){
var index = arrayFindIndex(this.a, function(it){
return it[0] === key;
});
if(~index)this.a.splice(index, 1);
return !!~index;
}
};
var _collectionWeak = {
getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
var C = wrapper(function(that, iterable){
_anInstance(that, C, NAME, '_i');
that._i = id$1++; // collection id
that._l = undefined; // leak store for uncaught frozen objects
if(iterable != undefined)_forOf(iterable, IS_MAP, that[ADDER], that);
});
_redefineAll(C.prototype, {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function(key){
if(!_isObject(key))return false;
var data = getWeak(key);
if(data === true)return uncaughtFrozenStore(this)['delete'](key);
return data && _has(data, this._i) && delete data[this._i];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function has(key){
if(!_isObject(key))return false;
var data = getWeak(key);
if(data === true)return uncaughtFrozenStore(this).has(key);
return data && _has(data, this._i);
}
return state;
} }, { key: '_defaultMockConfig', value: function _defaultMockConfig()
});
return C;
},
def: function(that, key, value){
var data = getWeak(_anObject(key), true);
if(data === true)uncaughtFrozenStore(that).set(key, value);
else data[that._i] = value;
return that;
},
ufstore: uncaughtFrozenStore
};
{
return {
defaultReturnValue: undefined,
isReturnValueLastSet: false,
mockImpl: undefined,
specificMockImpls: [],
specificReturnValues: [] };
var es6_weakMap = createCommonjsModule(function (module) {
'use strict';
var each = _arrayMethods(0)
, getWeak = _meta.getWeak
, isExtensible = Object.isExtensible
, uncaughtFrozenStore = _collectionWeak.ufstore
, tmp = {}
, InternalMap;
} }, { key: '_defaultMockState', value: function _defaultMockState()
var wrapper = function(get){
return function WeakMap(){
return get(this, arguments.length > 0 ? arguments[0] : undefined);
};
};
{
return {
calls: [],
instances: [] };
var methods = {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function get(key){
if(_isObject(key)){
var data = getWeak(key);
if(data === true)return uncaughtFrozenStore(this).get(key);
return data ? data[this._i] : undefined;
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function set(key, value){
return _collectionWeak.def(this, key, value);
}
};
} }, { key: '_makeComponent', value: function _makeComponent(
// 23.3 WeakMap Objects
var $WeakMap = module.exports = _collection('WeakMap', wrapper, methods, _collectionWeak, true, true);
metadata, restore) {var _this2 = this;
if (metadata.type === 'object') {
return new this._environmentGlobal.Object();
} else if (metadata.type === 'array') {
return new this._environmentGlobal.Array();
} else if (metadata.type === 'regexp') {
return new this._environmentGlobal.RegExp('');
} else if (
metadata.type === 'constant' ||
metadata.type === 'collection' ||
metadata.type === 'null' ||
metadata.type === 'undefined')
{
return metadata.value;
} else if (metadata.type === 'function') {
/* eslint-disable prefer-const */
var f = void 0;
/* eslint-enable prefer-const */
// IE11 WeakMap frozen keys fix
if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
InternalMap = _collectionWeak.getConstructor(wrapper);
_objectAssign(InternalMap.prototype, methods);
_meta.NEED = true;
each(['delete', 'has', 'get', 'set'], function(key){
var proto = $WeakMap.prototype
, method = proto[key];
_redefine(proto, key, function(a, b){
// store frozen objects on internal weakmap shim
if(_isObject(a) && !isExtensible(a)){
if(!this._f)this._f = new InternalMap;
var result = this._f[key](a, b);
return key == 'set' ? this : result;
// store all the rest on native weakmap
} return method.call(this, a, b);
});
});
}
});
var prototype = metadata.members &&
metadata.members.prototype &&
metadata.members.prototype.members || {};
var prototypeSlots = getSlots(prototype);
var mocker = this;
var mockConstructor = function mockConstructor() {var _this = this;
var mockState = mocker._ensureMockState(f);
var mockConfig = mocker._ensureMockConfig(f);
mockState.instances.push(this);
mockState.calls.push(Array.prototype.slice.call(arguments));
if (this instanceof f) {
// This is probably being called as a constructor
prototypeSlots.forEach(function (slot) {
// Copy prototype methods to the instance to make
// it easier to interact with mock instance call and
// return values
if (prototype[slot].type === 'function') {
var protoImpl = _this[slot];
_this[slot] = mocker.generateFromMetadata(prototype[slot]);
_this[slot]._protoImpl = protoImpl;
}
});
var weakMap$1 = _core.WeakMap;
// Run the mock constructor implementation
return (
mockConfig.mockImpl && mockConfig.mockImpl.apply(this, arguments));
var weakMap = createCommonjsModule(function (module) {
module.exports = { "default": weakMap$1, __esModule: true };
});
}
var _WeakMap = unwrapExports(weakMap);
var returnValue = void 0;
// If return value is last set, either specific or default, i.e.
// mockReturnValueOnce()/mockReturnValue() is called and no
// mockImplementationOnce()/mockImplementation() is called after that.
// use the set return value.
if (mockConfig.isReturnValueLastSet) {
returnValue = mockConfig.specificReturnValues.shift();
if (returnValue === undefined) {
returnValue = mockConfig.defaultReturnValue;
}
var classCallCheck = createCommonjsModule(function (module, exports) {
"use strict";
return returnValue;
}
exports.__esModule = true;
// If mockImplementationOnce()/mockImplementation() is last set,
// or specific return values are used up, use the mock implementation.
var specificMockImpl = void 0;
if (returnValue === undefined) {
specificMockImpl = mockConfig.specificMockImpls.shift();
if (specificMockImpl === undefined) {
specificMockImpl = mockConfig.mockImpl;
}
if (specificMockImpl) {
return specificMockImpl.apply(this, arguments);
}
}
exports.default = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
});
// Otherwise use prototype implementation
if (returnValue === undefined && f._protoImpl) {
return f._protoImpl.apply(this, arguments);
}
var _classCallCheck = unwrapExports(classCallCheck);
return returnValue;
};
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
_export(_export.S + _export.F * !_descriptors, 'Object', {defineProperty: _objectDp.f});
f = this._createMockFunction(metadata, mockConstructor);
f._isMockFunction = true;
f.getMockImplementation = function () {return _this2._ensureMockConfig(f).mockImpl;};
var $Object = _core.Object;
var defineProperty$2 = function defineProperty(it, key, desc){
return $Object.defineProperty(it, key, desc);
};
this._mockState.set(f, this._defaultMockState());
this._mockConfigRegistry.set(f, this._defaultMockConfig());
var defineProperty = createCommonjsModule(function (module) {
module.exports = { "default": defineProperty$2, __esModule: true };
});
// $FlowFixMe - defineProperty getters not supported
Object.defineProperty(f, 'mock', {
configurable: false,
enumerable: true,
get: function get() {return _this2._ensureMockState(f);},
set: function set(val) {return _this2._mockState.set(f, val);} });
var createClass = createCommonjsModule(function (module, exports) {
"use strict";
exports.__esModule = true;
f.mockClear = function () {
_this2._mockState.delete(f);
};
f.mockReset = function () {
_this2._mockState.delete(f);
_this2._mockConfigRegistry.delete(f);
};
f.mockReturnValueOnce = function (value) {
// next function call will return this value or default return value
var mockConfig = _this2._ensureMockConfig(f);
mockConfig.isReturnValueLastSet = true;
mockConfig.specificReturnValues.push(value);
return f;
};
var _defineProperty2 = _interopRequireDefault(defineProperty);
f.mockReturnValue = function (value) {
// next function call will return specified return value or this one
var mockConfig = _this2._ensureMockConfig(f);
mockConfig.isReturnValueLastSet = true;
mockConfig.defaultReturnValue = value;
return f;
};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
f.mockImplementationOnce = function (fn) {
// next function call will use this mock implementation return value
// or default mock implementation return value
var mockConfig = _this2._ensureMockConfig(f);
mockConfig.isReturnValueLastSet = false;
mockConfig.specificMockImpls.push(fn);
return f;
};
exports.default = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
(0, _defineProperty2.default)(target, descriptor.key, descriptor);
}
}
f.mockImplementation = function (fn) {
// next function call will use mock implementation return value
var mockConfig = _this2._ensureMockConfig(f);
mockConfig.isReturnValueLastSet = false;
mockConfig.mockImpl = fn;
return f;
};
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
});
f.mockReturnThis = function () {return (
f.mockImplementation(function () {
return this;
}));};
var _createClass = unwrapExports(createClass);
if (metadata.mockImpl) {
f.mockImplementation(metadata.mockImpl);
}
// most Object methods by ES6 should accept primitives
f.mockRestore = restore ? restore : function () {};
var _objectSap = function(KEY, exec){
var fn = (_core.Object || {})[KEY] || Object[KEY]
, exp = {};
exp[KEY] = exec(fn);
_export(_export.S + _export.F * _fails(function(){ fn(1); }), 'Object', exp);
};
return f;
} else {
var unknownType = metadata.type || 'undefined type';
throw new Error('Unrecognized type ' + unknownType);
}
} }, { key: '_createMockFunction', value: function _createMockFunction(
// 19.1.2.14 Object.keys(O)
metadata,
mockConstructor)
{
var name = metadata.name;
// Special case functions named `mockConstructor` to guard for infinite
// loops.
if (!name || name === MOCK_CONSTRUCTOR_NAME) {
return mockConstructor;
}
_objectSap('keys', function(){
return function keys(it){
return _objectKeys(_toObject(it));
};
});
// Preserve `name` property of mocked function.
var boundFunctionPrefix = 'bound ';
var bindCall = '';
// if-do-while for perf reasons. The common case is for the if to fail.
if (name && name.startsWith(boundFunctionPrefix)) {
do {
name = name.substring(boundFunctionPrefix.length);
// Call bind() just to alter the function name.
bindCall = '.bind(null)';
} while (name && name.startsWith(boundFunctionPrefix));
}
var keys$1 = _core.Object.keys;
// It's a syntax error to define functions with a reserved keyword
// as name.
if (RESERVED_KEYWORDS[name]) {
name = '$' + name;
}
var keys = createCommonjsModule(function (module) {
module.exports = { "default": keys$1, __esModule: true };
});
// It's also a syntax error to define a function with a reserved character
// as part of it's name.
if (/[\s-]/.test(name)) {
name = name.replace(/[\s-]/g, '$');
}
var _Object$keys = unwrapExports(keys);
var body =
'return function ' +
name +
'() {' +
'return ' +
MOCK_CONSTRUCTOR_NAME +
'.apply(this,arguments);' +
'}' +
bindCall;
var createConstructor = new this._environmentGlobal.Function(
MOCK_CONSTRUCTOR_NAME,
body);
var gOPD = Object.getOwnPropertyDescriptor;
return createConstructor(mockConstructor);
} }, { key: '_generateMock', value: function _generateMock(
var f$3 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P){
O = _toIobject(O);
P = _toPrimitive(P, true);
if(_ie8DomDefine)try {
return gOPD(O, P);
} catch(e){ /* empty */ }
if(_has(O, P))return _propertyDesc(!_objectPie.f.call(O, P), O[P]);
};
var _objectGopd = {
f: f$3
};
metadata,
callbacks,
refs)
{var _this3 = this;
var mock = this._makeComponent(metadata);
if (metadata.refID != null) {
refs[metadata.refID] = mock;
}
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var $getOwnPropertyDescriptor = _objectGopd.f;
getSlots(metadata.members).forEach(function (slot) {
var slotMetadata = metadata.members && metadata.members[slot] || {};
if (slotMetadata.ref != null) {
callbacks.push(function () {return mock[slot] = refs[slotMetadata.ref];});
} else {
mock[slot] = _this3._generateMock(slotMetadata, callbacks, refs);
}
});
_objectSap('getOwnPropertyDescriptor', function(){
return function getOwnPropertyDescriptor(it, key){
return $getOwnPropertyDescriptor(_toIobject(it), key);
};
});
if (
metadata.type !== 'undefined' &&
metadata.type !== 'null' &&
mock.prototype)
{
mock.prototype.constructor = mock;
}
var $Object$1 = _core.Object;
var getOwnPropertyDescriptor$1 = function getOwnPropertyDescriptor(it, key){
return $Object$1.getOwnPropertyDescriptor(it, key);
};
return mock;
var getOwnPropertyDescriptor = createCommonjsModule(function (module) {
module.exports = { "default": getOwnPropertyDescriptor$1, __esModule: true };
});
var _Object$getOwnPropertyDescriptor = unwrapExports(getOwnPropertyDescriptor);
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var hiddenKeys = _enumBugKeys.concat('length', 'prototype');
var f$5 = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
return _objectKeysInternal(O, hiddenKeys);
};
var _objectGopn = {
f: f$5
};
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var gOPN = _objectGopn.f;
var toString$1 = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function(it){
try {
return gOPN(it);
} catch(e){
return windowNames.slice();
}
};
var f$4 = function getOwnPropertyNames(it){
return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it));
};
var _objectGopnExt = {
f: f$4
};
// 19.1.2.7 Object.getOwnPropertyNames(O)
_objectSap('getOwnPropertyNames', function(){
return _objectGopnExt.f;
});
var $Object$2 = _core.Object;
var getOwnPropertyNames$1 = function getOwnPropertyNames(it){
return $Object$2.getOwnPropertyNames(it);
};
var getOwnPropertyNames = createCommonjsModule(function (module) {
module.exports = { "default": getOwnPropertyNames$1, __esModule: true };
});
var _Object$getOwnPropertyNames = unwrapExports(getOwnPropertyNames);
// 19.1.2.9 Object.getPrototypeOf(O)
_objectSap('getPrototypeOf', function(){
return function getPrototypeOf(it){
return _objectGpo(_toObject(it));
};
});
var getPrototypeOf$1 = _core.Object.getPrototypeOf;
var getPrototypeOf = createCommonjsModule(function (module) {
module.exports = { "default": getPrototypeOf$1, __esModule: true };
});
var _Object$getPrototypeOf = unwrapExports(getPrototypeOf);
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
_export(_export.S, 'Object', {create: _objectCreate});
var $Object$3 = _core.Object;
var create$1 = function create(P, D){
return $Object$3.create(P, D);
};
var create = createCommonjsModule(function (module) {
module.exports = { "default": create$1, __esModule: true };
});
var _Object$create = unwrapExports(create);
// 19.1.3.1 Object.assign(target, source)
_export(_export.S + _export.F, 'Object', {assign: _objectAssign});
var assign$1 = _core.Object.assign;
var assign = createCommonjsModule(function (module) {
module.exports = { "default": assign$1, __esModule: true };
});
var _Object$assign = unwrapExports(assign);
var index = createCommonjsModule(function (module) {
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
var MOCK_CONSTRUCTOR_NAME = 'mockConstructor';
// $FlowFixMe
var RESERVED_KEYWORDS = _Object$assign(_Object$create(null), {
arguments: true,
await: true,
break: true,
case: true,
catch: true,
class: true,
const: true,
continue: true,
debugger: true,
default: true,
delete: true,
do: true,
else: true,
enum: true,
eval: true,
export: true,
extends: true,
false: true,
finally: true,
for: true,
function: true,
if: true,
implements: true,
import: true,
in: true,
instanceof: true,
interface: true,
let: true,
new: true,
null: true,
package: true,
private: true,
protected: true,
public: true,
return: true,
static: true,
super: true,
switch: true,
this: true,
throw: true,
true: true,
try: true,
typeof: true,
var: true,
void: true,
while: true,
with: true,
yield: true
});
function isA(typeName, value) {
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
}
function getType(ref) {
if (isA('Function', ref) || isA('AsyncFunction', ref)) {
return 'function';
} else if (Array.isArray(ref)) {
return 'array';
} else if (isA('Object', ref)) {
return 'object';
} else if (isA('Number', ref) || isA('String', ref) || isA('Boolean', ref) || isA('Symbol', ref)) {
return 'constant';
} else if (isA('Map', ref) || isA('WeakMap', ref) || isA('Set', ref)) {
return 'collection';
} else if (isA('RegExp', ref)) {
return 'regexp';
} else if (ref === undefined) {
return 'undefined';
} else if (ref === null) {
return 'null';
} else {
return null;
}
}
/**
* @see README.md
* @param metadata Metadata for the mock in the schema returned by the
* getMetadata method of this module.
*/ }, { key: 'generateFromMetadata', value: function generateFromMetadata(
_metadata) {
var callbacks = [];
var refs = {};
var mock = this._generateMock(_metadata, callbacks, refs);
callbacks.forEach(function (setter) {return setter();});
return mock;
function isReadonlyProp(object, prop) {
return (prop === 'arguments' || prop === 'caller' || prop === 'callee' || prop === 'name' || prop === 'length') && (isA('Function', object) || isA('AsyncFunction', object)) || (prop === 'source' || prop === 'global' || prop === 'ignoreCase' || prop === 'multiline') && isA('RegExp', object);
}
function getSlots(object) {
var slots = {};
if (!object) {
return [];
}
/**
* @see README.md
* @param component The component for which to retrieve metadata.
*/ }, { key: 'getMetadata', value: function getMetadata(
component, _refs) {var _this4 = this;
var refs = _refs || new _map2.default();
var ref = refs.get(component);
if (ref != null) {
return { ref: ref };
var parent = _Object$getPrototypeOf(object);
do {
if (object === _Object$getPrototypeOf(Function)) {
break;
}
var type = getType(component);
if (!type) {
return null;
var ownNames = _Object$getOwnPropertyNames(object);
for (var i = 0; i < ownNames.length; i++) {
var prop = ownNames[i];
if (!isReadonlyProp(object, prop)) {
var propDesc = _Object$getOwnPropertyDescriptor(object, prop);
if (!propDesc.get || object.__esModule) {
slots[prop] = true;
}
}
}
object = parent;
} while (object && (parent = _Object$getPrototypeOf(object)) !== null);
return _Object$keys(slots);
}
var metadata = { type: type };
if (
type === 'constant' ||
type === 'collection' ||
type === 'undefined' ||
type === 'null')
{
metadata.value = component;
return metadata;
} else if (type === 'function') {
metadata.name = component.name;
if (component._isMockFunction) {
metadata.mockImpl = component.getMockImplementation();
var ModuleMockerClass = function () {
/**
* @see README.md
* @param global Global object of the test environment, used to create
* mocks
*/
function ModuleMockerClass(global) {
_classCallCheck(this, ModuleMockerClass);
this._environmentGlobal = global;
this._mockState = new _WeakMap();
this._mockConfigRegistry = new _WeakMap();
this.ModuleMocker = ModuleMockerClass;
}
_createClass(ModuleMockerClass, [{
key: '_ensureMockConfig',
value: function _ensureMockConfig(f) {
var config = this._mockConfigRegistry.get(f);
if (!config) {
config = this._defaultMockConfig();
this._mockConfigRegistry.set(f, config);
}
return config;
}
}, {
key: '_ensureMockState',
value: function _ensureMockState(f) {
var state = this._mockState.get(f);
if (!state) {
state = this._defaultMockState();
this._mockState.set(f, state);
}
return state;
}
}, {
key: '_defaultMockConfig',
value: function _defaultMockConfig() {
return {
defaultReturnValue: undefined,
isReturnValueLastSet: false,
mockImpl: undefined,
specificMockImpls: [],
specificReturnValues: []
};
}
}, {
key: '_defaultMockState',
value: function _defaultMockState() {
return {
calls: [],
instances: []
};
}
}, {
key: '_makeComponent',
value: function _makeComponent(metadata, restore) {
var _this2 = this;
metadata.refID = refs.size;
refs.set(component, metadata.refID);
if (metadata.type === 'object') {
return new this._environmentGlobal.Object();
} else if (metadata.type === 'array') {
return new this._environmentGlobal.Array();
} else if (metadata.type === 'regexp') {
return new this._environmentGlobal.RegExp('');
} else if (metadata.type === 'constant' || metadata.type === 'collection' || metadata.type === 'null' || metadata.type === 'undefined') {
return metadata.value;
} else if (metadata.type === 'function') {
/* eslint-disable prefer-const */
var f = void 0;
/* eslint-enable prefer-const */
var members = null;
// Leave arrays alone
if (type !== 'array') {
if (type !== 'undefined') {
getSlots(component).forEach(function (slot) {
if (
type === 'function' &&
component._isMockFunction &&
slot.match(/^mock/))
{
return;
var prototype = metadata.members && metadata.members.prototype && metadata.members.prototype.members || {};
var prototypeSlots = getSlots(prototype);
var mocker = this;
var mockConstructor = function mockConstructor() {
var _this = this;
var mockState = mocker._ensureMockState(f);
var mockConfig = mocker._ensureMockConfig(f);
mockState.instances.push(this);
mockState.calls.push(Array.prototype.slice.call(arguments));
if (this instanceof f) {
// This is probably being called as a constructor
prototypeSlots.forEach(function (slot) {
// Copy prototype methods to the instance to make
// it easier to interact with mock instance call and
// return values
if (prototype[slot].type === 'function') {
var protoImpl = _this[slot];
_this[slot] = mocker.generateFromMetadata(prototype[slot]);
_this[slot]._protoImpl = protoImpl;
}
});
// Run the mock constructor implementation
return mockConfig.mockImpl && mockConfig.mockImpl.apply(this, arguments);
}
if (
!component.hasOwnProperty && component[slot] !== undefined ||
component.hasOwnProperty && component.hasOwnProperty(slot) ||
type === 'object' && component[slot] != Object.prototype[slot])
{
var slotMetadata = _this4.getMetadata(component[slot], refs);
if (slotMetadata) {
if (!members) {
members = {};
}
members[slot] = slotMetadata;
var returnValue = mockConfig.defaultReturnValue;
// If return value is last set, either specific or default, i.e.
// mockReturnValueOnce()/mockReturnValue() is called and no
// mockImplementationOnce()/mockImplementation() is called after that.
// use the set return value.
if (mockConfig.specificReturnValues.length) {
return mockConfig.specificReturnValues.shift();
}
if (mockConfig.isReturnValueLastSet) {
return mockConfig.defaultReturnValue;
}
// If mockImplementationOnce()/mockImplementation() is last set,
// or specific return values are used up, use the mock implementation.
var specificMockImpl = void 0;
if (returnValue === undefined) {
specificMockImpl = mockConfig.specificMockImpls.shift();
if (specificMockImpl === undefined) {
specificMockImpl = mockConfig.mockImpl;
}
if (specificMockImpl) {
return specificMockImpl.apply(this, arguments);
}
}
// Otherwise use prototype implementation
if (returnValue === undefined && f._protoImpl) {
return f._protoImpl.apply(this, arguments);
}
return returnValue;
};
f = this._createMockFunction(metadata, mockConstructor);
f._isMockFunction = true;
f.getMockImplementation = function () {
return _this2._ensureMockConfig(f).mockImpl;
};
this._mockState.set(f, this._defaultMockState());
this._mockConfigRegistry.set(f, this._defaultMockConfig());
// $FlowFixMe - defineProperty getters not supported
Object.defineProperty(f, 'mock', {
configurable: false,
enumerable: true,
get: function get() {
return _this2._ensureMockState(f);
},
set: function set(val) {
return _this2._mockState.set(f, val);
}
});
}
// If component is native code function, prototype might be undefined
if (type === 'function' && component.prototype) {
var prototype = this.getMetadata(component.prototype, refs);
if (prototype && prototype.members) {
if (!members) {
members = {};
}
members.prototype = prototype;
f.mockClear = function () {
_this2._mockState.delete(f);
};
f.mockReset = function () {
_this2._mockState.delete(f);
_this2._mockConfigRegistry.delete(f);
};
f.mockReturnValueOnce = function (value) {
// next function call will return this value or default return value
var mockConfig = _this2._ensureMockConfig(f);
mockConfig.specificReturnValues.push(value);
return f;
};
f.mockReturnValue = function (value) {
// next function call will return specified return value or this one
var mockConfig = _this2._ensureMockConfig(f);
mockConfig.isReturnValueLastSet = true;
mockConfig.defaultReturnValue = value;
return f;
};
f.mockImplementationOnce = function (fn) {
// next function call will use this mock implementation return value
// or default mock implementation return value
var mockConfig = _this2._ensureMockConfig(f);
mockConfig.isReturnValueLastSet = false;
mockConfig.specificMockImpls.push(fn);
return f;
};
f.mockImplementation = function (fn) {
// next function call will use mock implementation return value
var mockConfig = _this2._ensureMockConfig(f);
mockConfig.isReturnValueLastSet = false;
mockConfig.mockImpl = fn;
return f;
};
f.mockReturnThis = function () {
return f.mockImplementation(function () {
return this;
});
};
if (metadata.mockImpl) {
f.mockImplementation(metadata.mockImpl);
}
f.mockRestore = restore ? restore : function () {};
return f;
} else {
var unknownType = metadata.type || 'undefined type';
throw new Error('Unrecognized type ' + unknownType);
}
}
}, {
key: '_createMockFunction',
value: function _createMockFunction(metadata, mockConstructor) {
var name = metadata.name;
if (!name) {
return mockConstructor;
}
if (members) {
metadata.members = members;
}
// Preserve `name` property of mocked function.
var boundFunctionPrefix = 'bound ';
var bindCall = '';
// if-do-while for perf reasons. The common case is for the if to fail.
if (name && name.startsWith(boundFunctionPrefix)) {
do {
name = name.substring(boundFunctionPrefix.length);
// Call bind() just to alter the function name.
bindCall = '.bind(null)';
} while (name && name.startsWith(boundFunctionPrefix));
}
return metadata;
} }, { key: 'isMockFunction', value: function isMockFunction(
// Special case functions named `mockConstructor` to guard for infinite
// loops.
if (name === MOCK_CONSTRUCTOR_NAME) {
return mockConstructor;
}
fn) {
return !!fn._isMockFunction;
} }, { key: 'fn', value: function fn(
// It's a syntax error to define functions with a reserved keyword
// as name.
if (RESERVED_KEYWORDS[name]) {
name = '$' + name;
}
implementation) {
var fn = this._makeComponent({ type: 'function' });
if (implementation) {
fn.mockImplementation(implementation);
// It's also a syntax error to define a function with a reserved character
// as part of it's name.
if (/[\s-]/.test(name)) {
name = name.replace(/[\s-]/g, '$');
}
var body = 'return function ' + name + '() {' + 'return ' + MOCK_CONSTRUCTOR_NAME + '.apply(this,arguments);' + '}' + bindCall;
var createConstructor = new this._environmentGlobal.Function(MOCK_CONSTRUCTOR_NAME, body);
return createConstructor(mockConstructor);
}
return fn;
} }, { key: 'spyOn', value: function spyOn(
}, {
key: '_generateMock',
value: function _generateMock(metadata, callbacks, refs) {
var _this3 = this;
object, methodName) {
var original = object[methodName];
var mock = this._makeComponent(metadata);
if (metadata.refID != null) {
refs[metadata.refID] = mock;
}
if (!this.isMockFunction(original)) {
if (typeof original !== 'function') {
throw new Error(
'Cannot spyOn the ' + methodName + ' property; it is not a function');
getSlots(metadata.members).forEach(function (slot) {
var slotMetadata = metadata.members && metadata.members[slot] || {};
if (slotMetadata.ref != null) {
callbacks.push(function () {
return mock[slot] = refs[slotMetadata.ref];
});
} else {
mock[slot] = _this3._generateMock(slotMetadata, callbacks, refs);
}
});
if (metadata.type !== 'undefined' && metadata.type !== 'null' && mock.prototype) {
mock.prototype.constructor = mock;
}
object[methodName] = this._makeComponent({ type: 'function' }, function () {
object[methodName] = original;
return mock;
}
/**
* @see README.md
* @param metadata Metadata for the mock in the schema returned by the
* getMetadata method of this module.
*/
}, {
key: 'generateFromMetadata',
value: function generateFromMetadata(_metadata) {
var callbacks = [];
var refs = {};
var mock = this._generateMock(_metadata, callbacks, refs);
callbacks.forEach(function (setter) {
return setter();
});
object[methodName].mockImplementation(function () {
return original.apply(this, arguments);
});
return mock;
}
return object[methodName];
} }, { key: 'clearAllMocks', value: function clearAllMocks()
/**
* @see README.md
* @param component The component for which to retrieve metadata.
*/
{
this._mockState = new _weakMap2.default();
} }, { key: 'resetAllMocks', value: function resetAllMocks()
}, {
key: 'getMetadata',
value: function getMetadata(component, _refs) {
var _this4 = this;
{
this._mockConfigRegistry = new _weakMap2.default();
this._mockState = new _weakMap2.default();
} }]);return ModuleMockerClass;}();
var refs = _refs || new _Map();
var ref = refs.get(component);
if (ref != null) {
return { ref: ref };
}
var type = getType(component);
if (!type) {
return null;
}
var metadata = { type: type };
if (type === 'constant' || type === 'collection' || type === 'undefined' || type === 'null') {
metadata.value = component;
return metadata;
} else if (type === 'function') {
metadata.name = component.name;
if (component._isMockFunction) {
metadata.mockImpl = component.getMockImplementation();
}
}
module.exports = new ModuleMockerClass(global);
metadata.refID = refs.size;
refs.set(component, metadata.refID);
var members = null;
// Leave arrays alone
if (type !== 'array') {
if (type !== 'undefined') {
getSlots(component).forEach(function (slot) {
if (type === 'function' && component._isMockFunction && slot.match(/^mock/)) {
return;
}
if (!component.hasOwnProperty && component[slot] !== undefined || component.hasOwnProperty && component.hasOwnProperty(slot) || type === 'object' && component[slot] != Object.prototype[slot]) {
var slotMetadata = _this4.getMetadata(component[slot], refs);
if (slotMetadata) {
if (!members) {
members = {};
}
members[slot] = slotMetadata;
}
}
});
}
// If component is native code function, prototype might be undefined
if (type === 'function' && component.prototype) {
var prototype = this.getMetadata(component.prototype, refs);
if (prototype && prototype.members) {
if (!members) {
members = {};
}
members.prototype = prototype;
}
}
}
if (members) {
metadata.members = members;
}
return metadata;
}
}, {
key: 'isMockFunction',
value: function isMockFunction(fn) {
return !!fn._isMockFunction;
}
}, {
key: 'fn',
value: function fn(implementation) {
var fn = this._makeComponent({ type: 'function' });
if (implementation) {
fn.mockImplementation(implementation);
}
return fn;
}
}, {
key: 'spyOn',
value: function spyOn(object, methodName) {
var original = object[methodName];
if (!this.isMockFunction(original)) {
if (typeof original !== 'function') {
throw new Error('Cannot spyOn the ' + methodName + ' property; it is not a function');
}
object[methodName] = this._makeComponent({ type: 'function' }, function () {
object[methodName] = original;
});
object[methodName].mockImplementation(function () {
return original.apply(this, arguments);
});
}
return object[methodName];
}
}, {
key: 'clearAllMocks',
value: function clearAllMocks() {
this._mockState = new _WeakMap();
}
}, {
key: 'resetAllMocks',
value: function resetAllMocks() {
this._mockConfigRegistry = new _WeakMap();
this._mockState = new _WeakMap();
}
}]);
return ModuleMockerClass;
}();
module.exports = new ModuleMockerClass(commonjsGlobal);
});
var index$1 = unwrapExports(index);
return index$1;
})));

@@ -265,3 +265,3 @@ 'use strict';

let returnValue;
const returnValue = mockConfig.defaultReturnValue;
// If return value is last set, either specific or default, i.e.

@@ -271,9 +271,8 @@ // mockReturnValueOnce()/mockReturnValue() is called and no

// use the set return value.
if (mockConfig.specificReturnValues.length) {
return mockConfig.specificReturnValues.shift();
}
if (mockConfig.isReturnValueLastSet) {
returnValue = mockConfig.specificReturnValues.shift();
if (returnValue === undefined) {
returnValue = mockConfig.defaultReturnValue;
}
return returnValue;
return mockConfig.defaultReturnValue;
}

@@ -329,3 +328,2 @@

const mockConfig = this._ensureMockConfig(f);
mockConfig.isReturnValueLastSet = true;
mockConfig.specificReturnValues.push(value);

@@ -383,5 +381,3 @@ return f;

let name = metadata.name;
// Special case functions named `mockConstructor` to guard for infinite
// loops.
if (!name || name === MOCK_CONSTRUCTOR_NAME) {
if (!name) {
return mockConstructor;

@@ -402,2 +398,8 @@ }

// Special case functions named `mockConstructor` to guard for infinite
// loops.
if (name === MOCK_CONSTRUCTOR_NAME) {
return mockConstructor;
}
// It's a syntax error to define functions with a reserved keyword

@@ -404,0 +406,0 @@ // as name.

{
"name": "jest-mock",
"version": "20.0.3",
"version": "20.1.0-alpha.1",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

@@ -28,3 +28,3 @@ # jest-mock

```js
```
{

@@ -44,3 +44,3 @@ type: ...

```js
{
const classDef = {
type: 'function',

@@ -52,7 +52,7 @@ members: {

members: {
instanceMethod: {type: 'function'}
}
}
}
}
instanceMethod: {type: 'function'},
},
},
},
};
```

@@ -67,9 +67,9 @@

```js
{
const refID = {
type: 'object',
refID: 1,
members: {
self: {ref: 1}
}
}
self: {ref: 1},
},
};
```

@@ -76,0 +76,0 @@

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