mirror of
https://github.com/actions/setup-python
synced 2024-11-30 21:22:28 +08:00
1 line
58 KiB
Plaintext
1 line
58 KiB
Plaintext
{"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","defaultReturnValue","isReturnValueLastSet","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","returnValue","specificMockImpl","error","_createMockFunction","_isMockFunction","getMockImplementation","defineProperty","configurable","enumerable","val","mockClear","delete","mockReset","mockRestore","mockReturnValueOnce","mockResolvedValueOnce","mockImplementationOnce","Promise","resolve","mockRejectedValueOnce","reject","mockReturnValue","mockResolvedValue","mockImplementation","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","obj","propertyName","descriptor","proto","JestMock"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;;;;;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;;;AAkCA;AA0CA,IAAMM,qBAAqB,GAAG,iBAA9B;AAEA,IAAMC,8BAA8B,GAAG,oBAAvC;A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AAOqC,QAAQ,CAACtJ,KAAT,CAAe,IAAf,EAAqBC,SAArB,CAAP;AACD,SALD;AAMD;;AAEDW,YAAM,CAACoF,cAAP,CAAsBwD,GAAtB,EAA2BC,YAA3B,EAAyCC,UAAzC;AACA,aAAOA,UAAU,CAACP,UAAD,CAAjB;AACD;;;oCAEe;AACd,WAAKvH,UAAL,GAAkB,IAAIC,OAAJ,EAAlB;AACD;;;oCAEe;AACd,WAAKC,mBAAL,GAA2B,IAAID,OAAJ,EAA3B;AACA,WAAKD,UAAL,GAAkB,IAAIC,OAAJ,EAAlB;AACD;;;sCAEiB;AAChB,WAAKE,SAAL,CAAeqD,OAAf,CAAuB,UAAAhB,OAAO;AAAA,eAAIA,OAAO,EAAX;AAAA,OAA9B;;AACA,WAAKrC,SAAL,GAAiB,IAAIrC,GAAJ,EAAjB;AACD;;;4BAEeiB,K,EAAoB;AAClC,aAAOA,KAAK,IAAI,IAAT,GAAgB,KAAKA,KAArB,WAAoCA,KAApC,CAAP;AACD;;;;;AAGH;;;AACA,IAAMiJ,QAAQ,GAAG,IAAInI,iBAAJ,CAAsBC,MAAtB,CAAjB;iBACSkI,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?: {[key: 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 isReturnValueLastSet: boolean;\n defaultReturnValue: unknown;\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();\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 defaultReturnValue: undefined,\n isReturnValueLastSet: false,\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 = {\n type: ('incomplete' as unknown) as MockFunctionResultType,\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 const returnValue = mockConfig.defaultReturnValue;\n // If return value is last set, either specific or default, i.e.\n // mockReturnValueOnce()/mockReturnValue() is called and no\n // mockImplementationOnce()/mockImplementation() is called after\n // that.\n // use the set return value.\n if (mockConfig.specificReturnValues.length) {\n return mockConfig.specificReturnValues.shift();\n }\n\n if (mockConfig.isReturnValueLastSet) {\n return mockConfig.defaultReturnValue;\n }\n\n // If mockImplementationOnce()/mockImplementation() is last set,\n // or specific return values are used up, use the mock\n // implementation.\n let specificMockImpl;\n if (returnValue === undefined) {\n specificMockImpl = mockConfig.specificMockImpls.shift();\n if (specificMockImpl === undefined) {\n specificMockImpl = mockConfig.mockImpl;\n }\n if (specificMockImpl) {\n return specificMockImpl.apply(this, arguments);\n }\n }\n\n // Otherwise use prototype implementation\n if (returnValue === undefined && f._protoImpl) {\n return f._protoImpl.apply(this, arguments);\n }\n\n return returnValue;\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 const mockConfig = this._ensureMockConfig(f);\n mockConfig.specificReturnValues.push(value);\n return f;\n };\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 const mockConfig = this._ensureMockConfig(f);\n mockConfig.isReturnValueLastSet = true;\n mockConfig.defaultReturnValue = value;\n return f;\n };\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.isReturnValueLastSet = false;\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.isReturnValueLastSet = false;\n mockConfig.defaultReturnValue = undefined;\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 // @ts-ignore overriding original method with a Mock\n object[methodName] = this._makeComponent({type: 'function'}, () => {\n object[methodName] = original;\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 descriptor[accessType] = this._makeComponent({type: 'function'}, () => {\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":""} |