index.js.map 56.8 KB
Newer Older
1
{"version":3,"sources":["webpack://jestMock/webpack/universalModuleDefinition","webpack://jestMock/webpack/bootstrap","webpack://jestMock/(webpack)/buildin/global.js","webpack://jestMock/./packages/jest-mock/src/index.ts"],"names":["g","Function","e","window","module","exports","MOCK_CONSTRUCTOR_NAME","FUNCTION_NAME_RESERVED_PATTERN","FUNCTION_NAME_RESERVED_REPLACE","RegExp","source","RESERVED_KEYWORDS","Set","matchArity","fn","length","mockConstructor","_a","apply","arguments","_b","_c","_d","_e","_f","_g","_h","_i","getObjectType","value","Object","prototype","toString","slice","getType","ref","typeName","Array","isArray","undefined","isReadonlyProp","object","prop","ModuleMockerClass","global","_environmentGlobal","_mockState","WeakMap","_mockConfigRegistry","_spyState","ModuleMocker","_invocationCallCounter","slots","EnvObjectProto","EnvFunctionProto","EnvRegExpProto","ObjectProto","FunctionProto","RegExpProto","ownNames","getOwnPropertyNames","i","propDesc","getOwnPropertyDescriptor","get","__esModule","add","getPrototypeOf","from","f","config","_defaultMockConfig","set","state","_defaultMockState","mockImpl","mockName","specificMockImpls","specificReturnValues","calls","instances","invocationCallOrder","results","metadata","restore","type","members","prototypeSlots","_getSlots","mocker","args","mockState","_ensureMockState","mockConfig","_ensureMockConfig","push","mockResult","finalReturnValue","thrownError","callDidThrowError","forEach","slot","protoImpl","generateFromMetadata","_protoImpl","shift","specificMockImpl","error","_createMockFunction","_isMockFunction","getMockImplementation","defineProperty","configurable","enumerable","val","mockClear","delete","mockReset","mockRestore","mockReturnValueOnce","mockImplementationOnce","mockResolvedValueOnce","Promise","resolve","mockRejectedValueOnce","reject","mockReturnValue","mockImplementation","mockResolvedValue","mockRejectedValue","mockReturnThis","name","getMockName","unknownType","Error","boundFunctionPrefix","bindCall","startsWith","substring","has","test","replace","body","createConstructor","callbacks","refs","mock","_makeComponent","refID","slotMetadata","_generateMock","constructor","_metadata","setter","component","_refs","Map","size","match","getMetadata","implementation","methodName","accessType","_spyOnProperty","_typeOf","original","isMockFunction","isMethodOwner","hasOwnProperty","obj","propertyName","descriptor","proto","JestMock"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;;AClFA,IAAIA,CAAJ,C,CAEA;;AACAA,CAAC,GAAI,YAAW;AACf,SAAO,IAAP;AACA,CAFG,EAAJ;;AAIA,IAAI;AACH;AACAA,GAAC,GAAGA,CAAC,IAAI,IAAIC,QAAJ,CAAa,aAAb,GAAT;AACA,CAHD,CAGE,OAAOC,CAAP,EAAU;AACX;AACA,MAAI,QAAOC,MAAP,yCAAOA,MAAP,OAAkB,QAAtB,EAAgCH,CAAC,GAAGG,MAAJ;AAChC,C,CAED;AACA;AACA;;;AAEAC,MAAM,CAACC,OAAP,GAAiBL,CAAjB,C;;;;;;;;;;;;;;;;;;;;;;ACnBA;;;;;;;AAqCA;;;;;;;;;AAUA;;;AAgCA;AA0CA,IAAMM,qBAAqB,GAAG,iBAA9B;AAEA,IAAMC,8BAA8B,GAAG,oBAAvC;AACA,IAAMC,8BAA8B,GAAG,IAAIC,MAAJ,CACrCF,8BAA8B,CAACG,MADM,EAErC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AG,IAAIlI,iBAAJ,CAAsBC,MAAtB,CAAjB;iBACSiI,Q","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"jestMock\"] = factory();\n\telse\n\t\troot[\"jestMock\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./packages/jest-mock/src/index.ts\");\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\ntype Global = NodeJS.Global; // | Window – add once TS improves typings;\n\nnamespace JestMock {\n  export type ModuleMocker = ModuleMockerClass;\n  export type MockFunctionMetadataType =\n    | 'object'\n    | 'array'\n    | 'regexp'\n    | 'function'\n    | 'constant'\n    | 'collection'\n    | 'null'\n    | 'undefined';\n\n  export type MockFunctionMetadata<\n    T,\n    Y extends Array<unknown>,\n    Type = MockFunctionMetadataType\n  > = {\n    ref?: number;\n    members?: Record<string, MockFunctionMetadata<T, Y>>;\n    mockImpl?: (...args: Y) => T;\n    name?: string;\n    refID?: number;\n    type?: Type;\n    value?: T;\n    length?: number;\n  };\n}\n\n/**\n * Possible types of a MockFunctionResult.\n * 'return': The call completed by returning normally.\n * 'throw': The call completed by throwing a value.\n * 'incomplete': The call has not completed yet. This is possible if you read\n *               the  mock function result from within the mock function itself\n *               (or a function called by the mock function).\n */\ntype MockFunctionResultType = 'return' | 'throw' | 'incomplete';\n\n/**\n * Represents the result of a single call to a mock function.\n */\ntype MockFunctionResult = {\n  /**\n   * Indicates how the call completed.\n   */\n  type: MockFunctionResultType;\n  /**\n   * The value that was either thrown or returned by the function.\n   * Undefined when type === 'incomplete'.\n   */\n  value: unknown;\n};\n\ntype MockFunctionState<T, Y extends Array<unknown>> = {\n  calls: Array<Y>;\n  instances: Array<T>;\n  invocationCallOrder: Array<number>;\n  /**\n   * List of results of calls to the mock function.\n   */\n  results: Array<MockFunctionResult>;\n};\n\ntype MockFunctionConfig = {\n  mockImpl: Function | undefined;\n  mockName: string;\n  specificReturnValues: Array<unknown>;\n  specificMockImpls: Array<Function>;\n};\n\n// see https://github.com/Microsoft/TypeScript/issues/25215\ntype NonFunctionPropertyNames<T> = {\n  [K in keyof T]: T[K] extends (...args: Array<any>) => any ? never : K;\n}[keyof T] &\n  string;\ntype FunctionPropertyNames<T> = {\n  [K in keyof T]: T[K] extends (...args: Array<any>) => any ? K : never;\n}[keyof T] &\n  string;\n\ninterface Mock<T, Y extends Array<unknown> = Array<unknown>>\n  extends Function,\n    MockInstance<T, Y> {\n  new (...args: Y): T;\n  (...args: Y): T;\n}\n\ninterface SpyInstance<T, Y extends Array<unknown>> extends MockInstance<T, Y> {}\n\ninterface MockInstance<T, Y extends Array<unknown>> {\n  _isMockFunction: true;\n  _protoImpl: Function;\n  getMockName(): string;\n  getMockImplementation(): Function | undefined;\n  mock: MockFunctionState<T, Y>;\n  mockClear(): this;\n  mockReset(): this;\n  mockRestore(): void;\n  mockImplementation(fn: (...args: Y) => T): this;\n  mockImplementation(fn: () => Promise<T>): this;\n  mockImplementationOnce(fn: (...args: Y) => T): this;\n  mockImplementationOnce(fn: () => Promise<T>): this;\n  mockName(name: string): this;\n  mockReturnThis(): this;\n  mockReturnValue(value: T): this;\n  mockReturnValueOnce(value: T): this;\n  mockResolvedValue(value: T): this;\n  mockResolvedValueOnce(value: T): this;\n  mockRejectedValue(value: T): this;\n  mockRejectedValueOnce(value: T): this;\n}\n\nconst MOCK_CONSTRUCTOR_NAME = 'mockConstructor';\n\nconst FUNCTION_NAME_RESERVED_PATTERN = /[\\s!-\\/:-@\\[-`{-~]/;\nconst FUNCTION_NAME_RESERVED_REPLACE = new RegExp(\n  FUNCTION_NAME_RESERVED_PATTERN.source,\n  'g',\n);\n\nconst RESERVED_KEYWORDS = new Set([\n  'arguments',\n  'await',\n  'break',\n  'case',\n  'catch',\n  'class',\n  'const',\n  'continue',\n  'debugger',\n  'default',\n  'delete',\n  'do',\n  'else',\n  'enum',\n  'eval',\n  'export',\n  'extends',\n  'false',\n  'finally',\n  'for',\n  'function',\n  'if',\n  'implements',\n  'import',\n  'in',\n  'instanceof',\n  'interface',\n  'let',\n  'new',\n  'null',\n  'package',\n  'private',\n  'protected',\n  'public',\n  'return',\n  'static',\n  'super',\n  'switch',\n  'this',\n  'throw',\n  'true',\n  'try',\n  'typeof',\n  'var',\n  'void',\n  'while',\n  'with',\n  'yield',\n]);\n\nfunction matchArity(fn: Function, length: number): Function {\n  let mockConstructor;\n\n  switch (length) {\n    case 1:\n      mockConstructor = function (this: unknown, _a: unknown) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    case 2:\n      mockConstructor = function (this: unknown, _a: unknown, _b: unknown) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    case 3:\n      mockConstructor = function (\n        this: unknown,\n        _a: unknown,\n        _b: unknown,\n        _c: unknown,\n      ) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    case 4:\n      mockConstructor = function (\n        this: unknown,\n        _a: unknown,\n        _b: unknown,\n        _c: unknown,\n        _d: unknown,\n      ) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    case 5:\n      mockConstructor = function (\n        this: unknown,\n        _a: unknown,\n        _b: unknown,\n        _c: unknown,\n        _d: unknown,\n        _e: unknown,\n      ) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    case 6:\n      mockConstructor = function (\n        this: unknown,\n        _a: unknown,\n        _b: unknown,\n        _c: unknown,\n        _d: unknown,\n        _e: unknown,\n        _f: unknown,\n      ) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    case 7:\n      mockConstructor = function (\n        this: unknown,\n        _a: unknown,\n        _b: unknown,\n        _c: unknown,\n        _d: unknown,\n        _e: unknown,\n        _f: unknown,\n        _g: unknown,\n      ) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    case 8:\n      mockConstructor = function (\n        this: unknown,\n        _a: unknown,\n        _b: unknown,\n        _c: unknown,\n        _d: unknown,\n        _e: unknown,\n        _f: unknown,\n        _g: unknown,\n        _h: unknown,\n      ) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    case 9:\n      mockConstructor = function (\n        this: unknown,\n        _a: unknown,\n        _b: unknown,\n        _c: unknown,\n        _d: unknown,\n        _e: unknown,\n        _f: unknown,\n        _g: unknown,\n        _h: unknown,\n        _i: unknown,\n      ) {\n        return fn.apply(this, arguments);\n      };\n      break;\n    default:\n      mockConstructor = function (this: unknown) {\n        return fn.apply(this, arguments);\n      };\n      break;\n  }\n\n  return mockConstructor;\n}\n\nfunction getObjectType(value: unknown): string {\n  return Object.prototype.toString.apply(value).slice(8, -1);\n}\n\nfunction getType(ref?: unknown): JestMock.MockFunctionMetadataType | null {\n  const typeName = getObjectType(ref);\n  if (\n    typeName === 'Function' ||\n    typeName === 'AsyncFunction' ||\n    typeName === 'GeneratorFunction'\n  ) {\n    return 'function';\n  } else if (Array.isArray(ref)) {\n    return 'array';\n  } else if (typeName === 'Object') {\n    return 'object';\n  } else if (\n    typeName === 'Number' ||\n    typeName === 'String' ||\n    typeName === 'Boolean' ||\n    typeName === 'Symbol'\n  ) {\n    return 'constant';\n  } else if (\n    typeName === 'Map' ||\n    typeName === 'WeakMap' ||\n    typeName === 'Set'\n  ) {\n    return 'collection';\n  } else if (typeName === 'RegExp') {\n    return 'regexp';\n  } else if (ref === undefined) {\n    return 'undefined';\n  } else if (ref === null) {\n    return 'null';\n  } else {\n    return null;\n  }\n}\n\nfunction isReadonlyProp(object: any, prop: string): boolean {\n  if (\n    prop === 'arguments' ||\n    prop === 'caller' ||\n    prop === 'callee' ||\n    prop === 'name' ||\n    prop === 'length'\n  ) {\n    const typeName = getObjectType(object);\n    return (\n      typeName === 'Function' ||\n      typeName === 'AsyncFunction' ||\n      typeName === 'GeneratorFunction'\n    );\n  }\n\n  if (\n    prop === 'source' ||\n    prop === 'global' ||\n    prop === 'ignoreCase' ||\n    prop === 'multiline'\n  ) {\n    return getObjectType(object) === 'RegExp';\n  }\n\n  return false;\n}\n\nclass ModuleMockerClass {\n  private _environmentGlobal: Global;\n  private _mockState: WeakMap<Mock<any, any>, MockFunctionState<any, any>>;\n  private _mockConfigRegistry: WeakMap<Function, MockFunctionConfig>;\n  private _spyState: Set<() => void>;\n  private _invocationCallCounter: number;\n  ModuleMocker: typeof ModuleMockerClass;\n\n  /**\n   * @see README.md\n   * @param global Global object of the test environment, used to create\n   * mocks\n   */\n  constructor(global: Global) {\n    this._environmentGlobal = global;\n    this._mockState = new WeakMap();\n    this._mockConfigRegistry = new WeakMap();\n    this._spyState = new Set();\n    this.ModuleMocker = ModuleMockerClass;\n    this._invocationCallCounter = 1;\n  }\n\n  private _getSlots(object?: Record<string, any>): Array<string> {\n    if (!object) {\n      return [];\n    }\n\n    const slots = new Set<string>();\n    const EnvObjectProto = this._environmentGlobal.Object.prototype;\n    const EnvFunctionProto = this._environmentGlobal.Function.prototype;\n    const EnvRegExpProto = this._environmentGlobal.RegExp.prototype;\n\n    // Also check the builtins in the current context as they leak through\n    // core node modules.\n    const ObjectProto = Object.prototype;\n    const FunctionProto = Function.prototype;\n    const RegExpProto = RegExp.prototype;\n\n    // Properties of Object.prototype, Function.prototype and RegExp.prototype\n    // are never reported as slots\n    while (\n      object != null &&\n      object !== EnvObjectProto &&\n      object !== EnvFunctionProto &&\n      object !== EnvRegExpProto &&\n      object !== ObjectProto &&\n      object !== FunctionProto &&\n      object !== RegExpProto\n    ) {\n      const ownNames = Object.getOwnPropertyNames(object);\n\n      for (let i = 0; i < ownNames.length; i++) {\n        const prop = ownNames[i];\n\n        if (!isReadonlyProp(object, prop)) {\n          const propDesc = Object.getOwnPropertyDescriptor(object, prop);\n          // @ts-ignore Object.__esModule\n          if ((propDesc !== undefined && !propDesc.get) || object.__esModule) {\n            slots.add(prop);\n          }\n        }\n      }\n\n      object = Object.getPrototypeOf(object);\n    }\n\n    return Array.from(slots);\n  }\n\n  private _ensureMockConfig<T, Y extends Array<unknown>>(\n    f: Mock<T, Y>,\n  ): MockFunctionConfig {\n    let config = this._mockConfigRegistry.get(f);\n    if (!config) {\n      config = this._defaultMockConfig();\n      this._mockConfigRegistry.set(f, config);\n    }\n    return config;\n  }\n\n  private _ensureMockState<T, Y extends Array<unknown>>(\n    f: Mock<T, Y>,\n  ): MockFunctionState<T, Y> {\n    let state = this._mockState.get(f);\n    if (!state) {\n      state = this._defaultMockState();\n      this._mockState.set(f, state);\n    }\n    return state;\n  }\n\n  private _defaultMockConfig(): MockFunctionConfig {\n    return {\n      mockImpl: undefined,\n      mockName: 'jest.fn()',\n      specificMockImpls: [],\n      specificReturnValues: [],\n    };\n  }\n\n  private _defaultMockState<T, Y extends Array<unknown>>(): MockFunctionState<\n    T,\n    Y\n  > {\n    return {\n      calls: [],\n      instances: [],\n      invocationCallOrder: [],\n      results: [],\n    };\n  }\n\n  private _makeComponent<T, Y extends Array<unknown>>(\n    metadata: JestMock.MockFunctionMetadata<T, Y, 'object'>,\n    restore?: () => void,\n  ): Record<string, any>;\n  private _makeComponent<T, Y extends Array<unknown>>(\n    metadata: JestMock.MockFunctionMetadata<T, Y, 'array'>,\n    restore?: () => void,\n  ): Array<unknown>;\n  private _makeComponent<T, Y extends Array<unknown>>(\n    metadata: JestMock.MockFunctionMetadata<T, Y, 'regexp'>,\n    restore?: () => void,\n  ): RegExp;\n  private _makeComponent<T, Y extends Array<unknown>>(\n    metadata: JestMock.MockFunctionMetadata<\n      T,\n      Y,\n      'constant' | 'collection' | 'null' | 'undefined'\n    >,\n    restore?: () => void,\n  ): T;\n  private _makeComponent<T, Y extends Array<unknown>>(\n    metadata: JestMock.MockFunctionMetadata<T, Y, 'function'>,\n    restore?: () => void,\n  ): Mock<T, Y>;\n  private _makeComponent<T, Y extends Array<unknown>>(\n    metadata: JestMock.MockFunctionMetadata<T, Y>,\n    restore?: () => void,\n  ):\n    | Record<string, any>\n    | Array<unknown>\n    | RegExp\n    | T\n    | undefined\n    | Mock<T, Y> {\n    if (metadata.type === 'object') {\n      return new this._environmentGlobal.Object();\n    } else if (metadata.type === 'array') {\n      return new this._environmentGlobal.Array();\n    } else if (metadata.type === 'regexp') {\n      return new this._environmentGlobal.RegExp('');\n    } else if (\n      metadata.type === 'constant' ||\n      metadata.type === 'collection' ||\n      metadata.type === 'null' ||\n      metadata.type === 'undefined'\n    ) {\n      return metadata.value;\n    } else if (metadata.type === 'function') {\n      const prototype =\n        (metadata.members &&\n          metadata.members.prototype &&\n          metadata.members.prototype.members) ||\n        {};\n      const prototypeSlots = this._getSlots(prototype);\n      const mocker = this;\n      const mockConstructor = matchArity(function (this: T, ...args: Y) {\n        const mockState = mocker._ensureMockState(f);\n        const mockConfig = mocker._ensureMockConfig(f);\n        mockState.instances.push(this);\n        mockState.calls.push(args);\n        // Create and record an \"incomplete\" mock result immediately upon\n        // calling rather than waiting for the mock to return. This avoids\n        // issues caused by recursion where results can be recorded in the\n        // wrong order.\n        const mockResult: MockFunctionResult = {\n          type: 'incomplete',\n          value: undefined,\n        };\n        mockState.results.push(mockResult);\n        mockState.invocationCallOrder.push(mocker._invocationCallCounter++);\n\n        // Will be set to the return value of the mock if an error is not thrown\n        let finalReturnValue;\n        // Will be set to the error that is thrown by the mock (if it throws)\n        let thrownError;\n        // Will be set to true if the mock throws an error. The presence of a\n        // value in `thrownError` is not a 100% reliable indicator because a\n        // function could throw a value of undefined.\n        let callDidThrowError = false;\n\n        try {\n          // The bulk of the implementation is wrapped in an immediately\n          // executed arrow function so the return value of the mock function\n          // can be easily captured and recorded, despite the many separate\n          // return points within the logic.\n          finalReturnValue = (() => {\n            if (this instanceof f) {\n              // This is probably being called as a constructor\n              prototypeSlots.forEach(slot => {\n                // Copy prototype methods to the instance to make\n                // it easier to interact with mock instance call and\n                // return values\n                if (prototype[slot].type === 'function') {\n                  // @ts-ignore no index signature\n                  const protoImpl = this[slot];\n                  // @ts-ignore no index signature\n                  this[slot] = mocker.generateFromMetadata(prototype[slot]);\n                  // @ts-ignore no index signature\n                  this[slot]._protoImpl = protoImpl;\n                }\n              });\n\n              // Run the mock constructor implementation\n              const mockImpl = mockConfig.specificMockImpls.length\n                ? mockConfig.specificMockImpls.shift()\n                : mockConfig.mockImpl;\n              return mockImpl && mockImpl.apply(this, arguments);\n            }\n\n            // If mockImplementationOnce()/mockImplementation() is last set,\n            // implementation use the mock\n            let specificMockImpl = mockConfig.specificMockImpls.shift();\n            if (specificMockImpl === undefined) {\n              specificMockImpl = mockConfig.mockImpl;\n            }\n            if (specificMockImpl) {\n              return specificMockImpl.apply(this, arguments);\n            }\n            // Otherwise use prototype implementation\n            if (f._protoImpl) {\n              return f._protoImpl.apply(this, arguments);\n            }\n\n            return undefined;\n          })();\n        } catch (error) {\n          // Store the thrown error so we can record it, then re-throw it.\n          thrownError = error;\n          callDidThrowError = true;\n          throw error;\n        } finally {\n          // Record the result of the function.\n          // NOTE: Intentionally NOT pushing/indexing into the array of mock\n          //       results here to avoid corrupting results data if mockClear()\n          //       is called during the execution of the mock.\n          mockResult.type = callDidThrowError ? 'throw' : 'return';\n          mockResult.value = callDidThrowError ? thrownError : finalReturnValue;\n        }\n\n        return finalReturnValue;\n      }, metadata.length || 0);\n\n      const f = (this._createMockFunction(\n        metadata,\n        mockConstructor,\n      ) as unknown) as Mock<T, Y>;\n      f._isMockFunction = true;\n      f.getMockImplementation = () => this._ensureMockConfig(f).mockImpl;\n\n      if (typeof restore === 'function') {\n        this._spyState.add(restore);\n      }\n\n      this._mockState.set(f, this._defaultMockState<T, Y>());\n      this._mockConfigRegistry.set(f, this._defaultMockConfig());\n\n      Object.defineProperty(f, 'mock', {\n        configurable: false,\n        enumerable: true,\n        get: () => this._ensureMockState(f),\n        set: val => this._mockState.set(f, val),\n      });\n\n      f.mockClear = () => {\n        this._mockState.delete(f);\n        return f;\n      };\n\n      f.mockReset = () => {\n        f.mockClear();\n        this._mockConfigRegistry.delete(f);\n        return f;\n      };\n\n      f.mockRestore = () => {\n        f.mockReset();\n        return restore ? restore() : undefined;\n      };\n\n      f.mockReturnValueOnce = (value: T) =>\n        // next function call will return this value or default return value\n        f.mockImplementationOnce(() => value);\n\n      f.mockResolvedValueOnce = (value: T) =>\n        f.mockImplementationOnce(() => Promise.resolve(value));\n\n      f.mockRejectedValueOnce = (value: T) =>\n        f.mockImplementationOnce(() => Promise.reject(value));\n\n      f.mockReturnValue = (value: T) =>\n        // next function call will return specified return value or this one\n        f.mockImplementation(() => value);\n\n      f.mockResolvedValue = (value: T) =>\n        f.mockImplementation(() => Promise.resolve(value));\n\n      f.mockRejectedValue = (value: T) =>\n        f.mockImplementation(() => Promise.reject(value));\n\n      f.mockImplementationOnce = (\n        fn: ((...args: Y) => T) | (() => Promise<T>),\n      ): Mock<T, Y> => {\n        // next function call will use this mock implementation return value\n        // or default mock implementation return value\n        const mockConfig = this._ensureMockConfig(f);\n        mockConfig.specificMockImpls.push(fn);\n        return f;\n      };\n\n      f.mockImplementation = (\n        fn: ((...args: Y) => T) | (() => Promise<T>),\n      ): Mock<T, Y> => {\n        // next function call will use mock implementation return value\n        const mockConfig = this._ensureMockConfig(f);\n        mockConfig.mockImpl = fn;\n        return f;\n      };\n\n      f.mockReturnThis = () =>\n        f.mockImplementation(function (this: T) {\n          return this;\n        });\n\n      f.mockName = (name: string) => {\n        if (name) {\n          const mockConfig = this._ensureMockConfig(f);\n          mockConfig.mockName = name;\n        }\n        return f;\n      };\n\n      f.getMockName = () => {\n        const mockConfig = this._ensureMockConfig(f);\n        return mockConfig.mockName || 'jest.fn()';\n      };\n\n      if (metadata.mockImpl) {\n        f.mockImplementation(metadata.mockImpl);\n      }\n\n      return f;\n    } else {\n      const unknownType = metadata.type || 'undefined type';\n      throw new Error('Unrecognized type ' + unknownType);\n    }\n  }\n\n  private _createMockFunction<T, Y extends Array<unknown>>(\n    metadata: JestMock.MockFunctionMetadata<T, Y>,\n    mockConstructor: Function,\n  ): Function {\n    let name = metadata.name;\n    if (!name) {\n      return mockConstructor;\n    }\n\n    // Preserve `name` property of mocked function.\n    const boundFunctionPrefix = 'bound ';\n    let bindCall = '';\n    // if-do-while for perf reasons. The common case is for the if to fail.\n    if (name && name.startsWith(boundFunctionPrefix)) {\n      do {\n        name = name.substring(boundFunctionPrefix.length);\n        // Call bind() just to alter the function name.\n        bindCall = '.bind(null)';\n      } while (name && name.startsWith(boundFunctionPrefix));\n    }\n\n    // Special case functions named `mockConstructor` to guard for infinite\n    // loops.\n    if (name === MOCK_CONSTRUCTOR_NAME) {\n      return mockConstructor;\n    }\n\n    if (\n      // It's a syntax error to define functions with a reserved keyword\n      // as name.\n      RESERVED_KEYWORDS.has(name) ||\n      // It's also a syntax error to define functions with a name that starts with a number\n      /^\\d/.test(name)\n    ) {\n      name = '$' + name;\n    }\n\n    // It's also a syntax error to define a function with a reserved character\n    // as part of it's name.\n    if (FUNCTION_NAME_RESERVED_PATTERN.test(name)) {\n      name = name.replace(FUNCTION_NAME_RESERVED_REPLACE, '$');\n    }\n\n    const body =\n      'return function ' +\n      name +\n      '() {' +\n      'return ' +\n      MOCK_CONSTRUCTOR_NAME +\n      '.apply(this,arguments);' +\n      '}' +\n      bindCall;\n    const createConstructor = new this._environmentGlobal.Function(\n      MOCK_CONSTRUCTOR_NAME,\n      body,\n    );\n\n    return createConstructor(mockConstructor);\n  }\n\n  private _generateMock<T, Y extends Array<unknown>>(\n    metadata: JestMock.MockFunctionMetadata<T, Y>,\n    callbacks: Array<Function>,\n    refs: {\n      [key: string]:\n        | Record<string, any>\n        | Array<unknown>\n        | RegExp\n        | T\n        | undefined\n        | Mock<T, Y>;\n    },\n  ): Mock<T, Y> {\n    // metadata not compatible but it's the same type, maybe problem with\n    // overloading of _makeComponent and not _generateMock?\n    // @ts-ignore\n    const mock = this._makeComponent(metadata);\n    if (metadata.refID != null) {\n      refs[metadata.refID] = mock;\n    }\n\n    this._getSlots(metadata.members).forEach(slot => {\n      const slotMetadata = (metadata.members && metadata.members[slot]) || {};\n      if (slotMetadata.ref != null) {\n        callbacks.push(\n          (function (ref) {\n            return () => (mock[slot] = refs[ref]);\n          })(slotMetadata.ref),\n        );\n      } else {\n        mock[slot] = this._generateMock(slotMetadata, callbacks, refs);\n      }\n    });\n\n    if (\n      metadata.type !== 'undefined' &&\n      metadata.type !== 'null' &&\n      mock.prototype &&\n      typeof mock.prototype === 'object'\n    ) {\n      mock.prototype.constructor = mock;\n    }\n\n    return mock;\n  }\n\n  /**\n   * @see README.md\n   * @param _metadata Metadata for the mock in the schema returned by the\n   * getMetadata method of this module.\n   */\n  generateFromMetadata<T, Y extends Array<unknown>>(\n    _metadata: JestMock.MockFunctionMetadata<T, Y>,\n  ): Mock<T, Y> {\n    const callbacks: Array<Function> = [];\n    const refs = {};\n    const mock = this._generateMock(_metadata, callbacks, refs);\n    callbacks.forEach(setter => setter());\n    return mock;\n  }\n\n  /**\n   * @see README.md\n   * @param component The component for which to retrieve metadata.\n   */\n  getMetadata<T, Y extends Array<unknown>>(\n    component: T,\n    _refs?: Map<T, number>,\n  ): JestMock.MockFunctionMetadata<T, Y> | null {\n    const refs = _refs || new Map<T, number>();\n    const ref = refs.get(component);\n    if (ref != null) {\n      return {ref};\n    }\n\n    const type = getType(component);\n    if (!type) {\n      return null;\n    }\n\n    const metadata: JestMock.MockFunctionMetadata<T, Y> = {type};\n    if (\n      type === 'constant' ||\n      type === 'collection' ||\n      type === 'undefined' ||\n      type === 'null'\n    ) {\n      metadata.value = component;\n      return metadata;\n    } else if (type === 'function') {\n      // @ts-ignore this is a function so it has a name\n      metadata.name = component.name;\n      // @ts-ignore may be a mock\n      if (component._isMockFunction === true) {\n        // @ts-ignore may be a mock\n        metadata.mockImpl = component.getMockImplementation();\n      }\n    }\n\n    metadata.refID = refs.size;\n    refs.set(component, metadata.refID);\n\n    let members: {\n      [key: string]: JestMock.MockFunctionMetadata<T, Y>;\n    } | null = null;\n    // Leave arrays alone\n    if (type !== 'array') {\n      this._getSlots(component).forEach(slot => {\n        if (\n          type === 'function' &&\n          // @ts-ignore may be a mock\n          component._isMockFunction === true &&\n          slot.match(/^mock/)\n        ) {\n          return;\n        }\n        // @ts-ignore no index signature\n        const slotMetadata = this.getMetadata<T, Y>(component[slot], refs);\n        if (slotMetadata) {\n          if (!members) {\n            members = {};\n          }\n          members[slot] = slotMetadata;\n        }\n      });\n    }\n\n    if (members) {\n      metadata.members = members;\n    }\n\n    return metadata;\n  }\n\n  isMockFunction<T>(fn: any): fn is Mock<T> {\n    return !!fn && fn._isMockFunction === true;\n  }\n\n  fn<T, Y extends Array<unknown>>(\n    implementation?: (...args: Y) => T,\n  ): Mock<T, Y> {\n    const length = implementation ? implementation.length : 0;\n    const fn = this._makeComponent<T, Y>({length, type: 'function'});\n    if (implementation) {\n      fn.mockImplementation(implementation);\n    }\n    return fn;\n  }\n\n  spyOn<T extends {}, M extends NonFunctionPropertyNames<T>>(\n    object: T,\n    methodName: M,\n    accessType: 'get',\n  ): SpyInstance<T[M], []>;\n\n  spyOn<T extends {}, M extends NonFunctionPropertyNames<T>>(\n    object: T,\n    methodName: M,\n    accessType: 'set',\n  ): SpyInstance<void, [T[M]]>;\n\n  spyOn<T extends {}, M extends FunctionPropertyNames<T>>(\n    object: T,\n    methodName: M,\n  ): T[M] extends (...args: Array<any>) => any\n    ? SpyInstance<ReturnType<T[M]>, Parameters<T[M]>>\n    : never;\n\n  spyOn<T extends {}, M extends NonFunctionPropertyNames<T>>(\n    object: T,\n    methodName: M,\n    accessType?: 'get' | 'set',\n  ) {\n    if (accessType) {\n      return this._spyOnProperty(object, methodName, accessType);\n    }\n\n    if (typeof object !== 'object' && typeof object !== 'function') {\n      throw new Error(\n        'Cannot spyOn on a primitive value; ' + this._typeOf(object) + ' given',\n      );\n    }\n\n    const original = object[methodName];\n\n    if (!this.isMockFunction(original)) {\n      if (typeof original !== 'function') {\n        throw new Error(\n          'Cannot spy the ' +\n            methodName +\n            ' property because it is not a function; ' +\n            this._typeOf(original) +\n            ' given instead',\n        );\n      }\n\n      const isMethodOwner = object.hasOwnProperty(methodName);\n\n      // @ts-ignore overriding original method with a Mock\n      object[methodName] = this._makeComponent({type: 'function'}, () => {\n        if (isMethodOwner) {\n          object[methodName] = original;\n        } else {\n          delete object[methodName];\n        }\n      });\n\n      // @ts-ignore original method is now a Mock\n      object[methodName].mockImplementation(function (this: unknown) {\n        return original.apply(this, arguments);\n      });\n    }\n\n    return object[methodName];\n  }\n\n  private _spyOnProperty<T extends {}, M extends NonFunctionPropertyNames<T>>(\n    obj: T,\n    propertyName: M,\n    accessType: 'get' | 'set' = 'get',\n  ): Mock<T> {\n    if (typeof obj !== 'object' && typeof obj !== 'function') {\n      throw new Error(\n        'Cannot spyOn on a primitive value; ' + this._typeOf(obj) + ' given',\n      );\n    }\n\n    if (!obj) {\n      throw new Error(\n        'spyOn could not find an object to spy upon for ' + propertyName + '',\n      );\n    }\n\n    if (!propertyName) {\n      throw new Error('No property name supplied');\n    }\n\n    let descriptor = Object.getOwnPropertyDescriptor(obj, propertyName);\n    let proto = Object.getPrototypeOf(obj);\n\n    while (!descriptor && proto !== null) {\n      descriptor = Object.getOwnPropertyDescriptor(proto, propertyName);\n      proto = Object.getPrototypeOf(proto);\n    }\n\n    if (!descriptor) {\n      throw new Error(propertyName + ' property does not exist');\n    }\n\n    if (!descriptor.configurable) {\n      throw new Error(propertyName + ' is not declared configurable');\n    }\n\n    if (!descriptor[accessType]) {\n      throw new Error(\n        'Property ' + propertyName + ' does not have access type ' + accessType,\n      );\n    }\n\n    const original = descriptor[accessType];\n\n    if (!this.isMockFunction(original)) {\n      if (typeof original !== 'function') {\n        throw new Error(\n          'Cannot spy the ' +\n            propertyName +\n            ' property because it is not a function; ' +\n            this._typeOf(original) +\n            ' given instead',\n        );\n      }\n\n      // @ts-ignore: mock is assignable\n      descriptor[accessType] = this._makeComponent({type: 'function'}, () => {\n        // @ts-ignore: mock is assignable\n        descriptor![accessType] = original;\n        Object.defineProperty(obj, propertyName, descriptor!);\n      });\n\n      (descriptor[accessType] as Mock<T>).mockImplementation(function (\n        this: unknown,\n      ) {\n        // @ts-ignore\n        return original.apply(this, arguments);\n      });\n    }\n\n    Object.defineProperty(obj, propertyName, descriptor);\n    return descriptor[accessType] as Mock<T>;\n  }\n\n  clearAllMocks() {\n    this._mockState = new WeakMap();\n  }\n\n  resetAllMocks() {\n    this._mockConfigRegistry = new WeakMap();\n    this._mockState = new WeakMap();\n  }\n\n  restoreAllMocks() {\n    this._spyState.forEach(restore => restore());\n    this._spyState = new Set();\n  }\n\n  private _typeOf(value: any): string {\n    return value == null ? '' + value : typeof value;\n  }\n}\n\n/* eslint-disable-next-line no-redeclare */\nconst JestMock = new ModuleMockerClass(global);\nexport = JestMock;\n"],"sourceRoot":""}