diff options
| author | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 | 
|---|---|---|
| committer | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 | 
| commit | 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 (patch) | |
| tree | 360f7eb50f956e2367ef38fa1fc6ac7ac5258042 /node_modules/jest-jasmine2/build | |
| parent | b500a50f1b97d93c98b36ed9a980f8188d648147 (diff) | |
| download | LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.tar.gz LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.zip  | |
Added node_modules for the updating to work properly.
Diffstat (limited to 'node_modules/jest-jasmine2/build')
54 files changed, 4813 insertions, 0 deletions
diff --git a/node_modules/jest-jasmine2/build/ExpectationFailed.d.ts b/node_modules/jest-jasmine2/build/ExpectationFailed.d.ts new file mode 100644 index 0000000..657f1cc --- /dev/null +++ b/node_modules/jest-jasmine2/build/ExpectationFailed.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default class ExpectationFailed extends Error { +} diff --git a/node_modules/jest-jasmine2/build/ExpectationFailed.js b/node_modules/jest-jasmine2/build/ExpectationFailed.js new file mode 100644 index 0000000..cca6c96 --- /dev/null +++ b/node_modules/jest-jasmine2/build/ExpectationFailed.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +class ExpectationFailed extends Error {} + +exports.default = ExpectationFailed; diff --git a/node_modules/jest-jasmine2/build/PCancelable.d.ts b/node_modules/jest-jasmine2/build/PCancelable.d.ts new file mode 100644 index 0000000..9645c15 --- /dev/null +++ b/node_modules/jest-jasmine2/build/PCancelable.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default class PCancelable<T> implements PromiseLike<T> { +    private _pending; +    private _canceled; +    private _promise; +    private _cancel?; +    private _reject; +    constructor(executor: (onCancel: (cancelHandler: () => void) => void, resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void) => void); +    then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>; +    catch<TResult>(onRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>; +    cancel(): void; +} diff --git a/node_modules/jest-jasmine2/build/PCancelable.js b/node_modules/jest-jasmine2/build/PCancelable.js new file mode 100644 index 0000000..16811a4 --- /dev/null +++ b/node_modules/jest-jasmine2/build/PCancelable.js @@ -0,0 +1,139 @@ +'use strict'; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +class CancelError extends Error { +  constructor() { +    super('Promise was canceled'); +    this.name = 'CancelError'; +  } +} + +class PCancelable { +  constructor(executor) { +    _defineProperty(this, '_pending', true); + +    _defineProperty(this, '_canceled', false); + +    _defineProperty(this, '_promise', void 0); + +    _defineProperty(this, '_cancel', void 0); + +    _defineProperty(this, '_reject', () => {}); + +    this._promise = new Promise((resolve, reject) => { +      this._reject = reject; +      return executor( +        fn => { +          this._cancel = fn; +        }, +        val => { +          this._pending = false; +          resolve(val); +        }, +        err => { +          this._pending = false; +          reject(err); +        } +      ); +    }); +  } + +  then(onFulfilled, onRejected) { +    return this._promise.then(onFulfilled, onRejected); +  } + +  catch(onRejected) { +    return this._promise.catch(onRejected); +  } + +  cancel() { +    if (!this._pending || this._canceled) { +      return; +    } + +    if (typeof this._cancel === 'function') { +      try { +        this._cancel(); +      } catch (err) { +        this._reject(err); +      } +    } + +    this._canceled = true; + +    this._reject(new CancelError()); +  } +} + +exports.default = PCancelable; diff --git a/node_modules/jest-jasmine2/build/assertionErrorMessage.d.ts b/node_modules/jest-jasmine2/build/assertionErrorMessage.d.ts new file mode 100644 index 0000000..8c00fb5 --- /dev/null +++ b/node_modules/jest-jasmine2/build/assertionErrorMessage.d.ts @@ -0,0 +1,10 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import { DiffOptions } from 'jest-matcher-utils'; +import type { AssertionErrorWithStack } from './types'; +declare function assertionErrorMessage(error: AssertionErrorWithStack, options: DiffOptions): string; +export default assertionErrorMessage; diff --git a/node_modules/jest-jasmine2/build/assertionErrorMessage.js b/node_modules/jest-jasmine2/build/assertionErrorMessage.js new file mode 100644 index 0000000..9ec79ee --- /dev/null +++ b/node_modules/jest-jasmine2/build/assertionErrorMessage.js @@ -0,0 +1,156 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +var _chalk = _interopRequireDefault(require('chalk')); + +var _jestMatcherUtils = require('jest-matcher-utils'); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const assertOperatorsMap = { +  '!=': 'notEqual', +  '!==': 'notStrictEqual', +  '==': 'equal', +  '===': 'strictEqual' +}; +const humanReadableOperators = { +  deepEqual: 'to deeply equal', +  deepStrictEqual: 'to deeply and strictly equal', +  equal: 'to be equal', +  notDeepEqual: 'not to deeply equal', +  notDeepStrictEqual: 'not to deeply and strictly equal', +  notEqual: 'to not be equal', +  notStrictEqual: 'not be strictly equal', +  strictEqual: 'to strictly be equal' +}; + +const getOperatorName = (operator, stack) => { +  if (typeof operator === 'string') { +    return assertOperatorsMap[operator] || operator; +  } + +  if (stack.match('.doesNotThrow')) { +    return 'doesNotThrow'; +  } + +  if (stack.match('.throws')) { +    return 'throws'; +  } // this fallback is only needed for versions older than node 10 + +  if (stack.match('.fail')) { +    return 'fail'; +  } + +  return ''; +}; + +const operatorMessage = operator => { +  const niceOperatorName = getOperatorName(operator, ''); +  const humanReadableOperator = humanReadableOperators[niceOperatorName]; +  return typeof operator === 'string' +    ? `${humanReadableOperator || niceOperatorName} to:\n` +    : ''; +}; + +const assertThrowingMatcherHint = operatorName => +  operatorName +    ? _chalk.default.dim('assert') + +      _chalk.default.dim('.' + operatorName + '(') + +      _chalk.default.red('function') + +      _chalk.default.dim(')') +    : ''; + +const assertMatcherHint = (operator, operatorName, expected) => { +  let message = ''; + +  if (operator === '==' && expected === true) { +    message = +      _chalk.default.dim('assert') + +      _chalk.default.dim('(') + +      _chalk.default.red('received') + +      _chalk.default.dim(')'); +  } else if (operatorName) { +    message = +      _chalk.default.dim('assert') + +      _chalk.default.dim('.' + operatorName + '(') + +      _chalk.default.red('received') + +      _chalk.default.dim(', ') + +      _chalk.default.green('expected') + +      _chalk.default.dim(')'); +  } + +  return message; +}; + +function assertionErrorMessage(error, options) { +  const {expected, actual, generatedMessage, message, operator, stack} = error; +  const diffString = (0, _jestMatcherUtils.diff)(expected, actual, options); +  const hasCustomMessage = !generatedMessage; +  const operatorName = getOperatorName(operator, stack); +  const trimmedStack = stack +    .replace(message, '') +    .replace(/AssertionError(.*)/g, ''); + +  if (operatorName === 'doesNotThrow') { +    return ( +      buildHintString(assertThrowingMatcherHint(operatorName)) + +      _chalk.default.reset('Expected the function not to throw an error.\n') + +      _chalk.default.reset('Instead, it threw:\n') + +      `  ${(0, _jestMatcherUtils.printReceived)(actual)}` + +      _chalk.default.reset( +        hasCustomMessage ? '\n\nMessage:\n  ' + message : '' +      ) + +      trimmedStack +    ); +  } + +  if (operatorName === 'throws') { +    return ( +      buildHintString(assertThrowingMatcherHint(operatorName)) + +      _chalk.default.reset('Expected the function to throw an error.\n') + +      _chalk.default.reset("But it didn't throw anything.") + +      _chalk.default.reset( +        hasCustomMessage ? '\n\nMessage:\n  ' + message : '' +      ) + +      trimmedStack +    ); +  } + +  if (operatorName === 'fail') { +    return ( +      buildHintString(assertMatcherHint(operator, operatorName, expected)) + +      _chalk.default.reset(hasCustomMessage ? 'Message:\n  ' + message : '') + +      trimmedStack +    ); +  } + +  return ( +    buildHintString(assertMatcherHint(operator, operatorName, expected)) + +    _chalk.default.reset(`Expected value ${operatorMessage(operator)}`) + +    `  ${(0, _jestMatcherUtils.printExpected)(expected)}\n` + +    _chalk.default.reset('Received:\n') + +    `  ${(0, _jestMatcherUtils.printReceived)(actual)}` + +    _chalk.default.reset(hasCustomMessage ? '\n\nMessage:\n  ' + message : '') + +    (diffString ? `\n\nDifference:\n\n${diffString}` : '') + +    trimmedStack +  ); +} + +function buildHintString(hint) { +  return hint ? hint + '\n\n' : ''; +} + +var _default = assertionErrorMessage; +exports.default = _default; diff --git a/node_modules/jest-jasmine2/build/each.d.ts b/node_modules/jest-jasmine2/build/each.d.ts new file mode 100644 index 0000000..527fb50 --- /dev/null +++ b/node_modules/jest-jasmine2/build/each.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { JestEnvironment } from '@jest/environment'; +export default function each(environment: JestEnvironment): void; diff --git a/node_modules/jest-jasmine2/build/each.js b/node_modules/jest-jasmine2/build/each.js new file mode 100644 index 0000000..c82f5e4 --- /dev/null +++ b/node_modules/jest-jasmine2/build/each.js @@ -0,0 +1,44 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = each; + +var _jestEach = require('jest-each'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function each(environment) { +  environment.global.it.each = (0, _jestEach.bind)(environment.global.it); +  environment.global.fit.each = (0, _jestEach.bind)(environment.global.fit); +  environment.global.xit.each = (0, _jestEach.bind)(environment.global.xit); +  environment.global.describe.each = (0, _jestEach.bind)( +    environment.global.describe, +    false +  ); +  environment.global.xdescribe.each = (0, _jestEach.bind)( +    environment.global.xdescribe, +    false +  ); +  environment.global.fdescribe.each = (0, _jestEach.bind)( +    environment.global.fdescribe, +    false +  ); +  environment.global.it.concurrent.each = (0, _jestEach.bind)( +    environment.global.it.concurrent, +    false +  ); +  environment.global.it.concurrent.only.each = (0, _jestEach.bind)( +    environment.global.it.concurrent.only, +    false +  ); +  environment.global.it.concurrent.skip.each = (0, _jestEach.bind)( +    environment.global.it.concurrent.skip, +    false +  ); +} diff --git a/node_modules/jest-jasmine2/build/errorOnPrivate.d.ts b/node_modules/jest-jasmine2/build/errorOnPrivate.d.ts new file mode 100644 index 0000000..081dd14 --- /dev/null +++ b/node_modules/jest-jasmine2/build/errorOnPrivate.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Global } from '@jest/types'; +export declare function installErrorOnPrivate(global: Global.Global): void; diff --git a/node_modules/jest-jasmine2/build/errorOnPrivate.js b/node_modules/jest-jasmine2/build/errorOnPrivate.js new file mode 100644 index 0000000..cf8d87f --- /dev/null +++ b/node_modules/jest-jasmine2/build/errorOnPrivate.js @@ -0,0 +1,66 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.installErrorOnPrivate = installErrorOnPrivate; + +var _jestUtil = require('jest-util'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// prettier-ignore +const disabledGlobals = { +  fail: 'Illegal usage of global `fail`, prefer throwing an error, or the `done.fail` callback.', +  pending: 'Illegal usage of global `pending`, prefer explicitly skipping a test using `test.skip`', +  spyOn: 'Illegal usage of global `spyOn`, prefer `jest.spyOn`.', +  spyOnProperty: 'Illegal usage of global `spyOnProperty`, prefer `jest.spyOn`.' +}; +// prettier-ignore +const disabledJasmineMethods = { +  addMatchers: 'Illegal usage of `jasmine.addMatchers`, prefer `expect.extends`.', +  any: 'Illegal usage of `jasmine.any`, prefer `expect.any`.', +  anything: 'Illegal usage of `jasmine.anything`, prefer `expect.anything`.', +  arrayContaining: 'Illegal usage of `jasmine.arrayContaining`, prefer `expect.arrayContaining`.', +  createSpy: 'Illegal usage of `jasmine.createSpy`, prefer `jest.fn`.', +  objectContaining: 'Illegal usage of `jasmine.objectContaining`, prefer `expect.objectContaining`.', +  stringMatching: 'Illegal usage of `jasmine.stringMatching`, prefer `expect.stringMatching`.' +}; + +function installErrorOnPrivate(global) { +  const jasmine = global.jasmine; +  Object.keys(disabledGlobals).forEach(functionName => { +    global[functionName] = () => { +      throwAtFunction(disabledGlobals[functionName], global[functionName]); +    }; +  }); +  Object.keys(disabledJasmineMethods).forEach(methodName => { +    // @ts-expect-error +    jasmine[methodName] = () => { +      throwAtFunction(disabledJasmineMethods[methodName], jasmine[methodName]); +    }; +  }); + +  function set() { +    throwAtFunction( +      'Illegal usage of `jasmine.DEFAULT_TIMEOUT_INTERVAL`, prefer `jest.setTimeout`.', +      set +    ); +  } + +  const original = jasmine.DEFAULT_TIMEOUT_INTERVAL; +  Object.defineProperty(jasmine, 'DEFAULT_TIMEOUT_INTERVAL', { +    configurable: true, +    enumerable: true, +    get: () => original, +    set +  }); +} + +function throwAtFunction(message, fn) { +  throw new _jestUtil.ErrorWithStack(message, fn); +} diff --git a/node_modules/jest-jasmine2/build/expectationResultFactory.d.ts b/node_modules/jest-jasmine2/build/expectationResultFactory.d.ts new file mode 100644 index 0000000..f3101fa --- /dev/null +++ b/node_modules/jest-jasmine2/build/expectationResultFactory.d.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { FailedAssertion } from '@jest/test-result'; +export declare type Options = { +    matcherName: string; +    passed: boolean; +    actual?: any; +    error?: any; +    expected?: any; +    message?: string | null; +}; +export default function expectationResultFactory(options: Options, initError?: Error): FailedAssertion; diff --git a/node_modules/jest-jasmine2/build/expectationResultFactory.js b/node_modules/jest-jasmine2/build/expectationResultFactory.js new file mode 100644 index 0000000..8686787 --- /dev/null +++ b/node_modules/jest-jasmine2/build/expectationResultFactory.js @@ -0,0 +1,93 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = expectationResultFactory; + +var _prettyFormat = require('pretty-format'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function messageFormatter({error, message, passed}) { +  if (passed) { +    return 'Passed.'; +  } + +  if (message) { +    return message; +  } + +  if (typeof error === 'string') { +    return error; +  } + +  if ( +    // duck-type Error, see #2549 +    error && +    typeof error === 'object' && +    typeof error.message === 'string' && +    typeof error.name === 'string' +  ) { +    if (error.message === '') { +      return error.name; +    } + +    return `${error.name}: ${error.message}`; +  } + +  return `thrown: ${(0, _prettyFormat.format)(error, { +    maxDepth: 3 +  })}`; +} + +function stackFormatter(options, initError, errorMessage) { +  if (options.passed) { +    return ''; +  } + +  if (options.error) { +    if (typeof options.error.stack === 'string') { +      return options.error.stack; +    } + +    if (options.error === errorMessage) { +      return errorMessage; +    } +  } + +  if (initError) { +    return errorMessage.trimRight() + '\n\n' + initError.stack; +  } + +  return new Error(errorMessage).stack; +} + +function expectationResultFactory(options, initError) { +  const message = messageFormatter(options); +  const stack = stackFormatter(options, initError, message); + +  if (options.passed) { +    return { +      error: options.error, +      matcherName: options.matcherName, +      message, +      passed: options.passed, +      stack +    }; +  } + +  return { +    actual: options.actual, +    error: options.error, +    expected: options.expected, +    matcherName: options.matcherName, +    message, +    passed: options.passed, +    stack +  }; +} diff --git a/node_modules/jest-jasmine2/build/index.d.ts b/node_modules/jest-jasmine2/build/index.d.ts new file mode 100644 index 0000000..e0e56a8 --- /dev/null +++ b/node_modules/jest-jasmine2/build/index.d.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { JestEnvironment } from '@jest/environment'; +import type { TestResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type Runtime from 'jest-runtime'; +export type { Jasmine } from './types'; +export default function jasmine2(globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string): Promise<TestResult>; diff --git a/node_modules/jest-jasmine2/build/index.js b/node_modules/jest-jasmine2/build/index.js new file mode 100644 index 0000000..15b4f60 --- /dev/null +++ b/node_modules/jest-jasmine2/build/index.js @@ -0,0 +1,247 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = jasmine2; + +var path = _interopRequireWildcard(require('path')); + +var _sourceMap = require('@jest/source-map'); + +var _each = _interopRequireDefault(require('./each')); + +var _errorOnPrivate = require('./errorOnPrivate'); + +var _jasmineAsyncInstall = _interopRequireDefault( +  require('./jasmineAsyncInstall') +); + +var _reporter = _interopRequireDefault(require('./reporter')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache(nodeInterop) { +  if (typeof WeakMap !== 'function') return null; +  var cacheBabelInterop = new WeakMap(); +  var cacheNodeInterop = new WeakMap(); +  return (_getRequireWildcardCache = function (nodeInterop) { +    return nodeInterop ? cacheNodeInterop : cacheBabelInterop; +  })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { +  if (!nodeInterop && obj && obj.__esModule) { +    return obj; +  } +  if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { +    return {default: obj}; +  } +  var cache = _getRequireWildcardCache(nodeInterop); +  if (cache && cache.has(obj)) { +    return cache.get(obj); +  } +  var newObj = {}; +  var hasPropertyDescriptor = +    Object.defineProperty && Object.getOwnPropertyDescriptor; +  for (var key in obj) { +    if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { +      var desc = hasPropertyDescriptor +        ? Object.getOwnPropertyDescriptor(obj, key) +        : null; +      if (desc && (desc.get || desc.set)) { +        Object.defineProperty(newObj, key, desc); +      } else { +        newObj[key] = obj[key]; +      } +    } +  } +  newObj.default = obj; +  if (cache) { +    cache.set(obj, newObj); +  } +  return newObj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +const JASMINE = require.resolve('./jasmine/jasmineLight'); + +const jestEachBuildDir = path.dirname(require.resolve('jest-each')); + +async function jasmine2(globalConfig, config, environment, runtime, testPath) { +  const reporter = new _reporter.default(globalConfig, config, testPath); +  const jasmineFactory = runtime.requireInternalModule(JASMINE); +  const jasmine = jasmineFactory.create({ +    process, +    testPath, +    testTimeout: globalConfig.testTimeout +  }); +  const env = jasmine.getEnv(); + +  const jasmineInterface = jasmineFactory._interface(jasmine, env); + +  Object.assign(environment.global, jasmineInterface); +  env.addReporter(jasmineInterface.jsApiReporter); // TODO: Remove config option if V8 exposes some way of getting location of caller +  // in a future version + +  if (config.testLocationInResults === true) { +    function wrapIt(original) { +      const wrapped = (testName, fn, timeout) => { +        var _stack$getFileName; + +        const sourcemaps = runtime.getSourceMaps(); +        let stack = (0, _sourceMap.getCallsite)(1, sourcemaps); +        const it = original(testName, fn, timeout); + +        if ( +          (_stack$getFileName = stack.getFileName()) !== null && +          _stack$getFileName !== void 0 && +          _stack$getFileName.startsWith(jestEachBuildDir) +        ) { +          stack = (0, _sourceMap.getCallsite)(4, sourcemaps); +        } // @ts-expect-error + +        it.result.__callsite = stack; +        return it; +      }; + +      return wrapped; +    } + +    environment.global.it = wrapIt(environment.global.it); +    environment.global.xit = wrapIt(environment.global.xit); +    environment.global.fit = wrapIt(environment.global.fit); +  } + +  (0, _jasmineAsyncInstall.default)(globalConfig, environment.global); +  (0, _each.default)(environment); +  environment.global.test = environment.global.it; +  environment.global.it.only = environment.global.fit; +  environment.global.it.todo = env.todo; +  environment.global.it.skip = environment.global.xit; +  environment.global.xtest = environment.global.xit; +  environment.global.describe.skip = environment.global.xdescribe; +  environment.global.describe.only = environment.global.fdescribe; + +  if (config.timers === 'fake' || config.timers === 'modern') { +    environment.fakeTimersModern.useFakeTimers(); +  } else if (config.timers === 'legacy') { +    environment.fakeTimers.useFakeTimers(); +  } + +  env.beforeEach(() => { +    if (config.resetModules) { +      runtime.resetModules(); +    } + +    if (config.clearMocks) { +      runtime.clearAllMocks(); +    } + +    if (config.resetMocks) { +      runtime.resetAllMocks(); + +      if (config.timers === 'legacy') { +        environment.fakeTimers.useFakeTimers(); +      } +    } + +    if (config.restoreMocks) { +      runtime.restoreAllMocks(); +    } +  }); +  env.addReporter(reporter); +  runtime +    .requireInternalModule(path.resolve(__dirname, './jestExpect.js')) +    .default({ +      expand: globalConfig.expand +    }); + +  if (globalConfig.errorOnDeprecated) { +    (0, _errorOnPrivate.installErrorOnPrivate)(environment.global); +  } else { +    Object.defineProperty(jasmine, 'DEFAULT_TIMEOUT_INTERVAL', { +      configurable: true, +      enumerable: true, + +      get() { +        return this._DEFAULT_TIMEOUT_INTERVAL; +      }, + +      set(value) { +        this._DEFAULT_TIMEOUT_INTERVAL = value; +      } +    }); +  } + +  const snapshotState = await runtime +    .requireInternalModule(path.resolve(__dirname, './setup_jest_globals.js')) +    .default({ +      config, +      globalConfig, +      localRequire: runtime.requireModule.bind(runtime), +      testPath +    }); + +  for (const path of config.setupFilesAfterEnv) { +    const esm = runtime.unstable_shouldLoadAsEsm(path); + +    if (esm) { +      await runtime.unstable_importModule(path); +    } else { +      runtime.requireModule(path); +    } +  } + +  if (globalConfig.testNamePattern) { +    const testNameRegex = new RegExp(globalConfig.testNamePattern, 'i'); + +    env.specFilter = spec => testNameRegex.test(spec.getFullName()); +  } + +  const esm = runtime.unstable_shouldLoadAsEsm(testPath); + +  if (esm) { +    await runtime.unstable_importModule(testPath); +  } else { +    runtime.requireModule(testPath); +  } + +  await env.execute(); +  const results = await reporter.getResults(); +  return addSnapshotData(results, snapshotState); +} + +const addSnapshotData = (results, snapshotState) => { +  results.testResults.forEach(({fullName, status}) => { +    if (status === 'pending' || status === 'failed') { +      // if test is skipped or failed, we don't want to mark +      // its snapshots as obsolete. +      snapshotState.markSnapshotsAsCheckedForTest(fullName); +    } +  }); +  const uncheckedCount = snapshotState.getUncheckedCount(); +  const uncheckedKeys = snapshotState.getUncheckedKeys(); + +  if (uncheckedCount) { +    snapshotState.removeUncheckedKeys(); +  } + +  const status = snapshotState.save(); +  results.snapshot.fileDeleted = status.deleted; +  results.snapshot.added = snapshotState.added; +  results.snapshot.matched = snapshotState.matched; +  results.snapshot.unmatched = snapshotState.unmatched; +  results.snapshot.updated = snapshotState.updated; +  results.snapshot.unchecked = !status.deleted ? uncheckedCount : 0; // Copy the array to prevent memory leaks + +  results.snapshot.uncheckedKeys = Array.from(uncheckedKeys); +  return results; +}; diff --git a/node_modules/jest-jasmine2/build/isError.d.ts b/node_modules/jest-jasmine2/build/isError.d.ts new file mode 100644 index 0000000..b21d235 --- /dev/null +++ b/node_modules/jest-jasmine2/build/isError.d.ts @@ -0,0 +1,10 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default function isError(potentialError: any): { +    isError: boolean; +    message: string | null; +}; diff --git a/node_modules/jest-jasmine2/build/isError.js b/node_modules/jest-jasmine2/build/isError.js new file mode 100644 index 0000000..86608e0 --- /dev/null +++ b/node_modules/jest-jasmine2/build/isError.js @@ -0,0 +1,32 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = isError; + +var _prettyFormat = require('pretty-format'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function isError(potentialError) { // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +  // duck-type Error, see #2549 +  const isError = +    potentialError !== null && +    typeof potentialError === 'object' && +    typeof potentialError.message === 'string' && +    typeof potentialError.name === 'string'; +  const message = isError +    ? null +    : `Failed: ${(0, _prettyFormat.format)(potentialError, { +        maxDepth: 3 +      })}`; +  return { +    isError, +    message +  }; +} diff --git a/node_modules/jest-jasmine2/build/jasmine/CallTracker.d.ts b/node_modules/jest-jasmine2/build/jasmine/CallTracker.d.ts new file mode 100644 index 0000000..1692e9c --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/CallTracker.d.ts @@ -0,0 +1,25 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +export declare type Context = { +    object: unknown; +    args: Array<unknown>; +    returnValue?: unknown; +}; +declare class CallTracker { +    track: (context: Context) => void; +    any: () => boolean; +    count: () => number; +    argsFor: (index: number) => Array<unknown>; +    all: () => Array<Context>; +    allArgs: () => Array<unknown>; +    first: () => Context; +    mostRecent: () => Context; +    reset: () => void; +    constructor(); +} +export default CallTracker; diff --git a/node_modules/jest-jasmine2/build/jasmine/CallTracker.js b/node_modules/jest-jasmine2/build/jasmine/CallTracker.js new file mode 100644 index 0000000..c0ce750 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/CallTracker.js @@ -0,0 +1,121 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +class CallTracker { +  constructor() { +    _defineProperty(this, 'track', void 0); + +    _defineProperty(this, 'any', void 0); + +    _defineProperty(this, 'count', void 0); + +    _defineProperty(this, 'argsFor', void 0); + +    _defineProperty(this, 'all', void 0); + +    _defineProperty(this, 'allArgs', void 0); + +    _defineProperty(this, 'first', void 0); + +    _defineProperty(this, 'mostRecent', void 0); + +    _defineProperty(this, 'reset', void 0); + +    let calls = []; + +    this.track = function (context) { +      calls.push(context); +    }; + +    this.any = function () { +      return !!calls.length; +    }; + +    this.count = function () { +      return calls.length; +    }; + +    this.argsFor = function (index) { +      const call = calls[index]; +      return call ? call.args : []; +    }; + +    this.all = function () { +      return calls; +    }; + +    this.allArgs = function () { +      const callArgs = []; + +      for (let i = 0; i < calls.length; i++) { +        callArgs.push(calls[i].args); +      } + +      return callArgs; +    }; + +    this.first = function () { +      return calls[0]; +    }; + +    this.mostRecent = function () { +      return calls[calls.length - 1]; +    }; + +    this.reset = function () { +      calls = []; +    }; +  } +} + +var _default = CallTracker; +exports.default = _default; diff --git a/node_modules/jest-jasmine2/build/jasmine/Env.d.ts b/node_modules/jest-jasmine2/build/jasmine/Env.d.ts new file mode 100644 index 0000000..334cd0d --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/Env.d.ts @@ -0,0 +1,43 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import { QueueableFn } from '../queueRunner'; +import type { AssertionErrorWithStack, Jasmine, Reporter, SpecDefinitionsFn, Spy } from '../types'; +import type { default as Spec } from './Spec'; +import type Suite from './Suite'; +export default function jasmineEnv(j$: Jasmine): { +    new (): { +        specFilter: (spec: Spec) => boolean; +        catchExceptions: (value: unknown) => boolean; +        throwOnExpectationFailure: (value: unknown) => void; +        catchingExceptions: () => boolean; +        topSuite: () => Suite; +        fail: (error: Error | AssertionErrorWithStack) => void; +        pending: (message: string) => void; +        afterAll: (afterAllFunction: QueueableFn['fn'], timeout?: number | undefined) => void; +        fit: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec; +        throwingExpectationFailures: () => boolean; +        randomizeTests: (value: unknown) => void; +        randomTests: () => boolean; +        seed: (value: unknown) => unknown; +        execute: (runnablesToRun?: string[] | undefined, suiteTree?: Suite | undefined) => Promise<void>; +        fdescribe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite; +        spyOn: (obj: Record<string, Spy>, methodName: string, accessType?: "configurable" | "enumerable" | "value" | "writable" | "get" | "set" | undefined) => Spy; +        beforeEach: (beforeEachFunction: QueueableFn['fn'], timeout?: number | undefined) => void; +        afterEach: (afterEachFunction: QueueableFn['fn'], timeout?: number | undefined) => void; +        clearReporters: () => void; +        addReporter: (reporterToAdd: Reporter) => void; +        it: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec; +        xdescribe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite; +        xit: (description: string, fn: QueueableFn['fn'], timeout?: number | undefined) => Spec; +        beforeAll: (beforeAllFunction: QueueableFn['fn'], timeout?: number | undefined) => void; +        todo: () => Spec; +        provideFallbackReporter: (reporterToAdd: Reporter) => void; +        allowRespy: (allow: boolean) => void; +        describe: (description: string, specDefinitions: SpecDefinitionsFn) => Suite; +    }; +}; diff --git a/node_modules/jest-jasmine2/build/jasmine/Env.js b/node_modules/jest-jasmine2/build/jasmine/Env.js new file mode 100644 index 0000000..382c9c2 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/Env.js @@ -0,0 +1,716 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = jasmineEnv; + +var _assert = require('assert'); + +var _jestUtil = require('jest-util'); + +var _assertionErrorMessage = _interopRequireDefault( +  require('../assertionErrorMessage') +); + +var _isError = _interopRequireDefault(require('../isError')); + +var _queueRunner = _interopRequireDefault(require('../queueRunner')); + +var _treeProcessor = _interopRequireDefault(require('../treeProcessor')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +function jasmineEnv(j$) { +  return class Env { +    constructor() { +      _defineProperty(this, 'specFilter', void 0); + +      _defineProperty(this, 'catchExceptions', void 0); + +      _defineProperty(this, 'throwOnExpectationFailure', void 0); + +      _defineProperty(this, 'catchingExceptions', void 0); + +      _defineProperty(this, 'topSuite', void 0); + +      _defineProperty(this, 'fail', void 0); + +      _defineProperty(this, 'pending', void 0); + +      _defineProperty(this, 'afterAll', void 0); + +      _defineProperty(this, 'fit', void 0); + +      _defineProperty(this, 'throwingExpectationFailures', void 0); + +      _defineProperty(this, 'randomizeTests', void 0); + +      _defineProperty(this, 'randomTests', void 0); + +      _defineProperty(this, 'seed', void 0); + +      _defineProperty(this, 'execute', void 0); + +      _defineProperty(this, 'fdescribe', void 0); + +      _defineProperty(this, 'spyOn', void 0); + +      _defineProperty(this, 'beforeEach', void 0); + +      _defineProperty(this, 'afterEach', void 0); + +      _defineProperty(this, 'clearReporters', void 0); + +      _defineProperty(this, 'addReporter', void 0); + +      _defineProperty(this, 'it', void 0); + +      _defineProperty(this, 'xdescribe', void 0); + +      _defineProperty(this, 'xit', void 0); + +      _defineProperty(this, 'beforeAll', void 0); + +      _defineProperty(this, 'todo', void 0); + +      _defineProperty(this, 'provideFallbackReporter', void 0); + +      _defineProperty(this, 'allowRespy', void 0); + +      _defineProperty(this, 'describe', void 0); + +      let totalSpecsDefined = 0; +      let catchExceptions = true; +      const realSetTimeout = global.setTimeout; +      const realClearTimeout = global.clearTimeout; +      const runnableResources = {}; +      const currentlyExecutingSuites = []; +      let currentSpec = null; +      let throwOnExpectationFailure = false; +      let random = false; +      let seed = null; +      let nextSpecId = 0; +      let nextSuiteId = 0; + +      const getNextSpecId = function () { +        return 'spec' + nextSpecId++; +      }; + +      const getNextSuiteId = function () { +        return 'suite' + nextSuiteId++; +      }; + +      const topSuite = new j$.Suite({ +        id: getNextSuiteId(), +        description: '', + +        getTestPath() { +          return j$.testPath; +        } +      }); +      let currentDeclarationSuite = topSuite; + +      const currentSuite = function () { +        return currentlyExecutingSuites[currentlyExecutingSuites.length - 1]; +      }; + +      const currentRunnable = function () { +        return currentSpec || currentSuite(); +      }; + +      const reporter = new j$.ReportDispatcher([ +        'jasmineStarted', +        'jasmineDone', +        'suiteStarted', +        'suiteDone', +        'specStarted', +        'specDone' +      ]); + +      this.specFilter = function () { +        return true; +      }; + +      const defaultResourcesForRunnable = function (id, _parentRunnableId) { +        const resources = { +          spies: [] +        }; +        runnableResources[id] = resources; +      }; + +      const clearResourcesForRunnable = function (id) { +        spyRegistry.clearSpies(); +        delete runnableResources[id]; +      }; + +      const beforeAndAfterFns = function (suite) { +        return function () { +          let afters = []; +          let befores = []; + +          while (suite) { +            befores = befores.concat(suite.beforeFns); +            afters = afters.concat(suite.afterFns); +            suite = suite.parentSuite; +          } + +          return { +            befores: befores.reverse(), +            afters +          }; +        }; +      }; + +      const getSpecName = function (spec, suite) { +        const fullName = [spec.description]; +        const suiteFullName = suite.getFullName(); + +        if (suiteFullName !== '') { +          fullName.unshift(suiteFullName); +        } + +        return fullName.join(' '); +      }; + +      this.catchExceptions = function (value) { +        catchExceptions = !!value; +        return catchExceptions; +      }; + +      this.catchingExceptions = function () { +        return catchExceptions; +      }; + +      this.throwOnExpectationFailure = function (value) { +        throwOnExpectationFailure = !!value; +      }; + +      this.throwingExpectationFailures = function () { +        return throwOnExpectationFailure; +      }; + +      this.randomizeTests = function (value) { +        random = !!value; +      }; + +      this.randomTests = function () { +        return random; +      }; + +      this.seed = function (value) { +        if (value) { +          seed = value; +        } + +        return seed; +      }; + +      const queueRunnerFactory = options => { +        options.clearTimeout = realClearTimeout; +        options.fail = this.fail; +        options.setTimeout = realSetTimeout; +        return (0, _queueRunner.default)(options); +      }; + +      this.topSuite = function () { +        return topSuite; +      }; + +      const uncaught = err => { +        if (currentSpec) { +          currentSpec.onException(err); +          currentSpec.cancel(); +        } else { +          console.error('Unhandled error'); +          console.error(err.stack); +        } +      }; + +      let oldListenersException; +      let oldListenersRejection; + +      const executionSetup = function () { +        // Need to ensure we are the only ones handling these exceptions. +        oldListenersException = process.listeners('uncaughtException').slice(); +        oldListenersRejection = process.listeners('unhandledRejection').slice(); +        j$.process.removeAllListeners('uncaughtException'); +        j$.process.removeAllListeners('unhandledRejection'); +        j$.process.on('uncaughtException', uncaught); +        j$.process.on('unhandledRejection', uncaught); +      }; + +      const executionTeardown = function () { +        j$.process.removeListener('uncaughtException', uncaught); +        j$.process.removeListener('unhandledRejection', uncaught); // restore previous exception handlers + +        oldListenersException.forEach(listener => { +          j$.process.on('uncaughtException', listener); +        }); +        oldListenersRejection.forEach(listener => { +          j$.process.on('unhandledRejection', listener); +        }); +      }; + +      this.execute = async function (runnablesToRun, suiteTree = topSuite) { +        if (!runnablesToRun) { +          if (focusedRunnables.length) { +            runnablesToRun = focusedRunnables; +          } else { +            runnablesToRun = [suiteTree.id]; +          } +        } + +        if (currentlyExecutingSuites.length === 0) { +          executionSetup(); +        } + +        const lastDeclarationSuite = currentDeclarationSuite; +        await (0, _treeProcessor.default)({ +          nodeComplete(suite) { +            if (!suite.disabled) { +              clearResourcesForRunnable(suite.id); +            } + +            currentlyExecutingSuites.pop(); + +            if (suite === topSuite) { +              reporter.jasmineDone({ +                failedExpectations: topSuite.result.failedExpectations +              }); +            } else { +              reporter.suiteDone(suite.getResult()); +            } +          }, + +          nodeStart(suite) { +            currentlyExecutingSuites.push(suite); +            defaultResourcesForRunnable( +              suite.id, +              suite.parentSuite && suite.parentSuite.id +            ); + +            if (suite === topSuite) { +              reporter.jasmineStarted({ +                totalSpecsDefined +              }); +            } else { +              reporter.suiteStarted(suite.result); +            } +          }, + +          queueRunnerFactory, +          runnableIds: runnablesToRun, +          tree: suiteTree +        }); +        currentDeclarationSuite = lastDeclarationSuite; + +        if (currentlyExecutingSuites.length === 0) { +          executionTeardown(); +        } +      }; + +      this.addReporter = function (reporterToAdd) { +        reporter.addReporter(reporterToAdd); +      }; + +      this.provideFallbackReporter = function (reporterToAdd) { +        reporter.provideFallbackReporter(reporterToAdd); +      }; + +      this.clearReporters = function () { +        reporter.clearReporters(); +      }; + +      const spyRegistry = new j$.SpyRegistry({ +        currentSpies() { +          if (!currentRunnable()) { +            throw new Error( +              'Spies must be created in a before function or a spec' +            ); +          } + +          return runnableResources[currentRunnable().id].spies; +        } +      }); + +      this.allowRespy = function (allow) { +        spyRegistry.allowRespy(allow); +      }; + +      this.spyOn = function (...args) { +        return spyRegistry.spyOn.apply(spyRegistry, args); +      }; + +      const suiteFactory = function (description) { +        const suite = new j$.Suite({ +          id: getNextSuiteId(), +          description, +          parentSuite: currentDeclarationSuite, +          throwOnExpectationFailure, + +          getTestPath() { +            return j$.testPath; +          } +        }); +        return suite; +      }; + +      this.describe = function (description, specDefinitions) { +        const suite = suiteFactory(description); + +        if (specDefinitions === undefined) { +          throw new Error( +            'Missing second argument. It must be a callback function.' +          ); +        } + +        if (typeof specDefinitions !== 'function') { +          throw new Error( +            `Invalid second argument, ${specDefinitions}. It must be a callback function.` +          ); +        } + +        if (specDefinitions.length > 0) { +          throw new Error('describe does not expect any arguments'); +        } + +        if (currentDeclarationSuite.markedPending) { +          suite.pend(); +        } + +        if (currentDeclarationSuite.markedTodo) { +          // @ts-expect-error TODO Possible error: Suite does not have todo method +          suite.todo(); +        } + +        addSpecsToSuite(suite, specDefinitions); +        return suite; +      }; + +      this.xdescribe = function (description, specDefinitions) { +        const suite = suiteFactory(description); +        suite.pend(); +        addSpecsToSuite(suite, specDefinitions); +        return suite; +      }; + +      const focusedRunnables = []; + +      this.fdescribe = function (description, specDefinitions) { +        const suite = suiteFactory(description); +        suite.isFocused = true; +        focusedRunnables.push(suite.id); +        unfocusAncestor(); +        addSpecsToSuite(suite, specDefinitions); +        return suite; +      }; + +      const addSpecsToSuite = (suite, specDefinitions) => { +        const parentSuite = currentDeclarationSuite; +        parentSuite.addChild(suite); +        currentDeclarationSuite = suite; +        let declarationError = undefined; +        let describeReturnValue; + +        try { +          describeReturnValue = specDefinitions.call(suite); +        } catch (e) { +          declarationError = e; +        } + +        if ((0, _jestUtil.isPromise)(describeReturnValue)) { +          declarationError = new Error( +            'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.' +          ); +        } else if (describeReturnValue !== undefined) { +          declarationError = new Error( +            'A "describe" callback must not return a value.' +          ); +        } + +        if (declarationError) { +          this.it('encountered a declaration exception', () => { +            throw declarationError; +          }); +        } + +        currentDeclarationSuite = parentSuite; +      }; + +      function findFocusedAncestor(suite) { +        while (suite) { +          if (suite.isFocused) { +            return suite.id; +          } + +          suite = suite.parentSuite; +        } + +        return null; +      } + +      function unfocusAncestor() { +        const focusedAncestor = findFocusedAncestor(currentDeclarationSuite); + +        if (focusedAncestor) { +          for (let i = 0; i < focusedRunnables.length; i++) { +            if (focusedRunnables[i] === focusedAncestor) { +              focusedRunnables.splice(i, 1); +              break; +            } +          } +        } +      } + +      const specFactory = (description, fn, suite, timeout) => { +        totalSpecsDefined++; +        const spec = new j$.Spec({ +          id: getNextSpecId(), +          beforeAndAfterFns: beforeAndAfterFns(suite), +          resultCallback: specResultCallback, + +          getSpecName(spec) { +            return getSpecName(spec, suite); +          }, + +          getTestPath() { +            return j$.testPath; +          }, + +          onStart: specStarted, +          description, +          queueRunnerFactory, + +          userContext() { +            return suite.clonedSharedUserContext(); +          }, + +          queueableFn: { +            fn, + +            timeout() { +              return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; +            } +          }, +          throwOnExpectationFailure +        }); + +        if (!this.specFilter(spec)) { +          spec.disable(); +        } + +        return spec; + +        function specResultCallback(result) { +          clearResourcesForRunnable(spec.id); +          currentSpec = null; +          reporter.specDone(result); +        } + +        function specStarted(spec) { +          currentSpec = spec; +          defaultResourcesForRunnable(spec.id, suite.id); +          reporter.specStarted(spec.result); +        } +      }; + +      this.it = function (description, fn, timeout) { +        if (typeof description !== 'string') { +          throw new Error( +            `Invalid first argument, ${description}. It must be a string.` +          ); +        } + +        if (fn === undefined) { +          throw new Error( +            'Missing second argument. It must be a callback function. Perhaps you want to use `test.todo` for a test placeholder.' +          ); +        } + +        if (typeof fn !== 'function') { +          throw new Error( +            `Invalid second argument, ${fn}. It must be a callback function.` +          ); +        } + +        const spec = specFactory( +          description, +          fn, +          currentDeclarationSuite, +          timeout +        ); + +        if (currentDeclarationSuite.markedPending) { +          spec.pend(); +        } // When a test is defined inside another, jasmine will not run it. +        // This check throws an error to warn the user about the edge-case. + +        if (currentSpec !== null) { +          throw new Error( +            `Tests cannot be nested. Test "${spec.description}" cannot run because it is nested within "${currentSpec.description}".` +          ); +        } + +        currentDeclarationSuite.addChild(spec); +        return spec; +      }; + +      this.xit = function (...args) { +        const spec = this.it.apply(this, args); +        spec.pend('Temporarily disabled with xit'); +        return spec; +      }; + +      this.todo = function () { +        const description = arguments[0]; + +        if (arguments.length !== 1 || typeof description !== 'string') { +          throw new _jestUtil.ErrorWithStack( +            'Todo must be called with only a description.', +            this.todo +          ); +        } + +        const spec = specFactory( +          description, +          () => {}, +          currentDeclarationSuite +        ); + +        if (currentDeclarationSuite.markedPending) { +          spec.pend(); +        } else { +          spec.todo(); +        } + +        currentDeclarationSuite.addChild(spec); +        return spec; +      }; + +      this.fit = function (description, fn, timeout) { +        const spec = specFactory( +          description, +          fn, +          currentDeclarationSuite, +          timeout +        ); +        currentDeclarationSuite.addChild(spec); + +        if (currentDeclarationSuite.markedPending) { +          spec.pend(); +        } else { +          focusedRunnables.push(spec.id); +        } + +        unfocusAncestor(); +        return spec; +      }; + +      this.beforeEach = function (beforeEachFunction, timeout) { +        currentDeclarationSuite.beforeEach({ +          fn: beforeEachFunction, + +          timeout() { +            return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; +          } +        }); +      }; + +      this.beforeAll = function (beforeAllFunction, timeout) { +        currentDeclarationSuite.beforeAll({ +          fn: beforeAllFunction, + +          timeout() { +            return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; +          } +        }); +      }; + +      this.afterEach = function (afterEachFunction, timeout) { +        currentDeclarationSuite.afterEach({ +          fn: afterEachFunction, + +          timeout() { +            return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; +          } +        }); +      }; + +      this.afterAll = function (afterAllFunction, timeout) { +        currentDeclarationSuite.afterAll({ +          fn: afterAllFunction, + +          timeout() { +            return timeout || j$._DEFAULT_TIMEOUT_INTERVAL; +          } +        }); +      }; + +      this.pending = function (message) { +        let fullMessage = j$.Spec.pendingSpecExceptionMessage; + +        if (message) { +          fullMessage += message; +        } + +        throw fullMessage; +      }; + +      this.fail = function (error) { +        let checkIsError; +        let message; + +        if ( +          error instanceof _assert.AssertionError || +          (error && error.name === _assert.AssertionError.name) +        ) { +          checkIsError = false; // @ts-expect-error TODO Possible error: j$.Spec does not have expand property + +          message = (0, _assertionErrorMessage.default)(error, { +            expand: j$.Spec.expand +          }); +        } else { +          const check = (0, _isError.default)(error); +          checkIsError = check.isError; +          message = check.message; +        } + +        const errorAsErrorObject = checkIsError ? error : new Error(message); +        const runnable = currentRunnable(); + +        if (!runnable) { +          errorAsErrorObject.message = +            'Caught error after test environment was torn down\n\n' + +            errorAsErrorObject.message; +          throw errorAsErrorObject; +        } + +        runnable.addExpectationResult(false, { +          matcherName: '', +          passed: false, +          expected: '', +          actual: '', +          message, +          error: errorAsErrorObject +        }); +      }; +    } +  }; +} diff --git a/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.d.ts b/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.d.ts new file mode 100644 index 0000000..ece0b73 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.d.ts @@ -0,0 +1,31 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Reporter, RunDetails } from '../types'; +import type { SpecResult } from './Spec'; +import type { SuiteResult } from './Suite'; +import type Timer from './Timer'; +export default class JsApiReporter implements Reporter { +    started: boolean; +    finished: boolean; +    runDetails: RunDetails; +    jasmineStarted: (runDetails: RunDetails) => void; +    jasmineDone: (runDetails: RunDetails) => void; +    status: () => unknown; +    executionTime: () => unknown; +    suiteStarted: (result: SuiteResult) => void; +    suiteDone: (result: SuiteResult) => void; +    suiteResults: (index: number, length: number) => Array<SuiteResult>; +    suites: () => Record<string, SuiteResult>; +    specResults: (index: number, length: number) => Array<SpecResult>; +    specDone: (result: SpecResult) => void; +    specs: () => Array<SpecResult>; +    specStarted: (spec: SpecResult) => void; +    constructor(options: { +        timer?: Timer; +    }); +} diff --git a/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.js b/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.js new file mode 100644 index 0000000..982f446 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/JsApiReporter.js @@ -0,0 +1,173 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* eslint-disable sort-keys */ +const noopTimer = { +  start() {}, + +  elapsed() { +    return 0; +  } +}; + +class JsApiReporter { +  constructor(options) { +    _defineProperty(this, 'started', void 0); + +    _defineProperty(this, 'finished', void 0); + +    _defineProperty(this, 'runDetails', void 0); + +    _defineProperty(this, 'jasmineStarted', void 0); + +    _defineProperty(this, 'jasmineDone', void 0); + +    _defineProperty(this, 'status', void 0); + +    _defineProperty(this, 'executionTime', void 0); + +    _defineProperty(this, 'suiteStarted', void 0); + +    _defineProperty(this, 'suiteDone', void 0); + +    _defineProperty(this, 'suiteResults', void 0); + +    _defineProperty(this, 'suites', void 0); + +    _defineProperty(this, 'specResults', void 0); + +    _defineProperty(this, 'specDone', void 0); + +    _defineProperty(this, 'specs', void 0); + +    _defineProperty(this, 'specStarted', void 0); + +    const timer = options.timer || noopTimer; +    let status = 'loaded'; +    this.started = false; +    this.finished = false; +    this.runDetails = {}; + +    this.jasmineStarted = () => { +      this.started = true; +      status = 'started'; +      timer.start(); +    }; + +    let executionTime; + +    function validateAfterAllExceptions({failedExpectations}) { +      if (failedExpectations && failedExpectations.length > 0) { +        throw failedExpectations[0]; +      } +    } + +    this.jasmineDone = function (runDetails) { +      validateAfterAllExceptions(runDetails); +      this.finished = true; +      this.runDetails = runDetails; +      executionTime = timer.elapsed(); +      status = 'done'; +    }; + +    this.status = function () { +      return status; +    }; + +    const suites = []; +    const suites_hash = {}; + +    this.specStarted = function () {}; + +    this.suiteStarted = function (result) { +      suites_hash[result.id] = result; +    }; + +    this.suiteDone = function (result) { +      storeSuite(result); +    }; + +    this.suiteResults = function (index, length) { +      return suites.slice(index, index + length); +    }; + +    function storeSuite(result) { +      suites.push(result); +      suites_hash[result.id] = result; +    } + +    this.suites = function () { +      return suites_hash; +    }; + +    const specs = []; + +    this.specDone = function (result) { +      specs.push(result); +    }; + +    this.specResults = function (index, length) { +      return specs.slice(index, index + length); +    }; + +    this.specs = function () { +      return specs; +    }; + +    this.executionTime = function () { +      return executionTime; +    }; +  } +} + +exports.default = JsApiReporter; diff --git a/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts b/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts new file mode 100644 index 0000000..9f89d05 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.d.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Reporter, RunDetails } from '../types'; +import type { SpecResult } from './Spec'; +import type { SuiteResult } from './Suite'; +export default class ReportDispatcher implements Reporter { +    addReporter: (reporter: Reporter) => void; +    provideFallbackReporter: (reporter: Reporter) => void; +    clearReporters: () => void; +    jasmineDone: (runDetails: RunDetails) => void; +    jasmineStarted: (runDetails: RunDetails) => void; +    specDone: (result: SpecResult) => void; +    specStarted: (spec: SpecResult) => void; +    suiteDone: (result: SuiteResult) => void; +    suiteStarted: (result: SuiteResult) => void; +    constructor(methods: Array<keyof Reporter>); +} diff --git a/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.js b/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.js new file mode 100644 index 0000000..3acead9 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/ReportDispatcher.js @@ -0,0 +1,127 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* eslint-disable local/prefer-spread-eventually, local/prefer-rest-params-eventually */ +class ReportDispatcher { +  // @ts-expect-error +  // @ts-expect-error +  // @ts-expect-error +  // @ts-expect-error +  // @ts-expect-error +  // @ts-expect-error +  constructor(methods) { +    _defineProperty(this, 'addReporter', void 0); + +    _defineProperty(this, 'provideFallbackReporter', void 0); + +    _defineProperty(this, 'clearReporters', void 0); + +    _defineProperty(this, 'jasmineDone', void 0); + +    _defineProperty(this, 'jasmineStarted', void 0); + +    _defineProperty(this, 'specDone', void 0); + +    _defineProperty(this, 'specStarted', void 0); + +    _defineProperty(this, 'suiteDone', void 0); + +    _defineProperty(this, 'suiteStarted', void 0); + +    const dispatchedMethods = methods || []; + +    for (let i = 0; i < dispatchedMethods.length; i++) { +      const method = dispatchedMethods[i]; + +      this[method] = (function (m) { +        return function () { +          dispatch(m, arguments); +        }; +      })(method); +    } + +    let reporters = []; +    let fallbackReporter = null; + +    this.addReporter = function (reporter) { +      reporters.push(reporter); +    }; + +    this.provideFallbackReporter = function (reporter) { +      fallbackReporter = reporter; +    }; + +    this.clearReporters = function () { +      reporters = []; +    }; + +    return this; + +    function dispatch(method, args) { +      if (reporters.length === 0 && fallbackReporter !== null) { +        reporters.push(fallbackReporter); +      } + +      for (let i = 0; i < reporters.length; i++) { +        const reporter = reporters[i]; + +        if (reporter[method]) { +          // @ts-expect-error +          reporter[method].apply(reporter, args); +        } +      } +    } +  } +} + +exports.default = ReportDispatcher; diff --git a/node_modules/jest-jasmine2/build/jasmine/Spec.d.ts b/node_modules/jest-jasmine2/build/jasmine/Spec.d.ts new file mode 100644 index 0000000..e6ba7ce --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/Spec.d.ts @@ -0,0 +1,81 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { FailedAssertion, Milliseconds, Status } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import ExpectationFailed from '../ExpectationFailed'; +import expectationResultFactory, { Options as ExpectationResultFactoryOptions } from '../expectationResultFactory'; +import type { QueueableFn, default as queueRunner } from '../queueRunner'; +import type { AssertionErrorWithStack } from '../types'; +export declare type Attributes = { +    id: string; +    resultCallback: (result: Spec['result']) => void; +    description: string; +    throwOnExpectationFailure: unknown; +    getTestPath: () => Config.Path; +    queueableFn: QueueableFn; +    beforeAndAfterFns: () => { +        befores: Array<QueueableFn>; +        afters: Array<QueueableFn>; +    }; +    userContext: () => unknown; +    onStart: (context: Spec) => void; +    getSpecName: (spec: Spec) => string; +    queueRunnerFactory: typeof queueRunner; +}; +export declare type SpecResult = { +    id: string; +    description: string; +    fullName: string; +    duration?: Milliseconds; +    failedExpectations: Array<FailedAssertion>; +    testPath: Config.Path; +    passedExpectations: Array<ReturnType<typeof expectationResultFactory>>; +    pendingReason: string; +    status: Status; +    __callsite?: { +        getColumnNumber: () => number; +        getLineNumber: () => number; +    }; +}; +export default class Spec { +    id: string; +    description: string; +    resultCallback: (result: SpecResult) => void; +    queueableFn: QueueableFn; +    beforeAndAfterFns: () => { +        befores: Array<QueueableFn>; +        afters: Array<QueueableFn>; +    }; +    userContext: () => unknown; +    onStart: (spec: Spec) => void; +    getSpecName: (spec: Spec) => string; +    queueRunnerFactory: typeof queueRunner; +    throwOnExpectationFailure: boolean; +    initError: Error; +    result: SpecResult; +    disabled?: boolean; +    currentRun?: ReturnType<typeof queueRunner>; +    markedTodo?: boolean; +    markedPending?: boolean; +    expand?: boolean; +    static pendingSpecExceptionMessage: string; +    static isPendingSpecException(e: Error): boolean; +    constructor(attrs: Attributes); +    addExpectationResult(passed: boolean, data: ExpectationResultFactoryOptions, isError?: boolean): void; +    execute(onComplete?: () => void, enabled?: boolean): void; +    cancel(): void; +    onException(error: ExpectationFailed | AssertionErrorWithStack): void; +    disable(): void; +    pend(message?: string): void; +    todo(): void; +    getResult(): SpecResult; +    status(enabled?: boolean): "todo" | "passed" | "failed" | "pending" | "disabled"; +    isExecutable(): boolean; +    getFullName(): string; +    isAssertionError(error: Error): boolean; +} diff --git a/node_modules/jest-jasmine2/build/jasmine/Spec.js b/node_modules/jest-jasmine2/build/jasmine/Spec.js new file mode 100644 index 0000000..32fbc49 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/Spec.js @@ -0,0 +1,298 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +var _assert = require('assert'); + +var _ExpectationFailed = _interopRequireDefault( +  require('../ExpectationFailed') +); + +var _assertionErrorMessage = _interopRequireDefault( +  require('../assertionErrorMessage') +); + +var _expectationResultFactory = _interopRequireDefault( +  require('../expectationResultFactory') +); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +class Spec { +  static isPendingSpecException(e) { +    return !!( +      e && +      e.toString && +      e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1 +    ); +  } + +  constructor(attrs) { +    _defineProperty(this, 'id', void 0); + +    _defineProperty(this, 'description', void 0); + +    _defineProperty(this, 'resultCallback', void 0); + +    _defineProperty(this, 'queueableFn', void 0); + +    _defineProperty(this, 'beforeAndAfterFns', void 0); + +    _defineProperty(this, 'userContext', void 0); + +    _defineProperty(this, 'onStart', void 0); + +    _defineProperty(this, 'getSpecName', void 0); + +    _defineProperty(this, 'queueRunnerFactory', void 0); + +    _defineProperty(this, 'throwOnExpectationFailure', void 0); + +    _defineProperty(this, 'initError', void 0); + +    _defineProperty(this, 'result', void 0); + +    _defineProperty(this, 'disabled', void 0); + +    _defineProperty(this, 'currentRun', void 0); + +    _defineProperty(this, 'markedTodo', void 0); + +    _defineProperty(this, 'markedPending', void 0); + +    _defineProperty(this, 'expand', void 0); + +    this.resultCallback = attrs.resultCallback || function () {}; + +    this.id = attrs.id; +    this.description = attrs.description || ''; +    this.queueableFn = attrs.queueableFn; + +    this.beforeAndAfterFns = +      attrs.beforeAndAfterFns || +      function () { +        return { +          befores: [], +          afters: [] +        }; +      }; + +    this.userContext = +      attrs.userContext || +      function () { +        return {}; +      }; + +    this.onStart = attrs.onStart || function () {}; + +    this.getSpecName = +      attrs.getSpecName || +      function () { +        return ''; +      }; + +    this.queueRunnerFactory = attrs.queueRunnerFactory || function () {}; + +    this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; +    this.initError = new Error(); +    this.initError.name = ''; // Without this line v8 stores references to all closures +    // in the stack in the Error object. This line stringifies the stack +    // property to allow garbage-collecting objects on the stack +    // https://crbug.com/v8/7142 + +    this.initError.stack = this.initError.stack; +    this.queueableFn.initError = this.initError; // @ts-expect-error + +    this.result = { +      id: this.id, +      description: this.description, +      fullName: this.getFullName(), +      failedExpectations: [], +      passedExpectations: [], +      pendingReason: '', +      testPath: attrs.getTestPath() +    }; +  } + +  addExpectationResult(passed, data, isError) { +    const expectationResult = (0, _expectationResultFactory.default)( +      data, +      this.initError +    ); + +    if (passed) { +      this.result.passedExpectations.push(expectationResult); +    } else { +      this.result.failedExpectations.push(expectationResult); + +      if (this.throwOnExpectationFailure && !isError) { +        throw new _ExpectationFailed.default(); +      } +    } +  } + +  execute(onComplete, enabled) { +    const self = this; +    this.onStart(this); + +    if ( +      !this.isExecutable() || +      this.markedPending || +      this.markedTodo || +      enabled === false +    ) { +      complete(enabled); +      return; +    } + +    const fns = this.beforeAndAfterFns(); +    const allFns = fns.befores.concat(this.queueableFn).concat(fns.afters); +    this.currentRun = this.queueRunnerFactory({ +      queueableFns: allFns, + +      onException() { +        // @ts-expect-error +        self.onException.apply(self, arguments); +      }, + +      userContext: this.userContext(), +      setTimeout, +      clearTimeout, +      fail: () => {} +    }); +    this.currentRun.then(() => complete(true)); + +    function complete(enabledAgain) { +      self.result.status = self.status(enabledAgain); +      self.resultCallback(self.result); + +      if (onComplete) { +        onComplete(); +      } +    } +  } + +  cancel() { +    if (this.currentRun) { +      this.currentRun.cancel(); +    } +  } + +  onException(error) { +    if (Spec.isPendingSpecException(error)) { +      this.pend(extractCustomPendingMessage(error)); +      return; +    } + +    if (error instanceof _ExpectationFailed.default) { +      return; +    } + +    this.addExpectationResult( +      false, +      { +        matcherName: '', +        passed: false, +        expected: '', +        actual: '', +        error: this.isAssertionError(error) +          ? (0, _assertionErrorMessage.default)(error, { +              expand: this.expand +            }) +          : error +      }, +      true +    ); +  } + +  disable() { +    this.disabled = true; +  } + +  pend(message) { +    this.markedPending = true; + +    if (message) { +      this.result.pendingReason = message; +    } +  } + +  todo() { +    this.markedTodo = true; +  } + +  getResult() { +    this.result.status = this.status(); +    return this.result; +  } + +  status(enabled) { +    if (this.disabled || enabled === false) { +      return 'disabled'; +    } + +    if (this.markedTodo) { +      return 'todo'; +    } + +    if (this.markedPending) { +      return 'pending'; +    } + +    if (this.result.failedExpectations.length > 0) { +      return 'failed'; +    } else { +      return 'passed'; +    } +  } + +  isExecutable() { +    return !this.disabled; +  } + +  getFullName() { +    return this.getSpecName(this); +  } + +  isAssertionError(error) { +    return ( +      error instanceof _assert.AssertionError || +      (error && error.name === _assert.AssertionError.name) +    ); +  } +} + +exports.default = Spec; + +_defineProperty(Spec, 'pendingSpecExceptionMessage', void 0); + +Spec.pendingSpecExceptionMessage = '=> marked Pending'; + +const extractCustomPendingMessage = function (e) { +  const fullMessage = e.toString(); +  const boilerplateStart = fullMessage.indexOf( +    Spec.pendingSpecExceptionMessage +  ); +  const boilerplateEnd = +    boilerplateStart + Spec.pendingSpecExceptionMessage.length; +  return fullMessage.substr(boilerplateEnd); +}; diff --git a/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.d.ts b/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.d.ts new file mode 100644 index 0000000..a54754d --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.d.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +export default class SpyStrategy { +    identity: () => string; +    exec: (...args: Array<any>) => unknown; +    callThrough: () => unknown; +    returnValue: (value: unknown) => unknown; +    returnValues: () => unknown; +    throwError: (something: string | Error) => unknown; +    callFake: (fn: Function) => unknown; +    stub: (fn: Function) => unknown; +    constructor({ name, fn, getSpy, }?: { +        name?: string; +        fn?: Function; +        getSpy?: () => unknown; +    }); +} diff --git a/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js b/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js new file mode 100644 index 0000000..fc7de39 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/SpyStrategy.js @@ -0,0 +1,143 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */ +class SpyStrategy { +  constructor({ +    name = 'unknown', +    fn = function () {}, +    getSpy = function () {} +  } = {}) { +    _defineProperty(this, 'identity', void 0); + +    _defineProperty(this, 'exec', void 0); + +    _defineProperty(this, 'callThrough', void 0); + +    _defineProperty(this, 'returnValue', void 0); + +    _defineProperty(this, 'returnValues', void 0); + +    _defineProperty(this, 'throwError', void 0); + +    _defineProperty(this, 'callFake', void 0); + +    _defineProperty(this, 'stub', void 0); + +    const identity = name; +    const originalFn = fn; + +    let plan = function () {}; + +    this.identity = function () { +      return identity; +    }; + +    this.exec = function () { +      return plan.apply(this, arguments); +    }; + +    this.callThrough = function () { +      plan = originalFn; +      return getSpy(); +    }; + +    this.returnValue = function (value) { +      plan = function () { +        return value; +      }; + +      return getSpy(); +    }; + +    this.returnValues = function () { +      const values = Array.prototype.slice.call(arguments); + +      plan = function () { +        return values.shift(); +      }; + +      return getSpy(); +    }; + +    this.throwError = function (something) { +      const error = +        something instanceof Error ? something : new Error(something); + +      plan = function () { +        throw error; +      }; + +      return getSpy(); +    }; + +    this.callFake = function (fn) { +      if (typeof fn !== 'function') { +        throw new Error( +          'Argument passed to callFake should be a function, got ' + fn +        ); +      } + +      plan = fn; +      return getSpy(); +    }; + +    this.stub = function (_fn) { +      plan = function () {}; + +      return getSpy(); +    }; +  } +} + +exports.default = SpyStrategy; diff --git a/node_modules/jest-jasmine2/build/jasmine/Suite.d.ts b/node_modules/jest-jasmine2/build/jasmine/Suite.d.ts new file mode 100644 index 0000000..7bfd374 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/Suite.d.ts @@ -0,0 +1,61 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Config } from '@jest/types'; +import expectationResultFactory from '../expectationResultFactory'; +import type { QueueableFn } from '../queueRunner'; +import type Spec from './Spec'; +export declare type SuiteResult = { +    id: string; +    description: string; +    fullName: string; +    failedExpectations: Array<ReturnType<typeof expectationResultFactory>>; +    testPath: Config.Path; +    status?: string; +}; +export declare type Attributes = { +    id: string; +    parentSuite?: Suite; +    description: string; +    throwOnExpectationFailure?: boolean; +    getTestPath: () => Config.Path; +}; +export default class Suite { +    id: string; +    parentSuite?: Suite; +    description: string; +    throwOnExpectationFailure: boolean; +    beforeFns: Array<QueueableFn>; +    afterFns: Array<QueueableFn>; +    beforeAllFns: Array<QueueableFn>; +    afterAllFns: Array<QueueableFn>; +    disabled: boolean; +    children: Array<Suite | Spec>; +    result: SuiteResult; +    sharedContext?: object; +    markedPending: boolean; +    markedTodo: boolean; +    isFocused: boolean; +    constructor(attrs: Attributes); +    getFullName(): string; +    disable(): void; +    pend(_message?: string): void; +    beforeEach(fn: QueueableFn): void; +    beforeAll(fn: QueueableFn): void; +    afterEach(fn: QueueableFn): void; +    afterAll(fn: QueueableFn): void; +    addChild(child: Suite | Spec): void; +    status(): "failed" | "pending" | "disabled" | "finished"; +    isExecutable(): boolean; +    canBeReentered(): boolean; +    getResult(): SuiteResult; +    sharedUserContext(): object; +    clonedSharedUserContext(): object; +    onException(...args: Parameters<Spec['onException']>): void; +    addExpectationResult(...args: Parameters<Spec['addExpectationResult']>): void; +    execute(..._args: Array<any>): void; +} diff --git a/node_modules/jest-jasmine2/build/jasmine/Suite.js b/node_modules/jest-jasmine2/build/jasmine/Suite.js new file mode 100644 index 0000000..79f9f15 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/Suite.js @@ -0,0 +1,235 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +var _jestUtil = require('jest-util'); + +var _ExpectationFailed = _interopRequireDefault( +  require('../ExpectationFailed') +); + +var _expectationResultFactory = _interopRequireDefault( +  require('../expectationResultFactory') +); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +class Suite { +  constructor(attrs) { +    _defineProperty(this, 'id', void 0); + +    _defineProperty(this, 'parentSuite', void 0); + +    _defineProperty(this, 'description', void 0); + +    _defineProperty(this, 'throwOnExpectationFailure', void 0); + +    _defineProperty(this, 'beforeFns', void 0); + +    _defineProperty(this, 'afterFns', void 0); + +    _defineProperty(this, 'beforeAllFns', void 0); + +    _defineProperty(this, 'afterAllFns', void 0); + +    _defineProperty(this, 'disabled', void 0); + +    _defineProperty(this, 'children', void 0); + +    _defineProperty(this, 'result', void 0); + +    _defineProperty(this, 'sharedContext', void 0); + +    _defineProperty(this, 'markedPending', void 0); + +    _defineProperty(this, 'markedTodo', void 0); + +    _defineProperty(this, 'isFocused', void 0); + +    this.markedPending = false; +    this.markedTodo = false; +    this.isFocused = false; +    this.id = attrs.id; +    this.parentSuite = attrs.parentSuite; +    this.description = (0, _jestUtil.convertDescriptorToString)( +      attrs.description +    ); +    this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; +    this.beforeFns = []; +    this.afterFns = []; +    this.beforeAllFns = []; +    this.afterAllFns = []; +    this.disabled = false; +    this.children = []; +    this.result = { +      id: this.id, +      description: this.description, +      fullName: this.getFullName(), +      failedExpectations: [], +      testPath: attrs.getTestPath() +    }; +  } + +  getFullName() { +    const fullName = []; + +    for ( +      let parentSuite = this; +      parentSuite; +      parentSuite = parentSuite.parentSuite +    ) { +      if (parentSuite.parentSuite) { +        fullName.unshift(parentSuite.description); +      } +    } + +    return fullName.join(' '); +  } + +  disable() { +    this.disabled = true; +  } + +  pend(_message) { +    this.markedPending = true; +  } + +  beforeEach(fn) { +    this.beforeFns.unshift(fn); +  } + +  beforeAll(fn) { +    this.beforeAllFns.push(fn); +  } + +  afterEach(fn) { +    this.afterFns.unshift(fn); +  } + +  afterAll(fn) { +    this.afterAllFns.unshift(fn); +  } + +  addChild(child) { +    this.children.push(child); +  } + +  status() { +    if (this.disabled) { +      return 'disabled'; +    } + +    if (this.markedPending) { +      return 'pending'; +    } + +    if (this.result.failedExpectations.length > 0) { +      return 'failed'; +    } else { +      return 'finished'; +    } +  } + +  isExecutable() { +    return !this.disabled; +  } + +  canBeReentered() { +    return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0; +  } + +  getResult() { +    this.result.status = this.status(); +    return this.result; +  } + +  sharedUserContext() { +    if (!this.sharedContext) { +      this.sharedContext = {}; +    } + +    return this.sharedContext; +  } + +  clonedSharedUserContext() { +    return this.sharedUserContext(); +  } + +  onException(...args) { +    if (args[0] instanceof _ExpectationFailed.default) { +      return; +    } + +    if (isAfterAll(this.children)) { +      const data = { +        matcherName: '', +        passed: false, +        expected: '', +        actual: '', +        error: arguments[0] +      }; +      this.result.failedExpectations.push( +        (0, _expectationResultFactory.default)(data) +      ); +    } else { +      for (let i = 0; i < this.children.length; i++) { +        const child = this.children[i]; +        child.onException.apply(child, args); +      } +    } +  } + +  addExpectationResult(...args) { +    if (isAfterAll(this.children) && isFailure(args)) { +      const data = args[1]; +      this.result.failedExpectations.push( +        (0, _expectationResultFactory.default)(data) +      ); + +      if (this.throwOnExpectationFailure) { +        throw new _ExpectationFailed.default(); +      } +    } else { +      for (let i = 0; i < this.children.length; i++) { +        const child = this.children[i]; + +        try { +          child.addExpectationResult.apply(child, args); +        } catch { +          // keep going +        } +      } +    } +  } + +  execute(..._args) {} +} + +exports.default = Suite; + +function isAfterAll(children) { +  return children && children[0] && children[0].result.status; +} + +function isFailure(args) { +  return !args[0]; +} diff --git a/node_modules/jest-jasmine2/build/jasmine/Timer.d.ts b/node_modules/jest-jasmine2/build/jasmine/Timer.d.ts new file mode 100644 index 0000000..17c97e6 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/Timer.d.ts @@ -0,0 +1,14 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +export default class Timer { +    start: () => void; +    elapsed: () => number; +    constructor(options?: { +        now?: () => number; +    }); +} diff --git a/node_modules/jest-jasmine2/build/jasmine/Timer.js b/node_modules/jest-jasmine2/build/jasmine/Timer.js new file mode 100644 index 0000000..6183940 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/Timer.js @@ -0,0 +1,79 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +const defaultNow = (function (Date) { +  return function () { +    return new Date().getTime(); +  }; +})(Date); + +class Timer { +  constructor(options) { +    _defineProperty(this, 'start', void 0); + +    _defineProperty(this, 'elapsed', void 0); + +    options = options || {}; +    const now = options.now || defaultNow; +    let startTime; + +    this.start = function () { +      startTime = now(); +    }; + +    this.elapsed = function () { +      return now() - startTime; +    }; +  } +} + +exports.default = Timer; diff --git a/node_modules/jest-jasmine2/build/jasmine/createSpy.d.ts b/node_modules/jest-jasmine2/build/jasmine/createSpy.d.ts new file mode 100644 index 0000000..f1d0173 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/createSpy.d.ts @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Spy } from '../types'; +interface Fn extends Record<string, unknown> { +    (): unknown; +} +declare function createSpy(name: string, originalFn: Fn): Spy; +export default createSpy; diff --git a/node_modules/jest-jasmine2/build/jasmine/createSpy.js b/node_modules/jest-jasmine2/build/jasmine/createSpy.js new file mode 100644 index 0000000..17a6728 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/createSpy.js @@ -0,0 +1,88 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +var _CallTracker = _interopRequireDefault(require('./CallTracker')); + +var _SpyStrategy = _interopRequireDefault(require('./SpyStrategy')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* eslint-disable sort-keys, local/prefer-rest-params-eventually */ +function createSpy(name, originalFn) { +  const spyStrategy = new _SpyStrategy.default({ +    name, +    fn: originalFn, + +    getSpy() { +      return spy; +    } +  }); +  const callTracker = new _CallTracker.default(); + +  const spy = function (...args) { +    const callData = { +      object: this, +      args: Array.prototype.slice.apply(arguments) +    }; +    callTracker.track(callData); +    const returnValue = spyStrategy.exec.apply(this, args); +    callData.returnValue = returnValue; +    return returnValue; +  }; + +  for (const prop in originalFn) { +    if (prop === 'and' || prop === 'calls') { +      throw new Error( +        "Jasmine spies would overwrite the 'and' and 'calls' properties " + +          'on the object being spied upon' +      ); +    } + +    spy[prop] = originalFn[prop]; +  } + +  spy.and = spyStrategy; +  spy.calls = callTracker; +  return spy; +} + +var _default = createSpy; +exports.default = _default; diff --git a/node_modules/jest-jasmine2/build/jasmine/jasmineLight.d.ts b/node_modules/jest-jasmine2/build/jasmine/jasmineLight.d.ts new file mode 100644 index 0000000..ad4fe02 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/jasmineLight.d.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Jasmine, SpecDefinitionsFn } from '../types'; +import JsApiReporter from './JsApiReporter'; +export declare const create: (createOptions: Record<string, any>) => Jasmine; +export declare const _interface: (jasmine: Jasmine, env: any) => { +    describe(description: string, specDefinitions: SpecDefinitionsFn): any; +    xdescribe(description: string, specDefinitions: SpecDefinitionsFn): any; +    fdescribe(description: string, specDefinitions: SpecDefinitionsFn): any; +    it(): any; +    xit(): any; +    fit(): any; +    beforeEach(): any; +    afterEach(): any; +    beforeAll(): any; +    afterAll(): any; +    pending(): any; +    fail(): any; +    spyOn(obj: Record<string, any>, methodName: string, accessType?: string | undefined): any; +    jsApiReporter: JsApiReporter; +    jasmine: Jasmine; +}; diff --git a/node_modules/jest-jasmine2/build/jasmine/jasmineLight.js b/node_modules/jest-jasmine2/build/jasmine/jasmineLight.js new file mode 100644 index 0000000..0d921a0 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/jasmineLight.js @@ -0,0 +1,171 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.create = exports._interface = void 0; + +var _Env = _interopRequireDefault(require('./Env')); + +var _JsApiReporter = _interopRequireDefault(require('./JsApiReporter')); + +var _ReportDispatcher = _interopRequireDefault(require('./ReportDispatcher')); + +var _Spec = _interopRequireDefault(require('./Spec')); + +var _Suite = _interopRequireDefault(require('./Suite')); + +var _Timer = _interopRequireDefault(require('./Timer')); + +var _createSpy = _interopRequireDefault(require('./createSpy')); + +var _spyRegistry = _interopRequireDefault(require('./spyRegistry')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +// This file is a heavily modified fork of Jasmine. Original license: + +/* +Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */ +const create = function (createOptions) { +  const j$ = {...createOptions}; +  j$._DEFAULT_TIMEOUT_INTERVAL = createOptions.testTimeout || 5000; + +  j$.getEnv = function () { +    const env = (j$.currentEnv_ = j$.currentEnv_ || new j$.Env()); //jasmine. singletons in here (setTimeout blah blah). + +    return env; +  }; + +  j$.createSpy = _createSpy.default; +  j$.Env = (0, _Env.default)(j$); +  j$.JsApiReporter = _JsApiReporter.default; +  j$.ReportDispatcher = _ReportDispatcher.default; +  j$.Spec = _Spec.default; +  j$.SpyRegistry = _spyRegistry.default; +  j$.Suite = _Suite.default; +  j$.Timer = _Timer.default; +  j$.version = '2.5.2-light'; +  return j$; +}; // Interface is a reserved word in strict mode, so can't export it as ESM + +exports.create = create; + +const _interface = function (jasmine, env) { +  const jasmineInterface = { +    describe(description, specDefinitions) { +      return env.describe(description, specDefinitions); +    }, + +    xdescribe(description, specDefinitions) { +      return env.xdescribe(description, specDefinitions); +    }, + +    fdescribe(description, specDefinitions) { +      return env.fdescribe(description, specDefinitions); +    }, + +    it() { +      return env.it.apply(env, arguments); +    }, + +    xit() { +      return env.xit.apply(env, arguments); +    }, + +    fit() { +      return env.fit.apply(env, arguments); +    }, + +    beforeEach() { +      if (typeof arguments[0] !== 'function') { +        throw new Error( +          'Invalid first argument. It must be a callback function.' +        ); +      } + +      return env.beforeEach.apply(env, arguments); +    }, + +    afterEach() { +      if (typeof arguments[0] !== 'function') { +        throw new Error( +          'Invalid first argument. It must be a callback function.' +        ); +      } + +      return env.afterEach.apply(env, arguments); +    }, + +    beforeAll() { +      if (typeof arguments[0] !== 'function') { +        throw new Error( +          'Invalid first argument. It must be a callback function.' +        ); +      } + +      return env.beforeAll.apply(env, arguments); +    }, + +    afterAll() { +      if (typeof arguments[0] !== 'function') { +        throw new Error( +          'Invalid first argument. It must be a callback function.' +        ); +      } + +      return env.afterAll.apply(env, arguments); +    }, + +    pending() { +      return env.pending.apply(env, arguments); +    }, + +    fail() { +      return env.fail.apply(env, arguments); +    }, + +    spyOn(obj, methodName, accessType) { +      return env.spyOn(obj, methodName, accessType); +    }, + +    jsApiReporter: new jasmine.JsApiReporter({ +      timer: new jasmine.Timer() +    }), +    jasmine +  }; +  return jasmineInterface; +}; + +exports._interface = _interface; diff --git a/node_modules/jest-jasmine2/build/jasmine/spyRegistry.d.ts b/node_modules/jest-jasmine2/build/jasmine/spyRegistry.d.ts new file mode 100644 index 0000000..c5f215c --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/spyRegistry.d.ts @@ -0,0 +1,18 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import type { Spy } from '../types'; +export default class SpyRegistry { +    allowRespy: (allow: unknown) => void; +    spyOn: (obj: Record<string, Spy>, methodName: string, accessType?: keyof PropertyDescriptor) => Spy; +    clearSpies: () => void; +    respy: unknown; +    private _spyOnProperty; +    constructor({ currentSpies, }?: { +        currentSpies?: () => Array<Spy>; +    }); +} diff --git a/node_modules/jest-jasmine2/build/jasmine/spyRegistry.js b/node_modules/jest-jasmine2/build/jasmine/spyRegistry.js new file mode 100644 index 0000000..ce200ff --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmine/spyRegistry.js @@ -0,0 +1,222 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +var _CallTracker = _interopRequireDefault(require('./CallTracker')); + +var _SpyStrategy = _interopRequireDefault(require('./SpyStrategy')); + +var _createSpy = _interopRequireDefault(require('./createSpy')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +const formatErrorMsg = (domain, usage) => { +  const usageDefinition = usage ? '\nUsage: ' + usage : ''; +  return msg => domain + ' : ' + msg + usageDefinition; +}; + +function isSpy(putativeSpy) { +  if (!putativeSpy) { +    return false; +  } + +  return ( +    putativeSpy.and instanceof _SpyStrategy.default && +    putativeSpy.calls instanceof _CallTracker.default +  ); +} + +const getErrorMsg = formatErrorMsg('<spyOn>', 'spyOn(<object>, <methodName>)'); + +class SpyRegistry { +  constructor({currentSpies = () => []} = {}) { +    _defineProperty(this, 'allowRespy', void 0); + +    _defineProperty(this, 'spyOn', void 0); + +    _defineProperty(this, 'clearSpies', void 0); + +    _defineProperty(this, 'respy', void 0); + +    _defineProperty(this, '_spyOnProperty', void 0); + +    this.allowRespy = function (allow) { +      this.respy = allow; +    }; + +    this.spyOn = (obj, methodName, accessType) => { +      if (accessType) { +        return this._spyOnProperty(obj, methodName, accessType); +      } + +      if (obj === void 0) { +        throw new Error( +          getErrorMsg( +            'could not find an object to spy upon for ' + methodName + '()' +          ) +        ); +      } + +      if (methodName === void 0) { +        throw new Error(getErrorMsg('No method name supplied')); +      } + +      if (obj[methodName] === void 0) { +        throw new Error(getErrorMsg(methodName + '() method does not exist')); +      } + +      if (obj[methodName] && isSpy(obj[methodName])) { +        if (this.respy) { +          return obj[methodName]; +        } else { +          throw new Error( +            getErrorMsg(methodName + ' has already been spied upon') +          ); +        } +      } + +      let descriptor; + +      try { +        descriptor = Object.getOwnPropertyDescriptor(obj, methodName); +      } catch { +        // IE 8 doesn't support `definePropery` on non-DOM nodes +      } + +      if (descriptor && !(descriptor.writable || descriptor.set)) { +        throw new Error( +          getErrorMsg(methodName + ' is not declared writable or has no setter') +        ); +      } + +      const originalMethod = obj[methodName]; +      const spiedMethod = (0, _createSpy.default)(methodName, originalMethod); +      let restoreStrategy; + +      if (Object.prototype.hasOwnProperty.call(obj, methodName)) { +        restoreStrategy = function () { +          obj[methodName] = originalMethod; +        }; +      } else { +        restoreStrategy = function () { +          if (!delete obj[methodName]) { +            obj[methodName] = originalMethod; +          } +        }; +      } + +      currentSpies().push({ +        restoreObjectToOriginalState: restoreStrategy +      }); +      obj[methodName] = spiedMethod; +      return spiedMethod; +    }; + +    this._spyOnProperty = function (obj, propertyName, accessType = 'get') { +      if (!obj) { +        throw new Error( +          getErrorMsg( +            'could not find an object to spy upon for ' + propertyName +          ) +        ); +      } + +      if (!propertyName) { +        throw new Error(getErrorMsg('No property name supplied')); +      } + +      let descriptor; + +      try { +        descriptor = Object.getOwnPropertyDescriptor(obj, propertyName); +      } catch { +        // IE 8 doesn't support `definePropery` on non-DOM nodes +      } + +      if (!descriptor) { +        throw new Error(getErrorMsg(propertyName + ' property does not exist')); +      } + +      if (!descriptor.configurable) { +        throw new Error( +          getErrorMsg(propertyName + ' is not declared configurable') +        ); +      } + +      if (!descriptor[accessType]) { +        throw new Error( +          getErrorMsg( +            'Property ' + +              propertyName + +              ' does not have access type ' + +              accessType +          ) +        ); +      } + +      if (obj[propertyName] && isSpy(obj[propertyName])) { +        if (this.respy) { +          return obj[propertyName]; +        } else { +          throw new Error( +            getErrorMsg(propertyName + ' has already been spied upon') +          ); +        } +      } + +      const originalDescriptor = descriptor; +      const spiedProperty = (0, _createSpy.default)( +        propertyName, +        descriptor[accessType] +      ); +      let restoreStrategy; + +      if (Object.prototype.hasOwnProperty.call(obj, propertyName)) { +        restoreStrategy = function () { +          Object.defineProperty(obj, propertyName, originalDescriptor); +        }; +      } else { +        restoreStrategy = function () { +          delete obj[propertyName]; +        }; +      } + +      currentSpies().push({ +        restoreObjectToOriginalState: restoreStrategy +      }); +      const spiedDescriptor = {...descriptor, [accessType]: spiedProperty}; +      Object.defineProperty(obj, propertyName, spiedDescriptor); +      return spiedProperty; +    }; + +    this.clearSpies = function () { +      const spies = currentSpies(); + +      for (let i = spies.length - 1; i >= 0; i--) { +        const spyEntry = spies[i]; +        spyEntry.restoreObjectToOriginalState(); +      } +    }; +  } +} + +exports.default = SpyRegistry; diff --git a/node_modules/jest-jasmine2/build/jasmineAsyncInstall.d.ts b/node_modules/jest-jasmine2/build/jasmineAsyncInstall.d.ts new file mode 100644 index 0000000..34382fd --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmineAsyncInstall.d.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config, Global } from '@jest/types'; +export default function jasmineAsyncInstall(globalConfig: Config.GlobalConfig, global: Global.Global): void; diff --git a/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js b/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js new file mode 100644 index 0000000..83984e8 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js @@ -0,0 +1,259 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = jasmineAsyncInstall; + +var _co = _interopRequireDefault(require('co')); + +var _isGeneratorFn = _interopRequireDefault(require('is-generator-fn')); + +var _throat = _interopRequireDefault(require('throat')); + +var _isError = _interopRequireDefault(require('./isError')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +function isPromise(obj) { +  return obj && typeof obj.then === 'function'; +} + +const doneFnNoop = () => {}; + +doneFnNoop.fail = () => {}; + +function promisifyLifeCycleFunction(originalFn, env) { +  return function (fn, timeout) { +    if (!fn) { +      // @ts-expect-error: missing fn arg is handled by originalFn +      return originalFn.call(env); +    } + +    if (typeof fn !== 'function') { +      // Pass non-functions to Jest, which throws a nice error. +      return originalFn.call(env, fn, timeout); +    } + +    const hasDoneCallback = fn.length > 0; + +    if (hasDoneCallback) { +      // Give the function a name so it can be detected in call stacks, but +      // otherwise Jasmine will handle it. +      const asyncJestLifecycleWithCallback = function (...args) { +        // @ts-expect-error: Support possible extra args at runtime +        return fn.apply(this, args); +      }; + +      return originalFn.call(env, asyncJestLifecycleWithCallback, timeout); +    } + +    const extraError = new Error(); // Without this line v8 stores references to all closures +    // in the stack in the Error object. This line stringifies the stack +    // property to allow garbage-collecting objects on the stack +    // https://crbug.com/v8/7142 + +    extraError.stack = extraError.stack; // We make *all* functions async and run `done` right away if they +    // didn't return a promise. + +    const asyncJestLifecycle = function (done) { +      const wrappedFn = (0, _isGeneratorFn.default)(fn) +        ? _co.default.wrap(fn) +        : fn; +      const returnValue = wrappedFn.call({}, doneFnNoop); + +      if (isPromise(returnValue)) { +        returnValue.then(done.bind(null, null), error => { +          const {isError: checkIsError, message} = (0, _isError.default)(error); + +          if (message) { +            extraError.message = message; +          } + +          done.fail(checkIsError ? error : extraError); +        }); +      } else { +        done(); +      } +    }; + +    return originalFn.call(env, asyncJestLifecycle, timeout); +  }; +} // Similar to promisifyLifeCycleFunction but throws an error +// when the return value is neither a Promise nor `undefined` + +function promisifyIt(originalFn, env, jasmine) { +  return function (specName, fn, timeout) { +    if (!fn) { +      // @ts-expect-error: missing fn arg is handled by originalFn +      const spec = originalFn.call(env, specName); +      spec.pend('not implemented'); +      return spec; +    } + +    if (typeof fn !== 'function') { +      // Pass non-functions to Jest, which throws a nice error. +      return originalFn.call(env, specName, fn, timeout); +    } + +    const hasDoneCallback = fn.length > 0; + +    if (hasDoneCallback) { +      // Give the function a name so it can be detected in call stacks, but +      // otherwise Jasmine will handle it. +      const asyncJestTestWithCallback = function (...args) { +        // @ts-expect-error: Support possible extra args at runtime +        return fn.apply(this, args); +      }; + +      return originalFn.call(env, specName, asyncJestTestWithCallback, timeout); +    } + +    const extraError = new Error(); // Without this line v8 stores references to all closures +    // in the stack in the Error object. This line stringifies the stack +    // property to allow garbage-collecting objects on the stack +    // https://crbug.com/v8/7142 + +    extraError.stack = extraError.stack; + +    const asyncJestTest = function (done) { +      const wrappedFn = (0, _isGeneratorFn.default)(fn) +        ? _co.default.wrap(fn) +        : fn; +      const returnValue = wrappedFn.call({}, doneFnNoop); + +      if (isPromise(returnValue)) { +        returnValue.then(done.bind(null, null), error => { +          const {isError: checkIsError, message} = (0, _isError.default)(error); + +          if (message) { +            extraError.message = message; +          } + +          if (jasmine.Spec.isPendingSpecException(error)) { +            env.pending(message); +            done(); +          } else { +            done.fail(checkIsError ? error : extraError); +          } +        }); +      } else if (returnValue === undefined) { +        done(); +      } else { +        done.fail( +          new Error( +            'Jest: `it` and `test` must return either a Promise or undefined.' +          ) +        ); +      } +    }; + +    return originalFn.call(env, specName, asyncJestTest, timeout); +  }; +} + +function makeConcurrent(originalFn, env, mutex) { +  const concurrentFn = function (specName, fn, timeout) { +    let promise = Promise.resolve(); +    const spec = originalFn.call(env, specName, () => promise, timeout); + +    if (env != null && !env.specFilter(spec)) { +      return spec; +    } + +    try { +      promise = mutex(() => { +        const promise = fn(); + +        if (isPromise(promise)) { +          return promise; +        } + +        throw new Error( +          `Jest: concurrent test "${spec.getFullName()}" must return a Promise.` +        ); +      }); +    } catch (error) { +      promise = Promise.reject(error); +    } // Avoid triggering the uncaught promise rejection handler in case the test errors before +    // being awaited on. + +    promise.catch(() => {}); +    return spec; +  }; // each is binded after the function is made concurrent, so for now it is made noop + +  concurrentFn.each = () => () => {}; + +  return concurrentFn; +} + +function jasmineAsyncInstall(globalConfig, global) { +  const jasmine = global.jasmine; +  const mutex = (0, _throat.default)(globalConfig.maxConcurrency); +  const env = jasmine.getEnv(); +  env.it = promisifyIt(env.it, env, jasmine); +  env.fit = promisifyIt(env.fit, env, jasmine); + +  global.it.concurrent = (env => { +    const concurrent = makeConcurrent(env.it, env, mutex); +    concurrent.only = makeConcurrent(env.fit, env, mutex); +    concurrent.skip = makeConcurrent(env.xit, env, mutex); +    return concurrent; +  })(env); + +  global.fit.concurrent = makeConcurrent(env.fit, env, mutex); +  env.afterAll = promisifyLifeCycleFunction(env.afterAll, env); +  env.afterEach = promisifyLifeCycleFunction(env.afterEach, env); +  env.beforeAll = promisifyLifeCycleFunction(env.beforeAll, env); +  env.beforeEach = promisifyLifeCycleFunction(env.beforeEach, env); +} diff --git a/node_modules/jest-jasmine2/build/jestExpect.d.ts b/node_modules/jest-jasmine2/build/jestExpect.d.ts new file mode 100644 index 0000000..e0cf153 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jestExpect.d.ts @@ -0,0 +1,9 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default function jestExpect(config: { +    expand: boolean; +}): void; diff --git a/node_modules/jest-jasmine2/build/jestExpect.js b/node_modules/jest-jasmine2/build/jestExpect.js new file mode 100644 index 0000000..3b4b191 --- /dev/null +++ b/node_modules/jest-jasmine2/build/jestExpect.js @@ -0,0 +1,69 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = jestExpect; + +var _expect = _interopRequireDefault(require('expect')); + +var _jestSnapshot = require('jest-snapshot'); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* eslint-disable local/prefer-spread-eventually */ +function jestExpect(config) { +  global.expect = _expect.default; + +  _expect.default.setState({ +    expand: config.expand +  }); + +  _expect.default.extend({ +    toMatchInlineSnapshot: _jestSnapshot.toMatchInlineSnapshot, +    toMatchSnapshot: _jestSnapshot.toMatchSnapshot, +    toThrowErrorMatchingInlineSnapshot: +      _jestSnapshot.toThrowErrorMatchingInlineSnapshot, +    toThrowErrorMatchingSnapshot: _jestSnapshot.toThrowErrorMatchingSnapshot +  }); + +  _expect.default.addSnapshotSerializer = _jestSnapshot.addSerializer; +  const jasmine = global.jasmine; +  jasmine.anything = _expect.default.anything; +  jasmine.any = _expect.default.any; +  jasmine.objectContaining = _expect.default.objectContaining; +  jasmine.arrayContaining = _expect.default.arrayContaining; +  jasmine.stringMatching = _expect.default.stringMatching; + +  jasmine.addMatchers = jasmineMatchersObject => { +    const jestMatchersObject = Object.create(null); +    Object.keys(jasmineMatchersObject).forEach(name => { +      jestMatchersObject[name] = function (...args) { +        // use "expect.extend" if you need to use equality testers (via this.equal) +        const result = jasmineMatchersObject[name](null, null); // if there is no 'negativeCompare', both should be handled by `compare` + +        const negativeCompare = result.negativeCompare || result.compare; +        return this.isNot +          ? negativeCompare.apply( +              null, // @ts-expect-error +              args +            ) +          : result.compare.apply( +              null, // @ts-expect-error +              args +            ); +      }; +    }); + +    _expect.default.extend(jestMatchersObject); +  }; +} diff --git a/node_modules/jest-jasmine2/build/pTimeout.d.ts b/node_modules/jest-jasmine2/build/pTimeout.d.ts new file mode 100644 index 0000000..58bbcf8 --- /dev/null +++ b/node_modules/jest-jasmine2/build/pTimeout.d.ts @@ -0,0 +1,7 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export default function pTimeout(promise: Promise<void>, ms: number, clearTimeout: typeof globalThis['clearTimeout'], setTimeout: typeof globalThis['setTimeout'], onTimeout: () => void): Promise<void>; diff --git a/node_modules/jest-jasmine2/build/pTimeout.js b/node_modules/jest-jasmine2/build/pTimeout.js new file mode 100644 index 0000000..94808fc --- /dev/null +++ b/node_modules/jest-jasmine2/build/pTimeout.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = pTimeout; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// A specialized version of `p-timeout` that does not touch globals. +// It does not throw on timeout. +function pTimeout(promise, ms, clearTimeout, setTimeout, onTimeout) { +  return new Promise((resolve, reject) => { +    const timer = setTimeout(() => resolve(onTimeout()), ms); +    promise.then( +      val => { +        clearTimeout(timer); +        resolve(val); +      }, +      err => { +        clearTimeout(timer); +        reject(err); +      } +    ); +  }); +} diff --git a/node_modules/jest-jasmine2/build/queueRunner.d.ts b/node_modules/jest-jasmine2/build/queueRunner.d.ts new file mode 100644 index 0000000..613be2f --- /dev/null +++ b/node_modules/jest-jasmine2/build/queueRunner.d.ts @@ -0,0 +1,29 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +export declare type Options = { +    clearTimeout: typeof globalThis['clearTimeout']; +    fail: (error: Error) => void; +    onException: (error: Error) => void; +    queueableFns: Array<QueueableFn>; +    setTimeout: typeof globalThis['setTimeout']; +    userContext: unknown; +}; +export interface DoneFn { +    (error?: any): void; +    fail: (error: Error) => void; +} +export declare type QueueableFn = { +    fn: (done: DoneFn) => void; +    timeout?: () => number; +    initError?: Error; +}; +declare type PromiseCallback = (() => void | PromiseLike<void>) | undefined | null; +export default function queueRunner(options: Options): PromiseLike<void> & { +    cancel: () => void; +    catch: (onRejected?: PromiseCallback) => Promise<void>; +}; +export {}; diff --git a/node_modules/jest-jasmine2/build/queueRunner.js b/node_modules/jest-jasmine2/build/queueRunner.js new file mode 100644 index 0000000..1580255 --- /dev/null +++ b/node_modules/jest-jasmine2/build/queueRunner.js @@ -0,0 +1,127 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = queueRunner; + +var _jestUtil = require('jest-util'); + +var _PCancelable = _interopRequireDefault(require('./PCancelable')); + +var _pTimeout = _interopRequireDefault(require('./pTimeout')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +function queueRunner(options) { +  const token = new _PCancelable.default((onCancel, resolve) => { +    onCancel(resolve); +  }); + +  const mapper = ({fn, timeout, initError = new Error()}) => { +    let promise = new Promise(resolve => { +      const next = function (...args) { +        const err = args[0]; + +        if (err) { +          options.fail.apply(null, args); +        } + +        resolve(); +      }; + +      next.fail = function (...args) { +        options.fail.apply(null, args); +        resolve(); +      }; + +      try { +        fn.call(options.userContext, next); +      } catch (e) { +        options.onException(e); +        resolve(); +      } +    }); +    promise = Promise.race([promise, token]); + +    if (!timeout) { +      return promise; +    } + +    const timeoutMs = timeout(); +    return (0, _pTimeout.default)( +      promise, +      timeoutMs, +      options.clearTimeout, +      options.setTimeout, +      () => { +        initError.message = +          'Timeout - Async callback was not invoked within the ' + +          (0, _jestUtil.formatTime)(timeoutMs) + +          ' timeout specified by jest.setTimeout.'; +        initError.stack = initError.message + initError.stack; +        options.onException(initError); +      } +    ); +  }; + +  const result = options.queueableFns.reduce( +    (promise, fn) => promise.then(() => mapper(fn)), +    Promise.resolve() +  ); +  return { +    cancel: token.cancel.bind(token), +    catch: result.catch.bind(result), +    then: result.then.bind(result) +  }; +} diff --git a/node_modules/jest-jasmine2/build/reporter.d.ts b/node_modules/jest-jasmine2/build/reporter.d.ts new file mode 100644 index 0000000..3d6ee8c --- /dev/null +++ b/node_modules/jest-jasmine2/build/reporter.d.ts @@ -0,0 +1,31 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import { TestResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type { SpecResult } from './jasmine/Spec'; +import type { SuiteResult } from './jasmine/Suite'; +import type { Reporter, RunDetails } from './types'; +export default class Jasmine2Reporter implements Reporter { +    private _testResults; +    private _globalConfig; +    private _config; +    private _currentSuites; +    private _resolve; +    private _resultsPromise; +    private _startTimes; +    private _testPath; +    constructor(globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, testPath: Config.Path); +    jasmineStarted(_runDetails: RunDetails): void; +    specStarted(spec: SpecResult): void; +    specDone(result: SpecResult): void; +    suiteStarted(suite: SuiteResult): void; +    suiteDone(_result: SuiteResult): void; +    jasmineDone(_runDetails: RunDetails): void; +    getResults(): Promise<TestResult>; +    private _addMissingMessageToStack; +    private _extractSpecResults; +} diff --git a/node_modules/jest-jasmine2/build/reporter.js b/node_modules/jest-jasmine2/build/reporter.js new file mode 100644 index 0000000..46ec609 --- /dev/null +++ b/node_modules/jest-jasmine2/build/reporter.js @@ -0,0 +1,250 @@ +'use strict'; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +var _testResult = require('@jest/test-result'); + +var _jestMessageUtil = require('jest-message-util'); + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var jestNow = global[Symbol.for('jest-native-now')] || global.Date.now; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; + +var global = (function () { +  if (typeof globalThis !== 'undefined') { +    return globalThis; +  } else if (typeof global !== 'undefined') { +    return global; +  } else if (typeof self !== 'undefined') { +    return self; +  } else if (typeof window !== 'undefined') { +    return window; +  } else { +    return Function('return this')(); +  } +})(); + +var Promise = global[Symbol.for('jest-native-promise')] || global.Promise; + +function _defineProperty(obj, key, value) { +  if (key in obj) { +    Object.defineProperty(obj, key, { +      value: value, +      enumerable: true, +      configurable: true, +      writable: true +    }); +  } else { +    obj[key] = value; +  } +  return obj; +} + +class Jasmine2Reporter { +  constructor(globalConfig, config, testPath) { +    _defineProperty(this, '_testResults', void 0); + +    _defineProperty(this, '_globalConfig', void 0); + +    _defineProperty(this, '_config', void 0); + +    _defineProperty(this, '_currentSuites', void 0); + +    _defineProperty(this, '_resolve', void 0); + +    _defineProperty(this, '_resultsPromise', void 0); + +    _defineProperty(this, '_startTimes', void 0); + +    _defineProperty(this, '_testPath', void 0); + +    this._globalConfig = globalConfig; +    this._config = config; +    this._testPath = testPath; +    this._testResults = []; +    this._currentSuites = []; +    this._resolve = null; +    this._resultsPromise = new Promise(resolve => (this._resolve = resolve)); +    this._startTimes = new Map(); +  } + +  jasmineStarted(_runDetails) {} + +  specStarted(spec) { +    this._startTimes.set(spec.id, jestNow()); +  } + +  specDone(result) { +    this._testResults.push( +      this._extractSpecResults(result, this._currentSuites.slice(0)) +    ); +  } + +  suiteStarted(suite) { +    this._currentSuites.push(suite.description); +  } + +  suiteDone(_result) { +    this._currentSuites.pop(); +  } + +  jasmineDone(_runDetails) { +    let numFailingTests = 0; +    let numPassingTests = 0; +    let numPendingTests = 0; +    let numTodoTests = 0; +    const testResults = this._testResults; +    testResults.forEach(testResult => { +      if (testResult.status === 'failed') { +        numFailingTests++; +      } else if (testResult.status === 'pending') { +        numPendingTests++; +      } else if (testResult.status === 'todo') { +        numTodoTests++; +      } else { +        numPassingTests++; +      } +    }); +    const testResult = { +      ...(0, _testResult.createEmptyTestResult)(), +      console: null, +      failureMessage: (0, _jestMessageUtil.formatResultsErrors)( +        testResults, +        this._config, +        this._globalConfig, +        this._testPath +      ), +      numFailingTests, +      numPassingTests, +      numPendingTests, +      numTodoTests, +      snapshot: { +        added: 0, +        fileDeleted: false, +        matched: 0, +        unchecked: 0, +        unmatched: 0, +        updated: 0 +      }, +      testFilePath: this._testPath, +      testResults +    }; + +    this._resolve(testResult); +  } + +  getResults() { +    return this._resultsPromise; +  } + +  _addMissingMessageToStack(stack, message) { +    // Some errors (e.g. Angular injection error) don't prepend error.message +    // to stack, instead the first line of the stack is just plain 'Error' +    const ERROR_REGEX = /^Error:?\s*\n/; + +    if (stack && message && !stack.includes(message)) { +      return message + stack.replace(ERROR_REGEX, '\n'); +    } + +    return stack; +  } + +  _extractSpecResults(specResult, ancestorTitles) { +    const start = this._startTimes.get(specResult.id); + +    const duration = start ? jestNow() - start : undefined; +    const status = +      specResult.status === 'disabled' ? 'pending' : specResult.status; +    const location = specResult.__callsite +      ? { +          column: specResult.__callsite.getColumnNumber(), +          line: specResult.__callsite.getLineNumber() +        } +      : null; +    const results = { +      ancestorTitles, +      duration, +      failureDetails: [], +      failureMessages: [], +      fullName: specResult.fullName, +      location, +      numPassingAsserts: 0, +      // Jasmine2 only returns an array of failed asserts. +      status, +      title: specResult.description +    }; +    specResult.failedExpectations.forEach(failed => { +      const message = +        !failed.matcherName && typeof failed.stack === 'string' +          ? this._addMissingMessageToStack(failed.stack, failed.message) +          : failed.message || ''; +      results.failureMessages.push(message); +      results.failureDetails.push(failed); +    }); +    return results; +  } +} + +exports.default = Jasmine2Reporter; diff --git a/node_modules/jest-jasmine2/build/setup_jest_globals.d.ts b/node_modules/jest-jasmine2/build/setup_jest_globals.d.ts new file mode 100644 index 0000000..e8f2476 --- /dev/null +++ b/node_modules/jest-jasmine2/build/setup_jest_globals.d.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { Config } from '@jest/types'; +import { SnapshotStateType } from 'jest-snapshot'; +import type { Plugin } from 'pretty-format'; +export declare type SetupOptions = { +    config: Config.ProjectConfig; +    globalConfig: Config.GlobalConfig; +    localRequire: (moduleName: string) => Plugin; +    testPath: Config.Path; +}; +export default function setupJestGlobals({ config, globalConfig, localRequire, testPath, }: SetupOptions): Promise<SnapshotStateType>; diff --git a/node_modules/jest-jasmine2/build/setup_jest_globals.js b/node_modules/jest-jasmine2/build/setup_jest_globals.js new file mode 100644 index 0000000..04f8b5e --- /dev/null +++ b/node_modules/jest-jasmine2/build/setup_jest_globals.js @@ -0,0 +1,121 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = setupJestGlobals; + +var _expect = require('expect'); + +var _jestSnapshot = require('jest-snapshot'); + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// Get suppressed errors form  jest-matchers that weren't throw during +// test execution and add them to the test result, potentially failing +// a passing test. +const addSuppressedErrors = result => { +  const {suppressedErrors} = (0, _expect.getState)(); +  (0, _expect.setState)({ +    suppressedErrors: [] +  }); + +  if (suppressedErrors.length) { +    result.status = 'failed'; +    result.failedExpectations = suppressedErrors.map(error => ({ +      actual: '', +      // passing error for custom test reporters +      error, +      expected: '', +      matcherName: '', +      message: error.message, +      passed: false, +      stack: error.stack +    })); +  } +}; + +const addAssertionErrors = result => { +  const assertionErrors = (0, _expect.extractExpectedAssertionsErrors)(); + +  if (assertionErrors.length) { +    const jasmineErrors = assertionErrors.map(({actual, error, expected}) => ({ +      actual, +      expected, +      message: error.stack, +      passed: false +    })); +    result.status = 'failed'; +    result.failedExpectations = result.failedExpectations.concat(jasmineErrors); +  } +}; + +const patchJasmine = () => { +  global.jasmine.Spec = (realSpec => { +    class Spec extends realSpec { +      constructor(attr) { +        const resultCallback = attr.resultCallback; + +        attr.resultCallback = function (result) { +          addSuppressedErrors(result); +          addAssertionErrors(result); +          resultCallback.call(attr, result); +        }; + +        const onStart = attr.onStart; + +        attr.onStart = context => { +          (0, _expect.setState)({ +            currentTestName: context.getFullName() +          }); +          onStart && onStart.call(attr, context); +        }; + +        super(attr); +      } +    } + +    return Spec; +  })(global.jasmine.Spec); +}; + +async function setupJestGlobals({ +  config, +  globalConfig, +  localRequire, +  testPath +}) { +  // Jest tests snapshotSerializers in order preceding built-in serializers. +  // Therefore, add in reverse because the last added is the first tested. +  config.snapshotSerializers +    .concat() +    .reverse() +    .forEach(path => { +      (0, _jestSnapshot.addSerializer)(localRequire(path)); +    }); +  patchJasmine(); +  const {expand, updateSnapshot} = globalConfig; +  const {prettierPath, snapshotFormat} = config; +  const snapshotResolver = await (0, _jestSnapshot.buildSnapshotResolver)( +    config, +    localRequire +  ); +  const snapshotPath = snapshotResolver.resolveSnapshotPath(testPath); +  const snapshotState = new _jestSnapshot.SnapshotState(snapshotPath, { +    expand, +    prettierPath, +    snapshotFormat, +    updateSnapshot +  }); // @ts-expect-error: snapshotState is a jest extension of `expect` + +  (0, _expect.setState)({ +    snapshotState, +    testPath +  }); // Return it back to the outer scope (test runner outside the VM). + +  return snapshotState; +} diff --git a/node_modules/jest-jasmine2/build/treeProcessor.d.ts b/node_modules/jest-jasmine2/build/treeProcessor.d.ts new file mode 100644 index 0000000..fdeee94 --- /dev/null +++ b/node_modules/jest-jasmine2/build/treeProcessor.d.ts @@ -0,0 +1,26 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type Suite from './jasmine/Suite'; +declare type Options = { +    nodeComplete: (suite: TreeNode) => void; +    nodeStart: (suite: TreeNode) => void; +    queueRunnerFactory: any; +    runnableIds: Array<string>; +    tree: TreeNode; +}; +export declare type TreeNode = { +    afterAllFns: Array<unknown>; +    beforeAllFns: Array<unknown>; +    disabled?: boolean; +    execute: (onComplete: () => void, enabled: boolean) => void; +    id: string; +    onException: (error: Error) => void; +    sharedUserContext: () => unknown; +    children?: Array<TreeNode>; +} & Pick<Suite, 'getResult' | 'parentSuite' | 'result' | 'markedPending'>; +export default function treeProcessor(options: Options): void; +export {}; diff --git a/node_modules/jest-jasmine2/build/treeProcessor.js b/node_modules/jest-jasmine2/build/treeProcessor.js new file mode 100644 index 0000000..41576a1 --- /dev/null +++ b/node_modules/jest-jasmine2/build/treeProcessor.js @@ -0,0 +1,82 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = treeProcessor; + +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +function treeProcessor(options) { +  const {nodeComplete, nodeStart, queueRunnerFactory, runnableIds, tree} = +    options; + +  function isEnabled(node, parentEnabled) { +    return parentEnabled || runnableIds.indexOf(node.id) !== -1; +  } + +  function getNodeHandler(node, parentEnabled) { +    const enabled = isEnabled(node, parentEnabled); +    return node.children +      ? getNodeWithChildrenHandler(node, enabled) +      : getNodeWithoutChildrenHandler(node, enabled); +  } + +  function getNodeWithoutChildrenHandler(node, enabled) { +    return function fn(done = () => {}) { +      node.execute(done, enabled); +    }; +  } + +  function getNodeWithChildrenHandler(node, enabled) { +    return async function fn(done = () => {}) { +      nodeStart(node); +      await queueRunnerFactory({ +        onException: error => node.onException(error), +        queueableFns: wrapChildren(node, enabled), +        userContext: node.sharedUserContext() +      }); +      nodeComplete(node); +      done(); +    }; +  } + +  function hasNoEnabledTest(node) { +    var _node$children$every, _node$children; + +    return ( +      node.disabled || +      node.markedPending || +      ((_node$children$every = +        (_node$children = node.children) === null || _node$children === void 0 +          ? void 0 +          : _node$children.every(hasNoEnabledTest)) !== null && +      _node$children$every !== void 0 +        ? _node$children$every +        : false) +    ); +  } + +  function wrapChildren(node, enabled) { +    if (!node.children) { +      throw new Error('`node.children` is not defined.'); +    } + +    const children = node.children.map(child => ({ +      fn: getNodeHandler(child, enabled) +    })); + +    if (hasNoEnabledTest(node)) { +      return children; +    } + +    return node.beforeAllFns.concat(children).concat(node.afterAllFns); +  } + +  const treeHandler = getNodeHandler(tree, false); +  return treeHandler(); +} diff --git a/node_modules/jest-jasmine2/build/types.d.ts b/node_modules/jest-jasmine2/build/types.d.ts new file mode 100644 index 0000000..baa4481 --- /dev/null +++ b/node_modules/jest-jasmine2/build/types.d.ts @@ -0,0 +1,82 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/// <reference types="node" /> +import type { AssertionError } from 'assert'; +import type { Config } from '@jest/types'; +import expect = require('expect'); +import type CallTracker from './jasmine/CallTracker'; +import type Env from './jasmine/Env'; +import type JsApiReporter from './jasmine/JsApiReporter'; +import type ReportDispatcher from './jasmine/ReportDispatcher'; +import type { default as Spec, SpecResult } from './jasmine/Spec'; +import type SpyStrategy from './jasmine/SpyStrategy'; +import type { default as Suite, SuiteResult } from './jasmine/Suite'; +import type Timer from './jasmine/Timer'; +import type createSpy from './jasmine/createSpy'; +import type SpyRegistry from './jasmine/spyRegistry'; +export declare type SpecDefinitionsFn = () => void; +export interface AssertionErrorWithStack extends AssertionError { +    stack: string; +} +export declare type SyncExpectationResult = { +    pass: boolean; +    message: () => string; +}; +export declare type AsyncExpectationResult = Promise<SyncExpectationResult>; +export declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult; +export declare type RawMatcherFn = (expected: unknown, actual: unknown, options?: unknown) => ExpectationResult; +export declare type RunDetails = { +    totalSpecsDefined?: number; +    failedExpectations?: SuiteResult['failedExpectations']; +}; +export declare type Reporter = { +    jasmineDone: (runDetails: RunDetails) => void; +    jasmineStarted: (runDetails: RunDetails) => void; +    specDone: (result: SpecResult) => void; +    specStarted: (spec: SpecResult) => void; +    suiteDone: (result: SuiteResult) => void; +    suiteStarted: (result: SuiteResult) => void; +}; +export interface Spy extends Record<string, any> { +    (this: Record<string, unknown>, ...args: Array<any>): unknown; +    and: SpyStrategy; +    calls: CallTracker; +    restoreObjectToOriginalState?: () => void; +} +declare type JasmineMatcher = { +    (matchersUtil: unknown, context: unknown): JasmineMatcher; +    compare: () => RawMatcherFn; +    negativeCompare: () => RawMatcherFn; +}; +export declare type JasmineMatchersObject = { +    [id: string]: JasmineMatcher; +}; +export declare type Jasmine = { +    _DEFAULT_TIMEOUT_INTERVAL: number; +    DEFAULT_TIMEOUT_INTERVAL: number; +    currentEnv_: ReturnType<typeof Env>['prototype']; +    getEnv: () => ReturnType<typeof Env>['prototype']; +    createSpy: typeof createSpy; +    Env: ReturnType<typeof Env>; +    JsApiReporter: typeof JsApiReporter; +    ReportDispatcher: typeof ReportDispatcher; +    Spec: typeof Spec; +    SpyRegistry: typeof SpyRegistry; +    Suite: typeof Suite; +    Timer: typeof Timer; +    version: string; +    testPath: Config.Path; +    addMatchers: (matchers: JasmineMatchersObject) => void; +} & typeof expect & typeof globalThis; +declare global { +    namespace NodeJS { +        interface Global { +            expect: typeof expect; +        } +    } +} +export {}; diff --git a/node_modules/jest-jasmine2/build/types.js b/node_modules/jest-jasmine2/build/types.js new file mode 100644 index 0000000..d852d24 --- /dev/null +++ b/node_modules/jest-jasmine2/build/types.js @@ -0,0 +1,7 @@ +'use strict'; + +var _expect = _interopRequireDefault(require('expect')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +}  | 
