diff options
Diffstat (limited to 'node_modules/@jest')
204 files changed, 16399 insertions, 0 deletions
diff --git a/node_modules/@jest/console/LICENSE b/node_modules/@jest/console/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/console/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/console/build/BufferedConsole.d.ts b/node_modules/@jest/console/build/BufferedConsole.d.ts new file mode 100644 index 0000000..9cc019e --- /dev/null +++ b/node_modules/@jest/console/build/BufferedConsole.d.ts @@ -0,0 +1,37 @@ +/** + * 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 { Console } from 'console'; +import { InspectOptions } from 'util'; +import type { ConsoleBuffer, LogMessage, LogType } from './types'; +export default class BufferedConsole extends Console { +    private _buffer; +    private _counters; +    private _timers; +    private _groupDepth; +    Console: typeof Console; +    constructor(); +    static write(buffer: ConsoleBuffer, type: LogType, message: LogMessage, level?: number | null): ConsoleBuffer; +    private _log; +    assert(value: unknown, message?: string | Error): void; +    count(label?: string): void; +    countReset(label?: string): void; +    debug(firstArg: unknown, ...rest: Array<unknown>): void; +    dir(firstArg: unknown, options?: InspectOptions): void; +    dirxml(firstArg: unknown, ...rest: Array<unknown>): void; +    error(firstArg: unknown, ...rest: Array<unknown>): void; +    group(title?: string, ...rest: Array<unknown>): void; +    groupCollapsed(title?: string, ...rest: Array<unknown>): void; +    groupEnd(): void; +    info(firstArg: unknown, ...rest: Array<unknown>): void; +    log(firstArg: unknown, ...rest: Array<unknown>): void; +    time(label?: string): void; +    timeEnd(label?: string): void; +    timeLog(label?: string, ...data: Array<unknown>): void; +    warn(firstArg: unknown, ...rest: Array<unknown>): void; +    getBuffer(): ConsoleBuffer | undefined; +} diff --git a/node_modules/@jest/console/build/BufferedConsole.js b/node_modules/@jest/console/build/BufferedConsole.js new file mode 100644 index 0000000..defe659 --- /dev/null +++ b/node_modules/@jest/console/build/BufferedConsole.js @@ -0,0 +1,258 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _assert() { +  const data = _interopRequireDefault(require('assert')); + +  _assert = function () { +    return data; +  }; + +  return data; +} + +function _console() { +  const data = require('console'); + +  _console = function () { +    return data; +  }; + +  return data; +} + +function _util() { +  const data = require('util'); + +  _util = function () { +    return data; +  }; + +  return data; +} + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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 BufferedConsole extends _console().Console { +  constructor() { +    super({ +      write: message => { +        BufferedConsole.write(this._buffer, 'log', message, null); +        return true; +      } +    }); + +    _defineProperty(this, '_buffer', []); + +    _defineProperty(this, '_counters', {}); + +    _defineProperty(this, '_timers', {}); + +    _defineProperty(this, '_groupDepth', 0); + +    _defineProperty(this, 'Console', _console().Console); +  } + +  static write(buffer, type, message, level) { +    const stackLevel = level != null ? level : 2; +    const rawStack = new (_jestUtil().ErrorWithStack)( +      undefined, +      BufferedConsole.write +    ).stack; +    invariant(rawStack, 'always have a stack trace'); +    const origin = rawStack +      .split('\n') +      .slice(stackLevel) +      .filter(Boolean) +      .join('\n'); +    buffer.push({ +      message, +      origin, +      type +    }); +    return buffer; +  } + +  _log(type, message) { +    BufferedConsole.write( +      this._buffer, +      type, +      '  '.repeat(this._groupDepth) + message, +      3 +    ); +  } + +  assert(value, message) { +    try { +      (0, _assert().default)(value, message); +    } catch (error) { +      this._log('assert', error.toString()); +    } +  } + +  count(label = 'default') { +    if (!this._counters[label]) { +      this._counters[label] = 0; +    } + +    this._log( +      'count', +      (0, _util().format)(`${label}: ${++this._counters[label]}`) +    ); +  } + +  countReset(label = 'default') { +    this._counters[label] = 0; +  } + +  debug(firstArg, ...rest) { +    this._log('debug', (0, _util().format)(firstArg, ...rest)); +  } + +  dir(firstArg, options = {}) { +    const representation = (0, _util().inspect)(firstArg, options); + +    this._log('dir', (0, _util().formatWithOptions)(options, representation)); +  } + +  dirxml(firstArg, ...rest) { +    this._log('dirxml', (0, _util().format)(firstArg, ...rest)); +  } + +  error(firstArg, ...rest) { +    this._log('error', (0, _util().format)(firstArg, ...rest)); +  } + +  group(title, ...rest) { +    this._groupDepth++; + +    if (title || rest.length > 0) { +      this._log( +        'group', +        _chalk().default.bold((0, _util().format)(title, ...rest)) +      ); +    } +  } + +  groupCollapsed(title, ...rest) { +    this._groupDepth++; + +    if (title || rest.length > 0) { +      this._log( +        'groupCollapsed', +        _chalk().default.bold((0, _util().format)(title, ...rest)) +      ); +    } +  } + +  groupEnd() { +    if (this._groupDepth > 0) { +      this._groupDepth--; +    } +  } + +  info(firstArg, ...rest) { +    this._log('info', (0, _util().format)(firstArg, ...rest)); +  } + +  log(firstArg, ...rest) { +    this._log('log', (0, _util().format)(firstArg, ...rest)); +  } + +  time(label = 'default') { +    if (this._timers[label]) { +      return; +    } + +    this._timers[label] = new Date(); +  } + +  timeEnd(label = 'default') { +    const startTime = this._timers[label]; + +    if (startTime) { +      const endTime = new Date(); +      const time = endTime.getTime() - startTime.getTime(); + +      this._log( +        'time', +        (0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`) +      ); + +      delete this._timers[label]; +    } +  } + +  timeLog(label = 'default', ...data) { +    const startTime = this._timers[label]; + +    if (startTime) { +      const endTime = new Date(); +      const time = endTime.getTime() - startTime.getTime(); + +      this._log( +        'time', +        (0, _util().format)( +          `${label}: ${(0, _jestUtil().formatTime)(time)}`, +          ...data +        ) +      ); +    } +  } + +  warn(firstArg, ...rest) { +    this._log('warn', (0, _util().format)(firstArg, ...rest)); +  } + +  getBuffer() { +    return this._buffer.length ? this._buffer : undefined; +  } +} + +exports.default = BufferedConsole; + +function invariant(condition, message) { +  if (!condition) { +    throw new Error(message); +  } +} diff --git a/node_modules/@jest/console/build/CustomConsole.d.ts b/node_modules/@jest/console/build/CustomConsole.d.ts new file mode 100644 index 0000000..ebffa5d --- /dev/null +++ b/node_modules/@jest/console/build/CustomConsole.d.ts @@ -0,0 +1,41 @@ +/** + * 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 { Console } from 'console'; +import { InspectOptions } from 'util'; +import type { LogMessage, LogType } from './types'; +declare type Formatter = (type: LogType, message: LogMessage) => string; +export default class CustomConsole extends Console { +    private _stdout; +    private _stderr; +    private _formatBuffer; +    private _counters; +    private _timers; +    private _groupDepth; +    Console: typeof Console; +    constructor(stdout: NodeJS.WriteStream, stderr: NodeJS.WriteStream, formatBuffer?: Formatter); +    private _log; +    private _logError; +    assert(value: unknown, message?: string | Error): asserts value; +    count(label?: string): void; +    countReset(label?: string): void; +    debug(firstArg: unknown, ...args: Array<unknown>): void; +    dir(firstArg: unknown, options?: InspectOptions): void; +    dirxml(firstArg: unknown, ...args: Array<unknown>): void; +    error(firstArg: unknown, ...args: Array<unknown>): void; +    group(title?: string, ...args: Array<unknown>): void; +    groupCollapsed(title?: string, ...args: Array<unknown>): void; +    groupEnd(): void; +    info(firstArg: unknown, ...args: Array<unknown>): void; +    log(firstArg: unknown, ...args: Array<unknown>): void; +    time(label?: string): void; +    timeEnd(label?: string): void; +    timeLog(label?: string, ...data: Array<unknown>): void; +    warn(firstArg: unknown, ...args: Array<unknown>): void; +    getBuffer(): undefined; +} +export {}; diff --git a/node_modules/@jest/console/build/CustomConsole.js b/node_modules/@jest/console/build/CustomConsole.js new file mode 100644 index 0000000..25ab7be --- /dev/null +++ b/node_modules/@jest/console/build/CustomConsole.js @@ -0,0 +1,240 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _assert() { +  const data = _interopRequireDefault(require('assert')); + +  _assert = function () { +    return data; +  }; + +  return data; +} + +function _console() { +  const data = require('console'); + +  _console = function () { +    return data; +  }; + +  return data; +} + +function _util() { +  const data = require('util'); + +  _util = function () { +    return data; +  }; + +  return data; +} + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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 CustomConsole extends _console().Console { +  constructor(stdout, stderr, formatBuffer = (_type, message) => message) { +    super(stdout, stderr); + +    _defineProperty(this, '_stdout', void 0); + +    _defineProperty(this, '_stderr', void 0); + +    _defineProperty(this, '_formatBuffer', void 0); + +    _defineProperty(this, '_counters', {}); + +    _defineProperty(this, '_timers', {}); + +    _defineProperty(this, '_groupDepth', 0); + +    _defineProperty(this, 'Console', _console().Console); + +    this._stdout = stdout; +    this._stderr = stderr; +    this._formatBuffer = formatBuffer; +  } + +  _log(type, message) { +    (0, _jestUtil().clearLine)(this._stdout); +    super.log( +      this._formatBuffer(type, '  '.repeat(this._groupDepth) + message) +    ); +  } + +  _logError(type, message) { +    (0, _jestUtil().clearLine)(this._stderr); +    super.error( +      this._formatBuffer(type, '  '.repeat(this._groupDepth) + message) +    ); +  } + +  assert(value, message) { +    try { +      (0, _assert().default)(value, message); +    } catch (error) { +      this._logError('assert', error.toString()); +    } +  } + +  count(label = 'default') { +    if (!this._counters[label]) { +      this._counters[label] = 0; +    } + +    this._log( +      'count', +      (0, _util().format)(`${label}: ${++this._counters[label]}`) +    ); +  } + +  countReset(label = 'default') { +    this._counters[label] = 0; +  } + +  debug(firstArg, ...args) { +    this._log('debug', (0, _util().format)(firstArg, ...args)); +  } + +  dir(firstArg, options = {}) { +    const representation = (0, _util().inspect)(firstArg, options); + +    this._log('dir', (0, _util().formatWithOptions)(options, representation)); +  } + +  dirxml(firstArg, ...args) { +    this._log('dirxml', (0, _util().format)(firstArg, ...args)); +  } + +  error(firstArg, ...args) { +    this._logError('error', (0, _util().format)(firstArg, ...args)); +  } + +  group(title, ...args) { +    this._groupDepth++; + +    if (title || args.length > 0) { +      this._log( +        'group', +        _chalk().default.bold((0, _util().format)(title, ...args)) +      ); +    } +  } + +  groupCollapsed(title, ...args) { +    this._groupDepth++; + +    if (title || args.length > 0) { +      this._log( +        'groupCollapsed', +        _chalk().default.bold((0, _util().format)(title, ...args)) +      ); +    } +  } + +  groupEnd() { +    if (this._groupDepth > 0) { +      this._groupDepth--; +    } +  } + +  info(firstArg, ...args) { +    this._log('info', (0, _util().format)(firstArg, ...args)); +  } + +  log(firstArg, ...args) { +    this._log('log', (0, _util().format)(firstArg, ...args)); +  } + +  time(label = 'default') { +    if (this._timers[label]) { +      return; +    } + +    this._timers[label] = new Date(); +  } + +  timeEnd(label = 'default') { +    const startTime = this._timers[label]; + +    if (startTime) { +      const endTime = new Date().getTime(); +      const time = endTime - startTime.getTime(); + +      this._log( +        'time', +        (0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`) +      ); + +      delete this._timers[label]; +    } +  } + +  timeLog(label = 'default', ...data) { +    const startTime = this._timers[label]; + +    if (startTime) { +      const endTime = new Date(); +      const time = endTime.getTime() - startTime.getTime(); + +      this._log( +        'time', +        (0, _util().format)( +          `${label}: ${(0, _jestUtil().formatTime)(time)}`, +          ...data +        ) +      ); +    } +  } + +  warn(firstArg, ...args) { +    this._logError('warn', (0, _util().format)(firstArg, ...args)); +  } + +  getBuffer() { +    return undefined; +  } +} + +exports.default = CustomConsole; diff --git a/node_modules/@jest/console/build/NullConsole.d.ts b/node_modules/@jest/console/build/NullConsole.d.ts new file mode 100644 index 0000000..d39fc1c --- /dev/null +++ b/node_modules/@jest/console/build/NullConsole.d.ts @@ -0,0 +1,23 @@ +/** + * 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 CustomConsole from './CustomConsole'; +export default class NullConsole extends CustomConsole { +    assert(): void; +    debug(): void; +    dir(): void; +    error(): void; +    info(): void; +    log(): void; +    time(): void; +    timeEnd(): void; +    timeLog(): void; +    trace(): void; +    warn(): void; +    group(): void; +    groupCollapsed(): void; +    groupEnd(): void; +} diff --git a/node_modules/@jest/console/build/NullConsole.js b/node_modules/@jest/console/build/NullConsole.js new file mode 100644 index 0000000..745e35f --- /dev/null +++ b/node_modules/@jest/console/build/NullConsole.js @@ -0,0 +1,50 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +var _CustomConsole = _interopRequireDefault(require('./CustomConsole')); + +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. + */ +class NullConsole extends _CustomConsole.default { +  assert() {} + +  debug() {} + +  dir() {} + +  error() {} + +  info() {} + +  log() {} + +  time() {} + +  timeEnd() {} + +  timeLog() {} + +  trace() {} + +  warn() {} + +  group() {} + +  groupCollapsed() {} + +  groupEnd() {} +} + +exports.default = NullConsole; diff --git a/node_modules/@jest/console/build/getConsoleOutput.d.ts b/node_modules/@jest/console/build/getConsoleOutput.d.ts new file mode 100644 index 0000000..a47550d --- /dev/null +++ b/node_modules/@jest/console/build/getConsoleOutput.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 type { Config } from '@jest/types'; +import { StackTraceConfig } from 'jest-message-util'; +import type { ConsoleBuffer } from './types'; +export default function getConsoleOutput(buffer: ConsoleBuffer, config: StackTraceConfig, globalConfig: Config.GlobalConfig): string; diff --git a/node_modules/@jest/console/build/getConsoleOutput.js b/node_modules/@jest/console/build/getConsoleOutput.js new file mode 100644 index 0000000..18eb354 --- /dev/null +++ b/node_modules/@jest/console/build/getConsoleOutput.js @@ -0,0 +1,101 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getConsoleOutput; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestMessageUtil() { +  const data = require('jest-message-util'); + +  _jestMessageUtil = function () { +    return data; +  }; + +  return data; +} + +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. + */ +function getConsoleOutput(buffer, config, globalConfig) { +  const TITLE_INDENT = globalConfig.verbose ? '  ' : '    '; +  const CONSOLE_INDENT = TITLE_INDENT + '  '; +  const logEntries = buffer.reduce((output, {type, message, origin}) => { +    message = message +      .split(/\n/) +      .map(line => CONSOLE_INDENT + line) +      .join('\n'); +    let typeMessage = 'console.' + type; +    let noStackTrace = true; +    let noCodeFrame = true; + +    if (type === 'warn') { +      var _globalConfig$noStack; + +      message = _chalk().default.yellow(message); +      typeMessage = _chalk().default.yellow(typeMessage); +      noStackTrace = +        (_globalConfig$noStack = +          globalConfig === null || globalConfig === void 0 +            ? void 0 +            : globalConfig.noStackTrace) !== null && +        _globalConfig$noStack !== void 0 +          ? _globalConfig$noStack +          : false; +      noCodeFrame = false; +    } else if (type === 'error') { +      var _globalConfig$noStack2; + +      message = _chalk().default.red(message); +      typeMessage = _chalk().default.red(typeMessage); +      noStackTrace = +        (_globalConfig$noStack2 = +          globalConfig === null || globalConfig === void 0 +            ? void 0 +            : globalConfig.noStackTrace) !== null && +        _globalConfig$noStack2 !== void 0 +          ? _globalConfig$noStack2 +          : false; +      noCodeFrame = false; +    } + +    const options = { +      noCodeFrame, +      noStackTrace +    }; +    const formattedStackTrace = (0, _jestMessageUtil().formatStackTrace)( +      origin, +      config, +      options +    ); +    return ( +      output + +      TITLE_INDENT + +      _chalk().default.dim(typeMessage) + +      '\n' + +      message.trimRight() + +      '\n' + +      _chalk().default.dim(formattedStackTrace.trimRight()) + +      '\n\n' +    ); +  }, ''); +  return logEntries.trimRight() + '\n'; +} diff --git a/node_modules/@jest/console/build/index.d.ts b/node_modules/@jest/console/build/index.d.ts new file mode 100644 index 0000000..e5e568c --- /dev/null +++ b/node_modules/@jest/console/build/index.d.ts @@ -0,0 +1,11 @@ +/** + * 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 as BufferedConsole } from './BufferedConsole'; +export { default as CustomConsole } from './CustomConsole'; +export { default as NullConsole } from './NullConsole'; +export { default as getConsoleOutput } from './getConsoleOutput'; +export type { ConsoleBuffer, LogMessage, LogType, LogEntry } from './types'; diff --git a/node_modules/@jest/console/build/index.js b/node_modules/@jest/console/build/index.js new file mode 100644 index 0000000..88f6cb4 --- /dev/null +++ b/node_modules/@jest/console/build/index.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +Object.defineProperty(exports, 'BufferedConsole', { +  enumerable: true, +  get: function () { +    return _BufferedConsole.default; +  } +}); +Object.defineProperty(exports, 'CustomConsole', { +  enumerable: true, +  get: function () { +    return _CustomConsole.default; +  } +}); +Object.defineProperty(exports, 'NullConsole', { +  enumerable: true, +  get: function () { +    return _NullConsole.default; +  } +}); +Object.defineProperty(exports, 'getConsoleOutput', { +  enumerable: true, +  get: function () { +    return _getConsoleOutput.default; +  } +}); + +var _BufferedConsole = _interopRequireDefault(require('./BufferedConsole')); + +var _CustomConsole = _interopRequireDefault(require('./CustomConsole')); + +var _NullConsole = _interopRequireDefault(require('./NullConsole')); + +var _getConsoleOutput = _interopRequireDefault(require('./getConsoleOutput')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/console/build/types.d.ts b/node_modules/@jest/console/build/types.d.ts new file mode 100644 index 0000000..8490c67 --- /dev/null +++ b/node_modules/@jest/console/build/types.d.ts @@ -0,0 +1,20 @@ +/** + * 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 LogMessage = string; +export declare type LogEntry = { +    message: LogMessage; +    origin: string; +    type: LogType; +}; +export declare type LogCounters = { +    [label: string]: number; +}; +export declare type LogTimers = { +    [label: string]: Date; +}; +export declare type LogType = 'assert' | 'count' | 'debug' | 'dir' | 'dirxml' | 'error' | 'group' | 'groupCollapsed' | 'info' | 'log' | 'time' | 'warn'; +export declare type ConsoleBuffer = Array<LogEntry>; diff --git a/node_modules/@jest/console/build/types.js b/node_modules/@jest/console/build/types.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/console/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/console/package.json b/node_modules/@jest/console/package.json new file mode 100644 index 0000000..221ca1e --- /dev/null +++ b/node_modules/@jest/console/package.json @@ -0,0 +1,38 @@ +{ +  "name": "@jest/console", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-console" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@jest/types": "^27.5.1", +    "@types/node": "*", +    "chalk": "^4.0.0", +    "jest-message-util": "^27.5.1", +    "jest-util": "^27.5.1", +    "slash": "^3.0.0" +  }, +  "devDependencies": { +    "@jest/test-utils": "^27.5.1", +    "@types/node": "*" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/core/LICENSE b/node_modules/@jest/core/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/core/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/core/README.md b/node_modules/@jest/core/README.md new file mode 100644 index 0000000..e5852b6 --- /dev/null +++ b/node_modules/@jest/core/README.md @@ -0,0 +1,3 @@ +# @jest/core + +Jest is currently working on providing a programmatic API. This is under development, and usage of this package directly is currently not supported. diff --git a/node_modules/@jest/core/build/FailedTestsCache.d.ts b/node_modules/@jest/core/build/FailedTestsCache.d.ts new file mode 100644 index 0000000..565af37 --- /dev/null +++ b/node_modules/@jest/core/build/FailedTestsCache.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 { Test, TestResult } from '@jest/test-result'; +export default class FailedTestsCache { +    private _enabledTestsMap?; +    filterTests(tests: Array<Test>): Array<Test>; +    setTestResults(testResults: Array<TestResult>): void; +} diff --git a/node_modules/@jest/core/build/FailedTestsCache.js b/node_modules/@jest/core/build/FailedTestsCache.js new file mode 100644 index 0000000..389e8b8 --- /dev/null +++ b/node_modules/@jest/core/build/FailedTestsCache.js @@ -0,0 +1,59 @@ +'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. + */ +class FailedTestsCache { +  constructor() { +    _defineProperty(this, '_enabledTestsMap', void 0); +  } + +  filterTests(tests) { +    const enabledTestsMap = this._enabledTestsMap; + +    if (!enabledTestsMap) { +      return tests; +    } + +    return tests.filter(testResult => enabledTestsMap[testResult.path]); +  } + +  setTestResults(testResults) { +    this._enabledTestsMap = (testResults || []) +      .filter(testResult => testResult.numFailingTests) +      .reduce((suiteMap, testResult) => { +        suiteMap[testResult.testFilePath] = testResult.testResults +          .filter(test => test.status === 'failed') +          .reduce((testMap, test) => { +            testMap[test.fullName] = true; +            return testMap; +          }, {}); +        return suiteMap; +      }, {}); +    this._enabledTestsMap = Object.freeze(this._enabledTestsMap); +  } +} + +exports.default = FailedTestsCache; diff --git a/node_modules/@jest/core/build/FailedTestsInteractiveMode.d.ts b/node_modules/@jest/core/build/FailedTestsInteractiveMode.d.ts new file mode 100644 index 0000000..c543c69 --- /dev/null +++ b/node_modules/@jest/core/build/FailedTestsInteractiveMode.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. + */ +/// <reference types="node" /> +import type { AggregatedResult, AssertionLocation } from '@jest/test-result'; +declare type RunnerUpdateFunction = (failure?: AssertionLocation) => void; +export default class FailedTestsInteractiveMode { +    private _pipe; +    private _isActive; +    private _countPaths; +    private _skippedNum; +    private _testAssertions; +    private _updateTestRunnerConfig?; +    constructor(_pipe: NodeJS.WritableStream); +    isActive(): boolean; +    put(key: string): void; +    run(failedTestAssertions: Array<AssertionLocation>, updateConfig: RunnerUpdateFunction): void; +    updateWithResults(results: AggregatedResult): void; +    private _clearTestSummary; +    private _drawUIDone; +    private _drawUIDoneWithSkipped; +    private _drawUIProgress; +    private _drawUIOverlay; +    private _run; +    private abort; +    private restart; +} +export {}; diff --git a/node_modules/@jest/core/build/FailedTestsInteractiveMode.js b/node_modules/@jest/core/build/FailedTestsInteractiveMode.js new file mode 100644 index 0000000..e9e6534 --- /dev/null +++ b/node_modules/@jest/core/build/FailedTestsInteractiveMode.js @@ -0,0 +1,262 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _ansiEscapes() { +  const data = _interopRequireDefault(require('ansi-escapes')); + +  _ansiEscapes = function () { +    return data; +  }; + +  return data; +} + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +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 {ARROW, CLEAR} = _jestUtil().specialChars; + +function describeKey(key, description) { +  return `${_chalk().default.dim( +    ARROW + 'Press' +  )} ${key} ${_chalk().default.dim(description)}`; +} + +const TestProgressLabel = _chalk().default.bold('Interactive Test Progress'); + +class FailedTestsInteractiveMode { +  constructor(_pipe) { +    _defineProperty(this, '_isActive', false); + +    _defineProperty(this, '_countPaths', 0); + +    _defineProperty(this, '_skippedNum', 0); + +    _defineProperty(this, '_testAssertions', []); + +    _defineProperty(this, '_updateTestRunnerConfig', void 0); + +    this._pipe = _pipe; +  } + +  isActive() { +    return this._isActive; +  } + +  put(key) { +    switch (key) { +      case 's': +        if (this._skippedNum === this._testAssertions.length) { +          break; +        } + +        this._skippedNum += 1; // move skipped test to the end + +        this._testAssertions.push(this._testAssertions.shift()); + +        if (this._testAssertions.length - this._skippedNum > 0) { +          this._run(); +        } else { +          this._drawUIDoneWithSkipped(); +        } + +        break; + +      case 'q': +      case _jestWatcher().KEYS.ESCAPE: +        this.abort(); +        break; + +      case 'r': +        this.restart(); +        break; + +      case _jestWatcher().KEYS.ENTER: +        if (this._testAssertions.length === 0) { +          this.abort(); +        } else { +          this._run(); +        } + +        break; + +      default: +    } +  } + +  run(failedTestAssertions, updateConfig) { +    if (failedTestAssertions.length === 0) return; +    this._testAssertions = [...failedTestAssertions]; +    this._countPaths = this._testAssertions.length; +    this._updateTestRunnerConfig = updateConfig; +    this._isActive = true; + +    this._run(); +  } + +  updateWithResults(results) { +    if (!results.snapshot.failure && results.numFailedTests > 0) { +      return this._drawUIOverlay(); +    } + +    this._testAssertions.shift(); + +    if (this._testAssertions.length === 0) { +      return this._drawUIOverlay(); +    } // Go to the next test + +    return this._run(); +  } + +  _clearTestSummary() { +    this._pipe.write(_ansiEscapes().default.cursorUp(6)); + +    this._pipe.write(_ansiEscapes().default.eraseDown); +  } + +  _drawUIDone() { +    this._pipe.write(CLEAR); + +    const messages = [ +      _chalk().default.bold('Watch Usage'), +      describeKey('Enter', 'to return to watch mode.') +    ]; + +    this._pipe.write(messages.join('\n') + '\n'); +  } + +  _drawUIDoneWithSkipped() { +    this._pipe.write(CLEAR); + +    let stats = `${(0, _jestUtil().pluralize)( +      'test', +      this._countPaths +    )} reviewed`; + +    if (this._skippedNum > 0) { +      const skippedText = _chalk().default.bold.yellow( +        (0, _jestUtil().pluralize)('test', this._skippedNum) + ' skipped' +      ); + +      stats = `${stats}, ${skippedText}`; +    } + +    const message = [ +      TestProgressLabel, +      `${ARROW}${stats}`, +      '\n', +      _chalk().default.bold('Watch Usage'), +      describeKey('r', 'to restart Interactive Mode.'), +      describeKey('q', 'to quit Interactive Mode.'), +      describeKey('Enter', 'to return to watch mode.') +    ]; + +    this._pipe.write(`\n${message.join('\n')}`); +  } + +  _drawUIProgress() { +    this._clearTestSummary(); + +    const numPass = this._countPaths - this._testAssertions.length; +    const numRemaining = this._countPaths - numPass - this._skippedNum; +    let stats = `${(0, _jestUtil().pluralize)('test', numRemaining)} remaining`; + +    if (this._skippedNum > 0) { +      const skippedText = _chalk().default.bold.yellow( +        (0, _jestUtil().pluralize)('test', this._skippedNum) + ' skipped' +      ); + +      stats = `${stats}, ${skippedText}`; +    } + +    const message = [ +      TestProgressLabel, +      `${ARROW}${stats}`, +      '\n', +      _chalk().default.bold('Watch Usage'), +      describeKey('s', 'to skip the current test.'), +      describeKey('q', 'to quit Interactive Mode.'), +      describeKey('Enter', 'to return to watch mode.') +    ]; + +    this._pipe.write(`\n${message.join('\n')}`); +  } + +  _drawUIOverlay() { +    if (this._testAssertions.length === 0) return this._drawUIDone(); +    return this._drawUIProgress(); +  } + +  _run() { +    if (this._updateTestRunnerConfig) { +      this._updateTestRunnerConfig(this._testAssertions[0]); +    } +  } + +  abort() { +    this._isActive = false; +    this._skippedNum = 0; + +    if (this._updateTestRunnerConfig) { +      this._updateTestRunnerConfig(); +    } +  } + +  restart() { +    this._skippedNum = 0; +    this._countPaths = this._testAssertions.length; + +    this._run(); +  } +} + +exports.default = FailedTestsInteractiveMode; diff --git a/node_modules/@jest/core/build/ReporterDispatcher.d.ts b/node_modules/@jest/core/build/ReporterDispatcher.d.ts new file mode 100644 index 0000000..ed34a0e --- /dev/null +++ b/node_modules/@jest/core/build/ReporterDispatcher.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, ReporterOnStartOptions } from '@jest/reporters'; +import type { AggregatedResult, Test, TestCaseResult, TestResult } from '@jest/test-result'; +import type { Context } from 'jest-runtime'; +export default class ReporterDispatcher { +    private _reporters; +    constructor(); +    register(reporter: Reporter): void; +    unregister(ReporterClass: Function): void; +    onTestFileResult(test: Test, testResult: TestResult, results: AggregatedResult): Promise<void>; +    onTestFileStart(test: Test): Promise<void>; +    onRunStart(results: AggregatedResult, options: ReporterOnStartOptions): Promise<void>; +    onTestCaseResult(test: Test, testCaseResult: TestCaseResult): Promise<void>; +    onRunComplete(contexts: Set<Context>, results: AggregatedResult): Promise<void>; +    getErrors(): Array<Error>; +    hasErrors(): boolean; +} diff --git a/node_modules/@jest/core/build/ReporterDispatcher.js b/node_modules/@jest/core/build/ReporterDispatcher.js new file mode 100644 index 0000000..efd6af0 --- /dev/null +++ b/node_modules/@jest/core/build/ReporterDispatcher.js @@ -0,0 +1,104 @@ +'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. + */ + +/* eslint-disable local/ban-types-eventually */ +class ReporterDispatcher { +  constructor() { +    _defineProperty(this, '_reporters', void 0); + +    this._reporters = []; +  } + +  register(reporter) { +    this._reporters.push(reporter); +  } + +  unregister(ReporterClass) { +    this._reporters = this._reporters.filter( +      reporter => !(reporter instanceof ReporterClass) +    ); +  } + +  async onTestFileResult(test, testResult, results) { +    for (const reporter of this._reporters) { +      if (reporter.onTestFileResult) { +        await reporter.onTestFileResult(test, testResult, results); +      } else if (reporter.onTestResult) { +        await reporter.onTestResult(test, testResult, results); +      } +    } // Release memory if unused later. + +    testResult.coverage = undefined; +    testResult.console = undefined; +  } + +  async onTestFileStart(test) { +    for (const reporter of this._reporters) { +      if (reporter.onTestFileStart) { +        await reporter.onTestFileStart(test); +      } else if (reporter.onTestStart) { +        await reporter.onTestStart(test); +      } +    } +  } + +  async onRunStart(results, options) { +    for (const reporter of this._reporters) { +      reporter.onRunStart && (await reporter.onRunStart(results, options)); +    } +  } + +  async onTestCaseResult(test, testCaseResult) { +    for (const reporter of this._reporters) { +      if (reporter.onTestCaseResult) { +        await reporter.onTestCaseResult(test, testCaseResult); +      } +    } +  } + +  async onRunComplete(contexts, results) { +    for (const reporter of this._reporters) { +      if (reporter.onRunComplete) { +        await reporter.onRunComplete(contexts, results); +      } +    } +  } // Return a list of last errors for every reporter + +  getErrors() { +    return this._reporters.reduce((list, reporter) => { +      const error = reporter.getLastError && reporter.getLastError(); +      return error ? list.concat(error) : list; +    }, []); +  } + +  hasErrors() { +    return this.getErrors().length !== 0; +  } +} + +exports.default = ReporterDispatcher; diff --git a/node_modules/@jest/core/build/SearchSource.d.ts b/node_modules/@jest/core/build/SearchSource.d.ts new file mode 100644 index 0000000..43c8e82 --- /dev/null +++ b/node_modules/@jest/core/build/SearchSource.d.ts @@ -0,0 +1,46 @@ +/** + * 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 { Test } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type { ChangedFiles } from 'jest-changed-files'; +import type { Context } from 'jest-runtime'; +import type { Filter, Stats } from './types'; +export declare type SearchResult = { +    noSCM?: boolean; +    stats?: Stats; +    collectCoverageFrom?: Set<string>; +    tests: Array<Test>; +    total?: number; +}; +export declare type TestSelectionConfig = { +    input?: string; +    findRelatedTests?: boolean; +    onlyChanged?: boolean; +    paths?: Array<Config.Path>; +    shouldTreatInputAsPattern?: boolean; +    testPathPattern?: string; +    watch?: boolean; +}; +export default class SearchSource { +    private _context; +    private _dependencyResolver; +    private _testPathCases; +    constructor(context: Context); +    private _getOrBuildDependencyResolver; +    private _filterTestPathsWithStats; +    private _getAllTestPaths; +    isTestFilePath(path: Config.Path): boolean; +    findMatchingTests(testPathPattern?: string): SearchResult; +    findRelatedTests(allPaths: Set<Config.Path>, collectCoverage: boolean): Promise<SearchResult>; +    findTestsByPaths(paths: Array<Config.Path>): SearchResult; +    findRelatedTestsFromPattern(paths: Array<Config.Path>, collectCoverage: boolean): Promise<SearchResult>; +    findTestRelatedToChangedFiles(changedFilesInfo: ChangedFiles, collectCoverage: boolean): Promise<SearchResult>; +    private _getTestPaths; +    filterPathsWin32(paths: Array<string>): Array<string>; +    getTestPaths(globalConfig: Config.GlobalConfig, changedFiles: ChangedFiles | undefined, filter?: Filter): Promise<SearchResult>; +    findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo: ChangedFiles): Promise<Array<string>>; +} diff --git a/node_modules/@jest/core/build/SearchSource.js b/node_modules/@jest/core/build/SearchSource.js new file mode 100644 index 0000000..927f59d --- /dev/null +++ b/node_modules/@jest/core/build/SearchSource.js @@ -0,0 +1,490 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function os() { +  const data = _interopRequireWildcard(require('os')); + +  os = function () { +    return data; +  }; + +  return data; +} + +function path() { +  const data = _interopRequireWildcard(require('path')); + +  path = function () { +    return data; +  }; + +  return data; +} + +function _micromatch() { +  const data = _interopRequireDefault(require('micromatch')); + +  _micromatch = function () { +    return data; +  }; + +  return data; +} + +function _jestConfig() { +  const data = require('jest-config'); + +  _jestConfig = function () { +    return data; +  }; + +  return data; +} + +function _jestRegexUtil() { +  const data = require('jest-regex-util'); + +  _jestRegexUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestResolveDependencies() { +  const data = require('jest-resolve-dependencies'); + +  _jestResolveDependencies = function () { +    return data; +  }; + +  return data; +} + +function _jestSnapshot() { +  const data = require('jest-snapshot'); + +  _jestSnapshot = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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; +} + +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 regexToMatcher = testRegex => { +  const regexes = testRegex.map(testRegex => new RegExp(testRegex)); +  return path => +    regexes.some(regex => { +      const result = regex.test(path); // prevent stateful regexes from breaking, just in case + +      regex.lastIndex = 0; +      return result; +    }); +}; + +const toTests = (context, tests) => +  tests.map(path => ({ +    context, +    duration: undefined, +    path +  })); + +const hasSCM = changedFilesInfo => { +  const {repos} = changedFilesInfo; // no SCM (git/hg/...) is found in any of the roots. + +  const noSCM = Object.values(repos).every(scm => scm.size === 0); +  return !noSCM; +}; + +class SearchSource { +  constructor(context) { +    _defineProperty(this, '_context', void 0); + +    _defineProperty(this, '_dependencyResolver', void 0); + +    _defineProperty(this, '_testPathCases', []); + +    const {config} = context; +    this._context = context; +    this._dependencyResolver = null; +    const rootPattern = new RegExp( +      config.roots +        .map(dir => (0, _jestRegexUtil().escapePathForRegex)(dir + path().sep)) +        .join('|') +    ); + +    this._testPathCases.push({ +      isMatch: path => rootPattern.test(path), +      stat: 'roots' +    }); + +    if (config.testMatch.length) { +      this._testPathCases.push({ +        isMatch: (0, _jestUtil().globsToMatcher)(config.testMatch), +        stat: 'testMatch' +      }); +    } + +    if (config.testPathIgnorePatterns.length) { +      const testIgnorePatternsRegex = new RegExp( +        config.testPathIgnorePatterns.join('|') +      ); + +      this._testPathCases.push({ +        isMatch: path => !testIgnorePatternsRegex.test(path), +        stat: 'testPathIgnorePatterns' +      }); +    } + +    if (config.testRegex.length) { +      this._testPathCases.push({ +        isMatch: regexToMatcher(config.testRegex), +        stat: 'testRegex' +      }); +    } +  } + +  async _getOrBuildDependencyResolver() { +    if (!this._dependencyResolver) { +      this._dependencyResolver = +        new (_jestResolveDependencies().DependencyResolver)( +          this._context.resolver, +          this._context.hasteFS, +          await (0, _jestSnapshot().buildSnapshotResolver)(this._context.config) +        ); +    } + +    return this._dependencyResolver; +  } + +  _filterTestPathsWithStats(allPaths, testPathPattern) { +    const data = { +      stats: { +        roots: 0, +        testMatch: 0, +        testPathIgnorePatterns: 0, +        testRegex: 0 +      }, +      tests: [], +      total: allPaths.length +    }; +    const testCases = Array.from(this._testPathCases); // clone + +    if (testPathPattern) { +      const regex = (0, _jestUtil().testPathPatternToRegExp)(testPathPattern); +      testCases.push({ +        isMatch: path => regex.test(path), +        stat: 'testPathPattern' +      }); +      data.stats.testPathPattern = 0; +    } + +    data.tests = allPaths.filter(test => { +      let filterResult = true; + +      for (const {isMatch, stat} of testCases) { +        if (isMatch(test.path)) { +          data.stats[stat]++; +        } else { +          filterResult = false; +        } +      } + +      return filterResult; +    }); +    return data; +  } + +  _getAllTestPaths(testPathPattern) { +    return this._filterTestPathsWithStats( +      toTests(this._context, this._context.hasteFS.getAllFiles()), +      testPathPattern +    ); +  } + +  isTestFilePath(path) { +    return this._testPathCases.every(testCase => testCase.isMatch(path)); +  } + +  findMatchingTests(testPathPattern) { +    return this._getAllTestPaths(testPathPattern); +  } + +  async findRelatedTests(allPaths, collectCoverage) { +    const dependencyResolver = await this._getOrBuildDependencyResolver(); + +    if (!collectCoverage) { +      return { +        tests: toTests( +          this._context, +          dependencyResolver.resolveInverse( +            allPaths, +            this.isTestFilePath.bind(this), +            { +              skipNodeResolution: this._context.config.skipNodeResolution +            } +          ) +        ) +      }; +    } + +    const testModulesMap = dependencyResolver.resolveInverseModuleMap( +      allPaths, +      this.isTestFilePath.bind(this), +      { +        skipNodeResolution: this._context.config.skipNodeResolution +      } +    ); +    const allPathsAbsolute = Array.from(allPaths).map(p => path().resolve(p)); +    const collectCoverageFrom = new Set(); +    testModulesMap.forEach(testModule => { +      if (!testModule.dependencies) { +        return; +      } + +      testModule.dependencies.forEach(p => { +        if (!allPathsAbsolute.includes(p)) { +          return; +        } + +        const filename = (0, _jestConfig().replaceRootDirInPath)( +          this._context.config.rootDir, +          p +        ); +        collectCoverageFrom.add( +          path().isAbsolute(filename) +            ? path().relative(this._context.config.rootDir, filename) +            : filename +        ); +      }); +    }); +    return { +      collectCoverageFrom, +      tests: toTests( +        this._context, +        testModulesMap.map(testModule => testModule.file) +      ) +    }; +  } + +  findTestsByPaths(paths) { +    return { +      tests: toTests( +        this._context, +        paths +          .map(p => path().resolve(this._context.config.cwd, p)) +          .filter(this.isTestFilePath.bind(this)) +      ) +    }; +  } + +  async findRelatedTestsFromPattern(paths, collectCoverage) { +    if (Array.isArray(paths) && paths.length) { +      const resolvedPaths = paths.map(p => +        path().resolve(this._context.config.cwd, p) +      ); +      return this.findRelatedTests(new Set(resolvedPaths), collectCoverage); +    } + +    return { +      tests: [] +    }; +  } + +  async findTestRelatedToChangedFiles(changedFilesInfo, collectCoverage) { +    if (!hasSCM(changedFilesInfo)) { +      return { +        noSCM: true, +        tests: [] +      }; +    } + +    const {changedFiles} = changedFilesInfo; +    return this.findRelatedTests(changedFiles, collectCoverage); +  } + +  async _getTestPaths(globalConfig, changedFiles) { +    if (globalConfig.onlyChanged) { +      if (!changedFiles) { +        throw new Error('Changed files must be set when running with -o.'); +      } + +      return this.findTestRelatedToChangedFiles( +        changedFiles, +        globalConfig.collectCoverage +      ); +    } + +    let paths = globalConfig.nonFlagArgs; + +    if (globalConfig.findRelatedTests && 'win32' === os().platform()) { +      paths = this.filterPathsWin32(paths); +    } + +    if (globalConfig.runTestsByPath && paths && paths.length) { +      return this.findTestsByPaths(paths); +    } else if (globalConfig.findRelatedTests && paths && paths.length) { +      return this.findRelatedTestsFromPattern( +        paths, +        globalConfig.collectCoverage +      ); +    } else if (globalConfig.testPathPattern != null) { +      return this.findMatchingTests(globalConfig.testPathPattern); +    } else { +      return { +        tests: [] +      }; +    } +  } + +  filterPathsWin32(paths) { +    const allFiles = this._context.hasteFS.getAllFiles(); + +    const options = { +      nocase: true, +      windows: false +    }; + +    function normalizePosix(filePath) { +      return filePath.replace(/\\/g, '/'); +    } + +    paths = paths +      .map(p => { +        // micromatch works with forward slashes: https://github.com/micromatch/micromatch#backslashes +        const normalizedPath = normalizePosix( +          path().resolve(this._context.config.cwd, p) +        ); +        const match = (0, _micromatch().default)( +          allFiles.map(normalizePosix), +          normalizedPath, +          options +        ); +        return match[0]; +      }) +      .filter(Boolean) +      .map(p => path().resolve(p)); +    return paths; +  } + +  async getTestPaths(globalConfig, changedFiles, filter) { +    const searchResult = await this._getTestPaths(globalConfig, changedFiles); +    const filterPath = globalConfig.filter; + +    if (filter) { +      const tests = searchResult.tests; +      const filterResult = await filter(tests.map(test => test.path)); + +      if (!Array.isArray(filterResult.filtered)) { +        throw new Error( +          `Filter ${filterPath} did not return a valid test list` +        ); +      } + +      const filteredSet = new Set( +        filterResult.filtered.map(result => result.test) +      ); +      return { +        ...searchResult, +        tests: tests.filter(test => filteredSet.has(test.path)) +      }; +    } + +    return searchResult; +  } + +  async findRelatedSourcesFromTestsInChangedFiles(changedFilesInfo) { +    if (!hasSCM(changedFilesInfo)) { +      return []; +    } + +    const {changedFiles} = changedFilesInfo; +    const dependencyResolver = await this._getOrBuildDependencyResolver(); +    const relatedSourcesSet = new Set(); +    changedFiles.forEach(filePath => { +      if (this.isTestFilePath(filePath)) { +        const sourcePaths = dependencyResolver.resolve(filePath, { +          skipNodeResolution: this._context.config.skipNodeResolution +        }); +        sourcePaths.forEach(sourcePath => relatedSourcesSet.add(sourcePath)); +      } +    }); +    return Array.from(relatedSourcesSet); +  } +} + +exports.default = SearchSource; diff --git a/node_modules/@jest/core/build/SnapshotInteractiveMode.d.ts b/node_modules/@jest/core/build/SnapshotInteractiveMode.d.ts new file mode 100644 index 0000000..1198a50 --- /dev/null +++ b/node_modules/@jest/core/build/SnapshotInteractiveMode.d.ts @@ -0,0 +1,30 @@ +/** + * 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 { AggregatedResult, AssertionLocation } from '@jest/test-result'; +export default class SnapshotInteractiveMode { +    private _pipe; +    private _isActive; +    private _updateTestRunnerConfig; +    private _testAssertions; +    private _countPaths; +    private _skippedNum; +    constructor(pipe: NodeJS.WritableStream); +    isActive(): boolean; +    getSkippedNum(): number; +    private _clearTestSummary; +    private _drawUIProgress; +    private _drawUIDoneWithSkipped; +    private _drawUIDone; +    private _drawUIOverlay; +    put(key: string): void; +    abort(): void; +    restart(): void; +    updateWithResults(results: AggregatedResult): void; +    private _run; +    run(failedSnapshotTestAssertions: Array<AssertionLocation>, onConfigChange: (assertion: AssertionLocation | null, shouldUpdateSnapshot: boolean) => unknown): void; +} diff --git a/node_modules/@jest/core/build/SnapshotInteractiveMode.js b/node_modules/@jest/core/build/SnapshotInteractiveMode.js new file mode 100644 index 0000000..fac34db --- /dev/null +++ b/node_modules/@jest/core/build/SnapshotInteractiveMode.js @@ -0,0 +1,327 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _ansiEscapes() { +  const data = _interopRequireDefault(require('ansi-escapes')); + +  _ansiEscapes = function () { +    return data; +  }; + +  return data; +} + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +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 {ARROW, CLEAR} = _jestUtil().specialChars; + +class SnapshotInteractiveMode { +  constructor(pipe) { +    _defineProperty(this, '_pipe', void 0); + +    _defineProperty(this, '_isActive', void 0); + +    _defineProperty(this, '_updateTestRunnerConfig', void 0); + +    _defineProperty(this, '_testAssertions', void 0); + +    _defineProperty(this, '_countPaths', void 0); + +    _defineProperty(this, '_skippedNum', void 0); + +    this._pipe = pipe; +    this._isActive = false; +    this._skippedNum = 0; +  } + +  isActive() { +    return this._isActive; +  } + +  getSkippedNum() { +    return this._skippedNum; +  } + +  _clearTestSummary() { +    this._pipe.write(_ansiEscapes().default.cursorUp(6)); + +    this._pipe.write(_ansiEscapes().default.eraseDown); +  } + +  _drawUIProgress() { +    this._clearTestSummary(); + +    const numPass = this._countPaths - this._testAssertions.length; +    const numRemaining = this._countPaths - numPass - this._skippedNum; + +    let stats = _chalk().default.bold.dim( +      (0, _jestUtil().pluralize)('snapshot', numRemaining) + ' remaining' +    ); + +    if (numPass) { +      stats += +        ', ' + +        _chalk().default.bold.green( +          (0, _jestUtil().pluralize)('snapshot', numPass) + ' updated' +        ); +    } + +    if (this._skippedNum) { +      stats += +        ', ' + +        _chalk().default.bold.yellow( +          (0, _jestUtil().pluralize)('snapshot', this._skippedNum) + ' skipped' +        ); +    } + +    const messages = [ +      '\n' + _chalk().default.bold('Interactive Snapshot Progress'), +      ARROW + stats, +      '\n' + _chalk().default.bold('Watch Usage'), +      _chalk().default.dim(ARROW + 'Press ') + +        'u' + +        _chalk().default.dim(' to update failing snapshots for this test.'), +      _chalk().default.dim(ARROW + 'Press ') + +        's' + +        _chalk().default.dim(' to skip the current test.'), +      _chalk().default.dim(ARROW + 'Press ') + +        'q' + +        _chalk().default.dim(' to quit Interactive Snapshot Mode.'), +      _chalk().default.dim(ARROW + 'Press ') + +        'Enter' + +        _chalk().default.dim(' to trigger a test run.') +    ]; + +    this._pipe.write(messages.filter(Boolean).join('\n') + '\n'); +  } + +  _drawUIDoneWithSkipped() { +    this._pipe.write(CLEAR); + +    const numPass = this._countPaths - this._testAssertions.length; + +    let stats = _chalk().default.bold.dim( +      (0, _jestUtil().pluralize)('snapshot', this._countPaths) + ' reviewed' +    ); + +    if (numPass) { +      stats += +        ', ' + +        _chalk().default.bold.green( +          (0, _jestUtil().pluralize)('snapshot', numPass) + ' updated' +        ); +    } + +    if (this._skippedNum) { +      stats += +        ', ' + +        _chalk().default.bold.yellow( +          (0, _jestUtil().pluralize)('snapshot', this._skippedNum) + ' skipped' +        ); +    } + +    const messages = [ +      '\n' + _chalk().default.bold('Interactive Snapshot Result'), +      ARROW + stats, +      '\n' + _chalk().default.bold('Watch Usage'), +      _chalk().default.dim(ARROW + 'Press ') + +        'r' + +        _chalk().default.dim(' to restart Interactive Snapshot Mode.'), +      _chalk().default.dim(ARROW + 'Press ') + +        'q' + +        _chalk().default.dim(' to quit Interactive Snapshot Mode.') +    ]; + +    this._pipe.write(messages.filter(Boolean).join('\n') + '\n'); +  } + +  _drawUIDone() { +    this._pipe.write(CLEAR); + +    const numPass = this._countPaths - this._testAssertions.length; + +    let stats = _chalk().default.bold.dim( +      (0, _jestUtil().pluralize)('snapshot', this._countPaths) + ' reviewed' +    ); + +    if (numPass) { +      stats += +        ', ' + +        _chalk().default.bold.green( +          (0, _jestUtil().pluralize)('snapshot', numPass) + ' updated' +        ); +    } + +    const messages = [ +      '\n' + _chalk().default.bold('Interactive Snapshot Result'), +      ARROW + stats, +      '\n' + _chalk().default.bold('Watch Usage'), +      _chalk().default.dim(ARROW + 'Press ') + +        'Enter' + +        _chalk().default.dim(' to return to watch mode.') +    ]; + +    this._pipe.write(messages.filter(Boolean).join('\n') + '\n'); +  } + +  _drawUIOverlay() { +    if (this._testAssertions.length === 0) { +      return this._drawUIDone(); +    } + +    if (this._testAssertions.length - this._skippedNum === 0) { +      return this._drawUIDoneWithSkipped(); +    } + +    return this._drawUIProgress(); +  } + +  put(key) { +    switch (key) { +      case 's': +        if (this._skippedNum === this._testAssertions.length) break; +        this._skippedNum += 1; // move skipped test to the end + +        this._testAssertions.push(this._testAssertions.shift()); + +        if (this._testAssertions.length - this._skippedNum > 0) { +          this._run(false); +        } else { +          this._drawUIDoneWithSkipped(); +        } + +        break; + +      case 'u': +        this._run(true); + +        break; + +      case 'q': +      case _jestWatcher().KEYS.ESCAPE: +        this.abort(); +        break; + +      case 'r': +        this.restart(); +        break; + +      case _jestWatcher().KEYS.ENTER: +        if (this._testAssertions.length === 0) { +          this.abort(); +        } else { +          this._run(false); +        } + +        break; + +      default: +        break; +    } +  } + +  abort() { +    this._isActive = false; +    this._skippedNum = 0; + +    this._updateTestRunnerConfig(null, false); +  } + +  restart() { +    this._skippedNum = 0; +    this._countPaths = this._testAssertions.length; + +    this._run(false); +  } + +  updateWithResults(results) { +    const hasSnapshotFailure = !!results.snapshot.failure; + +    if (hasSnapshotFailure) { +      this._drawUIOverlay(); + +      return; +    } + +    this._testAssertions.shift(); + +    if (this._testAssertions.length - this._skippedNum === 0) { +      this._drawUIOverlay(); + +      return; +    } // Go to the next test + +    this._run(false); +  } + +  _run(shouldUpdateSnapshot) { +    const testAssertion = this._testAssertions[0]; + +    this._updateTestRunnerConfig(testAssertion, shouldUpdateSnapshot); +  } + +  run(failedSnapshotTestAssertions, onConfigChange) { +    if (!failedSnapshotTestAssertions.length) { +      return; +    } + +    this._testAssertions = [...failedSnapshotTestAssertions]; +    this._countPaths = this._testAssertions.length; +    this._updateTestRunnerConfig = onConfigChange; +    this._isActive = true; + +    this._run(false); +  } +} + +exports.default = SnapshotInteractiveMode; diff --git a/node_modules/@jest/core/build/TestNamePatternPrompt.d.ts b/node_modules/@jest/core/build/TestNamePatternPrompt.d.ts new file mode 100644 index 0000000..c3a187c --- /dev/null +++ b/node_modules/@jest/core/build/TestNamePatternPrompt.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. + */ +/// <reference types="node" /> +import type { TestResult } from '@jest/test-result'; +import { PatternPrompt, Prompt, ScrollOptions } from 'jest-watcher'; +export default class TestNamePatternPrompt extends PatternPrompt { +    _cachedTestResults: Array<TestResult>; +    constructor(pipe: NodeJS.WritableStream, prompt: Prompt); +    _onChange(pattern: string, options: ScrollOptions): void; +    _printPrompt(pattern: string): void; +    _getMatchedTests(pattern: string): Array<string>; +    updateCachedTestResults(testResults?: Array<TestResult>): void; +} diff --git a/node_modules/@jest/core/build/TestNamePatternPrompt.js b/node_modules/@jest/core/build/TestNamePatternPrompt.js new file mode 100644 index 0000000..4d9bb2b --- /dev/null +++ b/node_modules/@jest/core/build/TestNamePatternPrompt.js @@ -0,0 +1,86 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +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; +} + +// TODO: Make underscored props `private` +class TestNamePatternPrompt extends _jestWatcher().PatternPrompt { +  constructor(pipe, prompt) { +    super(pipe, prompt); + +    _defineProperty(this, '_cachedTestResults', void 0); + +    this._entityName = 'tests'; +    this._cachedTestResults = []; +  } + +  _onChange(pattern, options) { +    super._onChange(pattern, options); + +    this._printPrompt(pattern); +  } + +  _printPrompt(pattern) { +    const pipe = this._pipe; +    (0, _jestWatcher().printPatternCaret)(pattern, pipe); +    (0, _jestWatcher().printRestoredPatternCaret)( +      pattern, +      this._currentUsageRows, +      pipe +    ); +  } + +  _getMatchedTests(pattern) { +    let regex; + +    try { +      regex = new RegExp(pattern, 'i'); +    } catch { +      return []; +    } + +    const matchedTests = []; + +    this._cachedTestResults.forEach(({testResults}) => +      testResults.forEach(({title}) => { +        if (regex.test(title)) { +          matchedTests.push(title); +        } +      }) +    ); + +    return matchedTests; +  } + +  updateCachedTestResults(testResults = []) { +    this._cachedTestResults = testResults; +  } +} + +exports.default = TestNamePatternPrompt; diff --git a/node_modules/@jest/core/build/TestPathPatternPrompt.d.ts b/node_modules/@jest/core/build/TestPathPatternPrompt.d.ts new file mode 100644 index 0000000..589ee48 --- /dev/null +++ b/node_modules/@jest/core/build/TestPathPatternPrompt.d.ts @@ -0,0 +1,24 @@ +/** + * 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 { Test } from '@jest/test-result'; +import type { Context } from 'jest-runtime'; +import { PatternPrompt, Prompt, ScrollOptions } from 'jest-watcher'; +import type SearchSource from './SearchSource'; +declare type SearchSources = Array<{ +    context: Context; +    searchSource: SearchSource; +}>; +export default class TestPathPatternPrompt extends PatternPrompt { +    _searchSources?: SearchSources; +    constructor(pipe: NodeJS.WritableStream, prompt: Prompt); +    _onChange(pattern: string, options: ScrollOptions): void; +    _printPrompt(pattern: string): void; +    _getMatchedTests(pattern: string): Array<Test>; +    updateSearchSources(searchSources: SearchSources): void; +} +export {}; diff --git a/node_modules/@jest/core/build/TestPathPatternPrompt.js b/node_modules/@jest/core/build/TestPathPatternPrompt.js new file mode 100644 index 0000000..fe0a2bf --- /dev/null +++ b/node_modules/@jest/core/build/TestPathPatternPrompt.js @@ -0,0 +1,81 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +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; +} + +// TODO: Make underscored props `private` +class TestPathPatternPrompt extends _jestWatcher().PatternPrompt { +  constructor(pipe, prompt) { +    super(pipe, prompt); + +    _defineProperty(this, '_searchSources', void 0); + +    this._entityName = 'filenames'; +  } + +  _onChange(pattern, options) { +    super._onChange(pattern, options); + +    this._printPrompt(pattern); +  } + +  _printPrompt(pattern) { +    const pipe = this._pipe; +    (0, _jestWatcher().printPatternCaret)(pattern, pipe); +    (0, _jestWatcher().printRestoredPatternCaret)( +      pattern, +      this._currentUsageRows, +      pipe +    ); +  } + +  _getMatchedTests(pattern) { +    let regex; + +    try { +      regex = new RegExp(pattern, 'i'); +    } catch {} + +    let tests = []; + +    if (regex && this._searchSources) { +      this._searchSources.forEach(({searchSource}) => { +        tests = tests.concat(searchSource.findMatchingTests(pattern).tests); +      }); +    } + +    return tests; +  } + +  updateSearchSources(searchSources) { +    this._searchSources = searchSources; +  } +} + +exports.default = TestPathPatternPrompt; diff --git a/node_modules/@jest/core/build/TestScheduler.d.ts b/node_modules/@jest/core/build/TestScheduler.d.ts new file mode 100644 index 0000000..7cf0c18 --- /dev/null +++ b/node_modules/@jest/core/build/TestScheduler.d.ts @@ -0,0 +1,42 @@ +/** + * 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 { Reporter } from '@jest/reporters'; +import { AggregatedResult, Test } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type TestWatcher from './TestWatcher'; +export declare type TestSchedulerOptions = { +    startRun: (globalConfig: Config.GlobalConfig) => void; +}; +export declare type TestSchedulerContext = { +    firstRun: boolean; +    previousSuccess: boolean; +    changedFiles?: Set<Config.Path>; +    sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>; +}; +export declare function createTestScheduler(globalConfig: Config.GlobalConfig, options: TestSchedulerOptions, context: TestSchedulerContext): Promise<TestScheduler>; +declare class TestScheduler { +    private readonly _dispatcher; +    private readonly _globalConfig; +    private readonly _options; +    private readonly _context; +    constructor(globalConfig: Config.GlobalConfig, options: TestSchedulerOptions, context: TestSchedulerContext); +    addReporter(reporter: Reporter): void; +    removeReporter(ReporterClass: Function): void; +    scheduleTests(tests: Array<Test>, watcher: TestWatcher): Promise<AggregatedResult>; +    private _partitionTests; +    private _shouldAddDefaultReporters; +    _setupReporters(): Promise<void>; +    private _setupDefaultReporters; +    private _addCustomReporters; +    /** +     * Get properties of a reporter in an object +     * to make dealing with them less painful. +     */ +    private _getReporterProps; +    private _bailIfNeeded; +} +export {}; diff --git a/node_modules/@jest/core/build/TestScheduler.js b/node_modules/@jest/core/build/TestScheduler.js new file mode 100644 index 0000000..fb0d314 --- /dev/null +++ b/node_modules/@jest/core/build/TestScheduler.js @@ -0,0 +1,570 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.createTestScheduler = createTestScheduler; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _exit() { +  const data = _interopRequireDefault(require('exit')); + +  _exit = function () { +    return data; +  }; + +  return data; +} + +function _reporters() { +  const data = require('@jest/reporters'); + +  _reporters = function () { +    return data; +  }; + +  return data; +} + +function _testResult() { +  const data = require('@jest/test-result'); + +  _testResult = function () { +    return data; +  }; + +  return data; +} + +function _transform() { +  const data = require('@jest/transform'); + +  _transform = function () { +    return data; +  }; + +  return data; +} + +function _jestMessageUtil() { +  const data = require('jest-message-util'); + +  _jestMessageUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestSnapshot() { +  const data = _interopRequireDefault(require('jest-snapshot')); + +  _jestSnapshot = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _ReporterDispatcher = _interopRequireDefault( +  require('./ReporterDispatcher') +); + +var _testSchedulerHelper = require('./testSchedulerHelper'); + +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; +} + +async function createTestScheduler(globalConfig, options, context) { +  const scheduler = new TestScheduler(globalConfig, options, context); +  await scheduler._setupReporters(); +  return scheduler; +} + +class TestScheduler { +  constructor(globalConfig, options, context) { +    _defineProperty(this, '_dispatcher', void 0); + +    _defineProperty(this, '_globalConfig', void 0); + +    _defineProperty(this, '_options', void 0); + +    _defineProperty(this, '_context', void 0); + +    this._dispatcher = new _ReporterDispatcher.default(); +    this._globalConfig = globalConfig; +    this._options = options; +    this._context = context; +  } + +  addReporter(reporter) { +    this._dispatcher.register(reporter); +  } + +  removeReporter(ReporterClass) { +    this._dispatcher.unregister(ReporterClass); +  } + +  async scheduleTests(tests, watcher) { +    const onTestFileStart = this._dispatcher.onTestFileStart.bind( +      this._dispatcher +    ); + +    const timings = []; +    const contexts = new Set(); +    tests.forEach(test => { +      contexts.add(test.context); + +      if (test.duration) { +        timings.push(test.duration); +      } +    }); +    const aggregatedResults = createAggregatedResults(tests.length); +    const estimatedTime = Math.ceil( +      getEstimatedTime(timings, this._globalConfig.maxWorkers) / 1000 +    ); +    const runInBand = (0, _testSchedulerHelper.shouldRunInBand)( +      tests, +      timings, +      this._globalConfig +    ); + +    const onResult = async (test, testResult) => { +      if (watcher.isInterrupted()) { +        return Promise.resolve(); +      } + +      if (testResult.testResults.length === 0) { +        const message = 'Your test suite must contain at least one test.'; +        return onFailure(test, { +          message, +          stack: new Error(message).stack +        }); +      } // Throws when the context is leaked after executing a test. + +      if (testResult.leaks) { +        const message = +          _chalk().default.red.bold('EXPERIMENTAL FEATURE!\n') + +          'Your test suite is leaking memory. Please ensure all references are cleaned.\n' + +          '\n' + +          'There is a number of things that can leak memory:\n' + +          '  - Async operations that have not finished (e.g. fs.readFile).\n' + +          '  - Timers not properly mocked (e.g. setInterval, setTimeout).\n' + +          '  - Keeping references to the global scope.'; +        return onFailure(test, { +          message, +          stack: new Error(message).stack +        }); +      } + +      (0, _testResult().addResult)(aggregatedResults, testResult); +      await this._dispatcher.onTestFileResult( +        test, +        testResult, +        aggregatedResults +      ); +      return this._bailIfNeeded(contexts, aggregatedResults, watcher); +    }; + +    const onFailure = async (test, error) => { +      if (watcher.isInterrupted()) { +        return; +      } + +      const testResult = (0, _testResult().buildFailureTestResult)( +        test.path, +        error +      ); +      testResult.failureMessage = (0, _jestMessageUtil().formatExecError)( +        testResult.testExecError, +        test.context.config, +        this._globalConfig, +        test.path +      ); +      (0, _testResult().addResult)(aggregatedResults, testResult); +      await this._dispatcher.onTestFileResult( +        test, +        testResult, +        aggregatedResults +      ); +    }; + +    const updateSnapshotState = async () => { +      const contextsWithSnapshotResolvers = await Promise.all( +        Array.from(contexts).map(async context => [ +          context, +          await _jestSnapshot().default.buildSnapshotResolver(context.config) +        ]) +      ); +      contextsWithSnapshotResolvers.forEach(([context, snapshotResolver]) => { +        const status = _jestSnapshot().default.cleanup( +          context.hasteFS, +          this._globalConfig.updateSnapshot, +          snapshotResolver, +          context.config.testPathIgnorePatterns +        ); + +        aggregatedResults.snapshot.filesRemoved += status.filesRemoved; +        aggregatedResults.snapshot.filesRemovedList = ( +          aggregatedResults.snapshot.filesRemovedList || [] +        ).concat(status.filesRemovedList); +      }); +      const updateAll = this._globalConfig.updateSnapshot === 'all'; +      aggregatedResults.snapshot.didUpdate = updateAll; +      aggregatedResults.snapshot.failure = !!( +        !updateAll && +        (aggregatedResults.snapshot.unchecked || +          aggregatedResults.snapshot.unmatched || +          aggregatedResults.snapshot.filesRemoved) +      ); +    }; + +    await this._dispatcher.onRunStart(aggregatedResults, { +      estimatedTime, +      showStatus: !runInBand +    }); +    const testRunners = Object.create(null); +    const contextsByTestRunner = new WeakMap(); +    await Promise.all( +      Array.from(contexts).map(async context => { +        const {config} = context; + +        if (!testRunners[config.runner]) { +          var _this$_context, _this$_context2; + +          const transformer = await (0, _transform().createScriptTransformer)( +            config +          ); +          const Runner = await transformer.requireAndTranspileModule( +            config.runner +          ); +          const runner = new Runner(this._globalConfig, { +            changedFiles: +              (_this$_context = this._context) === null || +              _this$_context === void 0 +                ? void 0 +                : _this$_context.changedFiles, +            sourcesRelatedToTestsInChangedFiles: +              (_this$_context2 = this._context) === null || +              _this$_context2 === void 0 +                ? void 0 +                : _this$_context2.sourcesRelatedToTestsInChangedFiles +          }); +          testRunners[config.runner] = runner; +          contextsByTestRunner.set(runner, context); +        } +      }) +    ); + +    const testsByRunner = this._partitionTests(testRunners, tests); + +    if (testsByRunner) { +      try { +        for (const runner of Object.keys(testRunners)) { +          const testRunner = testRunners[runner]; +          const context = contextsByTestRunner.get(testRunner); +          invariant(context); +          const tests = testsByRunner[runner]; +          const testRunnerOptions = { +            serial: runInBand || Boolean(testRunner.isSerial) +          }; +          /** +           * Test runners with event emitters are still not supported +           * for third party test runners. +           */ + +          if (testRunner.__PRIVATE_UNSTABLE_API_supportsEventEmitters__) { +            const unsubscribes = [ +              testRunner.on('test-file-start', ([test]) => +                onTestFileStart(test) +              ), +              testRunner.on('test-file-success', ([test, testResult]) => +                onResult(test, testResult) +              ), +              testRunner.on('test-file-failure', ([test, error]) => +                onFailure(test, error) +              ), +              testRunner.on( +                'test-case-result', +                ([testPath, testCaseResult]) => { +                  const test = { +                    context, +                    path: testPath +                  }; + +                  this._dispatcher.onTestCaseResult(test, testCaseResult); +                } +              ) +            ]; +            await testRunner.runTests( +              tests, +              watcher, +              undefined, +              undefined, +              undefined, +              testRunnerOptions +            ); +            unsubscribes.forEach(sub => sub()); +          } else { +            await testRunner.runTests( +              tests, +              watcher, +              onTestFileStart, +              onResult, +              onFailure, +              testRunnerOptions +            ); +          } +        } +      } catch (error) { +        if (!watcher.isInterrupted()) { +          throw error; +        } +      } +    } + +    await updateSnapshotState(); +    aggregatedResults.wasInterrupted = watcher.isInterrupted(); +    await this._dispatcher.onRunComplete(contexts, aggregatedResults); +    const anyTestFailures = !( +      aggregatedResults.numFailedTests === 0 && +      aggregatedResults.numRuntimeErrorTestSuites === 0 +    ); + +    const anyReporterErrors = this._dispatcher.hasErrors(); + +    aggregatedResults.success = !( +      anyTestFailures || +      aggregatedResults.snapshot.failure || +      anyReporterErrors +    ); +    return aggregatedResults; +  } + +  _partitionTests(testRunners, tests) { +    if (Object.keys(testRunners).length > 1) { +      return tests.reduce((testRuns, test) => { +        const runner = test.context.config.runner; + +        if (!testRuns[runner]) { +          testRuns[runner] = []; +        } + +        testRuns[runner].push(test); +        return testRuns; +      }, Object.create(null)); +    } else if (tests.length > 0 && tests[0] != null) { +      // If there is only one runner, don't partition the tests. +      return Object.assign(Object.create(null), { +        [tests[0].context.config.runner]: tests +      }); +    } else { +      return null; +    } +  } + +  _shouldAddDefaultReporters(reporters) { +    return ( +      !reporters || +      !!reporters.find( +        reporter => this._getReporterProps(reporter).path === 'default' +      ) +    ); +  } + +  async _setupReporters() { +    const {collectCoverage, notify, reporters} = this._globalConfig; + +    const isDefault = this._shouldAddDefaultReporters(reporters); + +    if (isDefault) { +      this._setupDefaultReporters(collectCoverage); +    } + +    if (!isDefault && collectCoverage) { +      var _this$_context3, _this$_context4; + +      this.addReporter( +        new (_reporters().CoverageReporter)(this._globalConfig, { +          changedFiles: +            (_this$_context3 = this._context) === null || +            _this$_context3 === void 0 +              ? void 0 +              : _this$_context3.changedFiles, +          sourcesRelatedToTestsInChangedFiles: +            (_this$_context4 = this._context) === null || +            _this$_context4 === void 0 +              ? void 0 +              : _this$_context4.sourcesRelatedToTestsInChangedFiles +        }) +      ); +    } + +    if (notify) { +      this.addReporter( +        new (_reporters().NotifyReporter)( +          this._globalConfig, +          this._options.startRun, +          this._context +        ) +      ); +    } + +    if (reporters && Array.isArray(reporters)) { +      await this._addCustomReporters(reporters); +    } +  } + +  _setupDefaultReporters(collectCoverage) { +    this.addReporter( +      this._globalConfig.verbose +        ? new (_reporters().VerboseReporter)(this._globalConfig) +        : new (_reporters().DefaultReporter)(this._globalConfig) +    ); + +    if (collectCoverage) { +      var _this$_context5, _this$_context6; + +      this.addReporter( +        new (_reporters().CoverageReporter)(this._globalConfig, { +          changedFiles: +            (_this$_context5 = this._context) === null || +            _this$_context5 === void 0 +              ? void 0 +              : _this$_context5.changedFiles, +          sourcesRelatedToTestsInChangedFiles: +            (_this$_context6 = this._context) === null || +            _this$_context6 === void 0 +              ? void 0 +              : _this$_context6.sourcesRelatedToTestsInChangedFiles +        }) +      ); +    } + +    this.addReporter(new (_reporters().SummaryReporter)(this._globalConfig)); +  } + +  async _addCustomReporters(reporters) { +    for (const reporter of reporters) { +      const {options, path} = this._getReporterProps(reporter); + +      if (path === 'default') continue; + +      try { +        const Reporter = await (0, _jestUtil().requireOrImportModule)( +          path, +          true +        ); +        this.addReporter(new Reporter(this._globalConfig, options)); +      } catch (error) { +        error.message = +          'An error occurred while adding the reporter at path "' + +          _chalk().default.bold(path) + +          '".' + +          error.message; +        throw error; +      } +    } +  } +  /** +   * Get properties of a reporter in an object +   * to make dealing with them less painful. +   */ + +  _getReporterProps(reporter) { +    if (typeof reporter === 'string') { +      return { +        options: this._options, +        path: reporter +      }; +    } else if (Array.isArray(reporter)) { +      const [path, options] = reporter; +      return { +        options, +        path +      }; +    } + +    throw new Error('Reporter should be either a string or an array'); +  } + +  async _bailIfNeeded(contexts, aggregatedResults, watcher) { +    if ( +      this._globalConfig.bail !== 0 && +      aggregatedResults.numFailedTests >= this._globalConfig.bail +    ) { +      if (watcher.isWatchMode()) { +        await watcher.setState({ +          interrupted: true +        }); +        return; +      } + +      try { +        await this._dispatcher.onRunComplete(contexts, aggregatedResults); +      } finally { +        const exitCode = this._globalConfig.testFailureExitCode; +        (0, _exit().default)(exitCode); +      } +    } +  } +} + +function invariant(condition, message) { +  if (!condition) { +    throw new Error(message); +  } +} + +const createAggregatedResults = numTotalTestSuites => { +  const result = (0, _testResult().makeEmptyAggregatedTestResult)(); +  result.numTotalTestSuites = numTotalTestSuites; +  result.startTime = Date.now(); +  result.success = false; +  return result; +}; + +const getEstimatedTime = (timings, workers) => { +  if (timings.length === 0) { +    return 0; +  } + +  const max = Math.max(...timings); +  return timings.length <= workers +    ? max +    : Math.max(timings.reduce((sum, time) => sum + time) / workers, max); +}; diff --git a/node_modules/@jest/core/build/TestWatcher.d.ts b/node_modules/@jest/core/build/TestWatcher.d.ts new file mode 100644 index 0000000..baceb5e --- /dev/null +++ b/node_modules/@jest/core/build/TestWatcher.d.ts @@ -0,0 +1,23 @@ +/** + * 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 emittery = require('emittery'); +declare type State = { +    interrupted: boolean; +}; +export default class TestWatcher extends emittery<{ +    change: State; +}> { +    state: State; +    private _isWatchMode; +    constructor({ isWatchMode }: { +        isWatchMode: boolean; +    }); +    setState(state: State): Promise<void>; +    isInterrupted(): boolean; +    isWatchMode(): boolean; +} +export {}; diff --git a/node_modules/@jest/core/build/TestWatcher.js b/node_modules/@jest/core/build/TestWatcher.js new file mode 100644 index 0000000..491279b --- /dev/null +++ b/node_modules/@jest/core/build/TestWatcher.js @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _emittery() { +  const data = _interopRequireDefault(require('emittery')); + +  _emittery = function () { +    return data; +  }; + +  return data; +} + +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 TestWatcher extends _emittery().default { +  constructor({isWatchMode}) { +    super(); + +    _defineProperty(this, 'state', void 0); + +    _defineProperty(this, '_isWatchMode', void 0); + +    this.state = { +      interrupted: false +    }; +    this._isWatchMode = isWatchMode; +  } + +  async setState(state) { +    Object.assign(this.state, state); +    await this.emit('change', this.state); +  } + +  isInterrupted() { +    return this.state.interrupted; +  } + +  isWatchMode() { +    return this._isWatchMode; +  } +} + +exports.default = TestWatcher; diff --git a/node_modules/@jest/core/build/assets/jest_logo.png b/node_modules/@jest/core/build/assets/jest_logo.png Binary files differnew file mode 100644 index 0000000..079356b --- /dev/null +++ b/node_modules/@jest/core/build/assets/jest_logo.png diff --git a/node_modules/@jest/core/build/cli/index.d.ts b/node_modules/@jest/core/build/cli/index.d.ts new file mode 100644 index 0000000..bfa970e --- /dev/null +++ b/node_modules/@jest/core/build/cli/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 { AggregatedResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +export declare function runCLI(argv: Config.Argv, projects: Array<Config.Path>): Promise<{ +    results: AggregatedResult; +    globalConfig: Config.GlobalConfig; +}>; diff --git a/node_modules/@jest/core/build/cli/index.js b/node_modules/@jest/core/build/cli/index.js new file mode 100644 index 0000000..2844390 --- /dev/null +++ b/node_modules/@jest/core/build/cli/index.js @@ -0,0 +1,399 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.runCLI = runCLI; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _exit() { +  const data = _interopRequireDefault(require('exit')); + +  _exit = function () { +    return data; +  }; + +  return data; +} + +function _rimraf() { +  const data = _interopRequireDefault(require('rimraf')); + +  _rimraf = function () { +    return data; +  }; + +  return data; +} + +function _console() { +  const data = require('@jest/console'); + +  _console = function () { +    return data; +  }; + +  return data; +} + +function _jestConfig() { +  const data = require('jest-config'); + +  _jestConfig = function () { +    return data; +  }; + +  return data; +} + +function _jestRuntime() { +  const data = _interopRequireDefault(require('jest-runtime')); + +  _jestRuntime = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _TestWatcher = _interopRequireDefault(require('../TestWatcher')); + +var _collectHandles = require('../collectHandles'); + +var _getChangedFilesPromise = _interopRequireDefault( +  require('../getChangedFilesPromise') +); + +var _getConfigsOfProjectsToRun = _interopRequireDefault( +  require('../getConfigsOfProjectsToRun') +); + +var _getProjectNamesMissingWarning = _interopRequireDefault( +  require('../getProjectNamesMissingWarning') +); + +var _getSelectProjectsMessage = _interopRequireDefault( +  require('../getSelectProjectsMessage') +); + +var _createContext = _interopRequireDefault(require('../lib/createContext')); + +var _handleDeprecationWarnings = _interopRequireDefault( +  require('../lib/handleDeprecationWarnings') +); + +var _logDebugMessages = _interopRequireDefault( +  require('../lib/logDebugMessages') +); + +var _pluralize = _interopRequireDefault(require('../pluralize')); + +var _runJest = _interopRequireDefault(require('../runJest')); + +var _watch = _interopRequireDefault(require('../watch')); + +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 {print: preRunMessagePrint} = _jestUtil().preRunMessage; + +async function runCLI(argv, projects) { +  let results; // If we output a JSON object, we can't write anything to stdout, since +  // it'll break the JSON structure and it won't be valid. + +  const outputStream = +    argv.json || argv.useStderr ? process.stderr : process.stdout; +  const {globalConfig, configs, hasDeprecationWarnings} = await (0, +  _jestConfig().readConfigs)(argv, projects); + +  if (argv.debug) { +    (0, _logDebugMessages.default)(globalConfig, configs, outputStream); +  } + +  if (argv.showConfig) { +    (0, _logDebugMessages.default)(globalConfig, configs, process.stdout); +    (0, _exit().default)(0); +  } + +  if (argv.clearCache) { +    configs.forEach(config => { +      _rimraf().default.sync(config.cacheDirectory); + +      process.stdout.write(`Cleared ${config.cacheDirectory}\n`); +    }); +    (0, _exit().default)(0); +  } + +  let configsOfProjectsToRun = configs; + +  if (argv.selectProjects) { +    const namesMissingWarning = (0, _getProjectNamesMissingWarning.default)( +      configs +    ); + +    if (namesMissingWarning) { +      outputStream.write(namesMissingWarning); +    } + +    configsOfProjectsToRun = (0, _getConfigsOfProjectsToRun.default)( +      argv.selectProjects, +      configs +    ); +    outputStream.write( +      (0, _getSelectProjectsMessage.default)(configsOfProjectsToRun) +    ); +  } + +  await _run10000( +    globalConfig, +    configsOfProjectsToRun, +    hasDeprecationWarnings, +    outputStream, +    r => { +      results = r; +    } +  ); + +  if (argv.watch || argv.watchAll) { +    // If in watch mode, return the promise that will never resolve. +    // If the watch mode is interrupted, watch should handle the process +    // shutdown. +    return new Promise(() => {}); +  } + +  if (!results) { +    throw new Error( +      'AggregatedResult must be present after test run is complete' +    ); +  } + +  const {openHandles} = results; + +  if (openHandles && openHandles.length) { +    const formatted = (0, _collectHandles.formatHandleErrors)( +      openHandles, +      configs[0] +    ); +    const openHandlesString = (0, _pluralize.default)( +      'open handle', +      formatted.length, +      's' +    ); +    const message = +      _chalk().default.red( +        `\nJest has detected the following ${openHandlesString} potentially keeping Jest from exiting:\n\n` +      ) + formatted.join('\n\n'); +    console.error(message); +  } + +  return { +    globalConfig, +    results +  }; +} + +const buildContextsAndHasteMaps = async ( +  configs, +  globalConfig, +  outputStream +) => { +  const hasteMapInstances = Array(configs.length); +  const contexts = await Promise.all( +    configs.map(async (config, index) => { +      (0, _jestUtil().createDirectory)(config.cacheDirectory); + +      const hasteMapInstance = _jestRuntime().default.createHasteMap(config, { +        console: new (_console().CustomConsole)(outputStream, outputStream), +        maxWorkers: Math.max( +          1, +          Math.floor(globalConfig.maxWorkers / configs.length) +        ), +        resetCache: !config.cache, +        watch: globalConfig.watch || globalConfig.watchAll, +        watchman: globalConfig.watchman +      }); + +      hasteMapInstances[index] = hasteMapInstance; +      return (0, _createContext.default)( +        config, +        await hasteMapInstance.build() +      ); +    }) +  ); +  return { +    contexts, +    hasteMapInstances +  }; +}; + +const _run10000 = async ( +  globalConfig, +  configs, +  hasDeprecationWarnings, +  outputStream, +  onComplete +) => { +  // Queries to hg/git can take a while, so we need to start the process +  // as soon as possible, so by the time we need the result it's already there. +  const changedFilesPromise = (0, _getChangedFilesPromise.default)( +    globalConfig, +    configs +  ); // Filter may need to do an HTTP call or something similar to setup. +  // We will wait on an async response from this before using the filter. + +  let filter; + +  if (globalConfig.filter && !globalConfig.skipFilter) { +    const rawFilter = require(globalConfig.filter); + +    let filterSetupPromise; + +    if (rawFilter.setup) { +      // Wrap filter setup Promise to avoid "uncaught Promise" error. +      // If an error is returned, we surface it in the return value. +      filterSetupPromise = (async () => { +        try { +          await rawFilter.setup(); +        } catch (err) { +          return err; +        } + +        return undefined; +      })(); +    } + +    filter = async testPaths => { +      if (filterSetupPromise) { +        // Expect an undefined return value unless there was an error. +        const err = await filterSetupPromise; + +        if (err) { +          throw err; +        } +      } + +      return rawFilter(testPaths); +    }; +  } + +  const {contexts, hasteMapInstances} = await buildContextsAndHasteMaps( +    configs, +    globalConfig, +    outputStream +  ); +  globalConfig.watch || globalConfig.watchAll +    ? await runWatch( +        contexts, +        configs, +        hasDeprecationWarnings, +        globalConfig, +        outputStream, +        hasteMapInstances, +        filter +      ) +    : await runWithoutWatch( +        globalConfig, +        contexts, +        outputStream, +        onComplete, +        changedFilesPromise, +        filter +      ); +}; + +const runWatch = async ( +  contexts, +  _configs, +  hasDeprecationWarnings, +  globalConfig, +  outputStream, +  hasteMapInstances, +  filter +) => { +  if (hasDeprecationWarnings) { +    try { +      await (0, _handleDeprecationWarnings.default)( +        outputStream, +        process.stdin +      ); +      return (0, _watch.default)( +        globalConfig, +        contexts, +        outputStream, +        hasteMapInstances, +        undefined, +        undefined, +        filter +      ); +    } catch { +      (0, _exit().default)(0); +    } +  } + +  return (0, _watch.default)( +    globalConfig, +    contexts, +    outputStream, +    hasteMapInstances, +    undefined, +    undefined, +    filter +  ); +}; + +const runWithoutWatch = async ( +  globalConfig, +  contexts, +  outputStream, +  onComplete, +  changedFilesPromise, +  filter +) => { +  const startRun = async () => { +    if (!globalConfig.listTests) { +      preRunMessagePrint(outputStream); +    } + +    return (0, _runJest.default)({ +      changedFilesPromise, +      contexts, +      failedTestsCache: undefined, +      filter, +      globalConfig, +      onComplete, +      outputStream, +      startRun, +      testWatcher: new _TestWatcher.default({ +        isWatchMode: false +      }) +    }); +  }; + +  return startRun(); +}; diff --git a/node_modules/@jest/core/build/collectHandles.d.ts b/node_modules/@jest/core/build/collectHandles.d.ts new file mode 100644 index 0000000..7e72c44 --- /dev/null +++ b/node_modules/@jest/core/build/collectHandles.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 type { Config } from '@jest/types'; +export declare type HandleCollectionResult = () => Promise<Array<Error>>; +export default function collectHandles(): HandleCollectionResult; +export declare function formatHandleErrors(errors: Array<Error>, config: Config.ProjectConfig): Array<string>; diff --git a/node_modules/@jest/core/build/collectHandles.js b/node_modules/@jest/core/build/collectHandles.js new file mode 100644 index 0000000..6b77f1c --- /dev/null +++ b/node_modules/@jest/core/build/collectHandles.js @@ -0,0 +1,269 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = collectHandles; +exports.formatHandleErrors = formatHandleErrors; + +function asyncHooks() { +  const data = _interopRequireWildcard(require('async_hooks')); + +  asyncHooks = function () { +    return data; +  }; + +  return data; +} + +function _util() { +  const data = require('util'); + +  _util = function () { +    return data; +  }; + +  return data; +} + +function _stripAnsi() { +  const data = _interopRequireDefault(require('strip-ansi')); + +  _stripAnsi = function () { +    return data; +  }; + +  return data; +} + +function _jestMessageUtil() { +  const data = require('jest-message-util'); + +  _jestMessageUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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. + */ + +/* eslint-disable local/ban-types-eventually */ +function stackIsFromUser(stack) { +  // Either the test file, or something required by it +  if (stack.includes('Runtime.requireModule')) { +    return true; +  } // jest-jasmine it or describe call + +  if (stack.includes('asyncJestTest') || stack.includes('asyncJestLifecycle')) { +    return true; +  } // An async function call from within circus + +  if (stack.includes('callAsyncCircusFn')) { +    // jest-circus it or describe call +    return ( +      stack.includes('_callCircusTest') || stack.includes('_callCircusHook') +    ); +  } + +  return false; +} + +const alwaysActive = () => true; // @ts-expect-error: doesn't exist in v10 typings + +const hasWeakRef = typeof WeakRef === 'function'; +const asyncSleep = (0, _util().promisify)(setTimeout); // Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js +// Extracted as we want to format the result ourselves + +function collectHandles() { +  const activeHandles = new Map(); +  const hook = asyncHooks().createHook({ +    destroy(asyncId) { +      activeHandles.delete(asyncId); +    }, + +    init: function initHook(asyncId, type, triggerAsyncId, resource) { +      // Skip resources that should not generally prevent the process from +      // exiting, not last a meaningfully long time, or otherwise shouldn't be +      // tracked. +      if ( +        type === 'PROMISE' || +        type === 'TIMERWRAP' || +        type === 'ELDHISTOGRAM' || +        type === 'PerformanceObserver' || +        type === 'RANDOMBYTESREQUEST' || +        type === 'DNSCHANNEL' || +        type === 'ZLIB' +      ) { +        return; +      } + +      const error = new (_jestUtil().ErrorWithStack)(type, initHook, 100); +      let fromUser = stackIsFromUser(error.stack || ''); // If the async resource was not directly created by user code, but was +      // triggered by another async resource from user code, track it and use +      // the original triggering resource's stack. + +      if (!fromUser) { +        const triggeringHandle = activeHandles.get(triggerAsyncId); + +        if (triggeringHandle) { +          fromUser = true; +          error.stack = triggeringHandle.error.stack; +        } +      } + +      if (fromUser) { +        let isActive; + +        if (type === 'Timeout' || type === 'Immediate') { +          // Timer that supports hasRef (Node v11+) +          if ('hasRef' in resource) { +            if (hasWeakRef) { +              // @ts-expect-error: doesn't exist in v10 typings +              const ref = new WeakRef(resource); + +              isActive = () => { +                var _ref$deref$hasRef, _ref$deref; + +                return (_ref$deref$hasRef = +                  (_ref$deref = ref.deref()) === null || _ref$deref === void 0 +                    ? void 0 +                    : _ref$deref.hasRef()) !== null && +                  _ref$deref$hasRef !== void 0 +                  ? _ref$deref$hasRef +                  : false; +              }; +            } else { +              // @ts-expect-error: doesn't exist in v10 typings +              isActive = resource.hasRef.bind(resource); +            } +          } else { +            // Timer that doesn't support hasRef +            isActive = alwaysActive; +          } +        } else { +          // Any other async resource +          isActive = alwaysActive; +        } + +        activeHandles.set(asyncId, { +          error, +          isActive +        }); +      } +    } +  }); +  hook.enable(); +  return async () => { +    // Wait briefly for any async resources that have been queued for +    // destruction to actually be destroyed. +    // For example, Node.js TCP Servers are not destroyed until *after* their +    // `close` callback runs. If someone finishes a test from the `close` +    // callback, we will not yet have seen the resource be destroyed here. +    await asyncSleep(100); +    hook.disable(); // Get errors for every async resource still referenced at this moment + +    const result = Array.from(activeHandles.values()) +      .filter(({isActive}) => isActive()) +      .map(({error}) => error); +    activeHandles.clear(); +    return result; +  }; +} + +function formatHandleErrors(errors, config) { +  const stacks = new Set(); +  return ( +    errors +      .map(err => +        (0, _jestMessageUtil().formatExecError)( +          err, +          config, +          { +            noStackTrace: false +          }, +          undefined, +          true +        ) +      ) // E.g. timeouts might give multiple traces to the same line of code +      // This hairy filtering tries to remove entries with duplicate stack traces +      .filter(handle => { +        const ansiFree = (0, _stripAnsi().default)(handle); +        const match = ansiFree.match(/\s+at(.*)/); + +        if (!match || match.length < 2) { +          return true; +        } + +        const stack = ansiFree.substr(ansiFree.indexOf(match[1])).trim(); + +        if (stacks.has(stack)) { +          return false; +        } + +        stacks.add(stack); +        return true; +      }) +  ); +} diff --git a/node_modules/@jest/core/build/getChangedFilesPromise.d.ts b/node_modules/@jest/core/build/getChangedFilesPromise.d.ts new file mode 100644 index 0000000..4a42b64 --- /dev/null +++ b/node_modules/@jest/core/build/getChangedFilesPromise.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. + */ +import type { Config } from '@jest/types'; +import { ChangedFilesPromise } from 'jest-changed-files'; +export default function getChangedFilesPromise(globalConfig: Config.GlobalConfig, configs: Array<Config.ProjectConfig>): ChangedFilesPromise | undefined; diff --git a/node_modules/@jest/core/build/getChangedFilesPromise.js b/node_modules/@jest/core/build/getChangedFilesPromise.js new file mode 100644 index 0000000..c7912af --- /dev/null +++ b/node_modules/@jest/core/build/getChangedFilesPromise.js @@ -0,0 +1,77 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getChangedFilesPromise; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestChangedFiles() { +  const data = require('jest-changed-files'); + +  _jestChangedFiles = function () { +    return data; +  }; + +  return data; +} + +function _jestMessageUtil() { +  const data = require('jest-message-util'); + +  _jestMessageUtil = function () { +    return data; +  }; + +  return data; +} + +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. + */ +function getChangedFilesPromise(globalConfig, configs) { +  if (globalConfig.onlyChanged) { +    const allRootsForAllProjects = configs.reduce((roots, config) => { +      if (config.roots) { +        roots.push(...config.roots); +      } + +      return roots; +    }, []); +    return (0, _jestChangedFiles().getChangedFilesForRoots)( +      allRootsForAllProjects, +      { +        changedSince: globalConfig.changedSince, +        lastCommit: globalConfig.lastCommit, +        withAncestor: globalConfig.changedFilesWithAncestor +      } +    ).catch(e => { +      const message = (0, _jestMessageUtil().formatExecError)(e, configs[0], { +        noStackTrace: true +      }) +        .split('\n') +        .filter(line => !line.includes('Command failed:')) +        .join('\n'); +      console.error(_chalk().default.red(`\n\n${message}`)); +      process.exit(1); +    }); +  } + +  return undefined; +} diff --git a/node_modules/@jest/core/build/getConfigsOfProjectsToRun.d.ts b/node_modules/@jest/core/build/getConfigsOfProjectsToRun.d.ts new file mode 100644 index 0000000..0a780d4 --- /dev/null +++ b/node_modules/@jest/core/build/getConfigsOfProjectsToRun.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 } from '@jest/types'; +export default function getConfigsOfProjectsToRun(namesOfProjectsToRun: Array<string>, projectConfigs: Array<Config.ProjectConfig>): Array<Config.ProjectConfig>; diff --git a/node_modules/@jest/core/build/getConfigsOfProjectsToRun.js b/node_modules/@jest/core/build/getConfigsOfProjectsToRun.js new file mode 100644 index 0000000..9326e30 --- /dev/null +++ b/node_modules/@jest/core/build/getConfigsOfProjectsToRun.js @@ -0,0 +1,28 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getConfigsOfProjectsToRun; + +var _getProjectDisplayName = _interopRequireDefault( +  require('./getProjectDisplayName') +); + +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. + */ +function getConfigsOfProjectsToRun(namesOfProjectsToRun, projectConfigs) { +  const setOfProjectsToRun = new Set(namesOfProjectsToRun); +  return projectConfigs.filter(config => { +    const name = (0, _getProjectDisplayName.default)(config); +    return name && setOfProjectsToRun.has(name); +  }); +} diff --git a/node_modules/@jest/core/build/getNoTestFound.d.ts b/node_modules/@jest/core/build/getNoTestFound.d.ts new file mode 100644 index 0000000..4e30581 --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFound.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. + */ +import type { Config } from '@jest/types'; +import type { TestRunData } from './types'; +export default function getNoTestFound(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string; diff --git a/node_modules/@jest/core/build/getNoTestFound.js b/node_modules/@jest/core/build/getNoTestFound.js new file mode 100644 index 0000000..bd33d58 --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFound.js @@ -0,0 +1,63 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getNoTestFound; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +var _pluralize = _interopRequireDefault(require('./pluralize')); + +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. + */ +function getNoTestFound(testRunData, globalConfig) { +  const testFiles = testRunData.reduce( +    (current, testRun) => current + (testRun.matches.total || 0), +    0 +  ); +  let dataMessage; + +  if (globalConfig.runTestsByPath) { +    dataMessage = `Files: ${globalConfig.nonFlagArgs +      .map(p => `"${p}"`) +      .join(', ')}`; +  } else { +    dataMessage = `Pattern: ${_chalk().default.yellow( +      globalConfig.testPathPattern +    )} - 0 matches`; +  } + +  return ( +    _chalk().default.bold('No tests found, exiting with code 1') + +    '\n' + +    'Run with `--passWithNoTests` to exit with code 0' + +    '\n' + +    `In ${_chalk().default.bold(globalConfig.rootDir)}` + +    '\n' + +    `  ${(0, _pluralize.default)('file', testFiles, 's')} checked across ${(0, +    _pluralize.default)( +      'project', +      testRunData.length, +      's' +    )}. Run with \`--verbose\` for more details.` + +    '\n' + +    dataMessage +  ); +} diff --git a/node_modules/@jest/core/build/getNoTestFoundFailed.d.ts b/node_modules/@jest/core/build/getNoTestFoundFailed.d.ts new file mode 100644 index 0000000..16c5fab --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFoundFailed.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 } from '@jest/types'; +export default function getNoTestFoundFailed(globalConfig: Config.GlobalConfig): string; diff --git a/node_modules/@jest/core/build/getNoTestFoundFailed.js b/node_modules/@jest/core/build/getNoTestFoundFailed.js new file mode 100644 index 0000000..a7d404c --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFoundFailed.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getNoTestFoundFailed; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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. + */ +function getNoTestFoundFailed(globalConfig) { +  let msg = _chalk().default.bold('No failed test found.'); + +  if (_jestUtil().isInteractive) { +    msg += _chalk().default.dim( +      '\n' + +        (globalConfig.watch +          ? 'Press `f` to quit "only failed tests" mode.' +          : 'Run Jest without `--onlyFailures` or with `--all` to run all tests.') +    ); +  } + +  return msg; +} diff --git a/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.d.ts b/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.d.ts new file mode 100644 index 0000000..a594ba4 --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.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 getNoTestFoundPassWithNoTests(): string; diff --git a/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.js b/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.js new file mode 100644 index 0000000..eb279c3 --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFoundPassWithNoTests.js @@ -0,0 +1,30 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getNoTestFoundPassWithNoTests; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +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. + */ +function getNoTestFoundPassWithNoTests() { +  return _chalk().default.bold('No tests found, exiting with code 0'); +} diff --git a/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.d.ts b/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.d.ts new file mode 100644 index 0000000..53cdefc --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.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 } from '@jest/types'; +export default function getNoTestFoundRelatedToChangedFiles(globalConfig: Config.GlobalConfig): string; diff --git a/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.js b/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.js new file mode 100644 index 0000000..9571d18 --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFoundRelatedToChangedFiles.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getNoTestFoundRelatedToChangedFiles; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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. + */ +function getNoTestFoundRelatedToChangedFiles(globalConfig) { +  const ref = globalConfig.changedSince +    ? `"${globalConfig.changedSince}"` +    : 'last commit'; + +  let msg = _chalk().default.bold( +    `No tests found related to files changed since ${ref}.` +  ); + +  if (_jestUtil().isInteractive) { +    msg += _chalk().default.dim( +      '\n' + +        (globalConfig.watch +          ? 'Press `a` to run all tests, or run Jest with `--watchAll`.' +          : 'Run Jest without `-o` or with `--all` to run all tests.') +    ); +  } + +  return msg; +} diff --git a/node_modules/@jest/core/build/getNoTestFoundVerbose.d.ts b/node_modules/@jest/core/build/getNoTestFoundVerbose.d.ts new file mode 100644 index 0000000..a84572a --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFoundVerbose.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. + */ +import type { Config } from '@jest/types'; +import type { TestRunData } from './types'; +export default function getNoTestFoundVerbose(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string; diff --git a/node_modules/@jest/core/build/getNoTestFoundVerbose.js b/node_modules/@jest/core/build/getNoTestFoundVerbose.js new file mode 100644 index 0000000..8f1359c --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestFoundVerbose.js @@ -0,0 +1,95 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getNoTestFoundVerbose; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +var _pluralize = _interopRequireDefault(require('./pluralize')); + +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. + */ +function getNoTestFoundVerbose(testRunData, globalConfig) { +  const individualResults = testRunData.map(testRun => { +    const stats = testRun.matches.stats || {}; +    const config = testRun.context.config; +    const statsMessage = Object.keys(stats) +      .map(key => { +        if (key === 'roots' && config.roots.length === 1) { +          return null; +        } + +        const value = config[key]; + +        if (value) { +          const valueAsString = Array.isArray(value) +            ? value.join(', ') +            : String(value); +          const matches = (0, _pluralize.default)( +            'match', +            stats[key] || 0, +            'es' +          ); +          return `  ${key}: ${_chalk().default.yellow( +            valueAsString +          )} - ${matches}`; +        } + +        return null; +      }) +      .filter(line => line) +      .join('\n'); +    return testRun.matches.total +      ? `In ${_chalk().default.bold(config.rootDir)}\n` + +          `  ${(0, _pluralize.default)( +            'file', +            testRun.matches.total || 0, +            's' +          )} checked.\n` + +          statsMessage +      : `No files found in ${config.rootDir}.\n` + +          "Make sure Jest's configuration does not exclude this directory." + +          '\nTo set up Jest, make sure a package.json file exists.\n' + +          'Jest Documentation: ' + +          'https://jestjs.io/docs/configuration'; +  }); +  let dataMessage; + +  if (globalConfig.runTestsByPath) { +    dataMessage = `Files: ${globalConfig.nonFlagArgs +      .map(p => `"${p}"`) +      .join(', ')}`; +  } else { +    dataMessage = `Pattern: ${_chalk().default.yellow( +      globalConfig.testPathPattern +    )} - 0 matches`; +  } + +  return ( +    _chalk().default.bold('No tests found, exiting with code 1') + +    '\n' + +    'Run with `--passWithNoTests` to exit with code 0' + +    '\n' + +    individualResults.join('\n') + +    '\n' + +    dataMessage +  ); +} diff --git a/node_modules/@jest/core/build/getNoTestsFoundMessage.d.ts b/node_modules/@jest/core/build/getNoTestsFoundMessage.d.ts new file mode 100644 index 0000000..910467e --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestsFoundMessage.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. + */ +import type { Config } from '@jest/types'; +import type { TestRunData } from './types'; +export default function getNoTestsFoundMessage(testRunData: TestRunData, globalConfig: Config.GlobalConfig): string; diff --git a/node_modules/@jest/core/build/getNoTestsFoundMessage.js b/node_modules/@jest/core/build/getNoTestsFoundMessage.js new file mode 100644 index 0000000..293d092 --- /dev/null +++ b/node_modules/@jest/core/build/getNoTestsFoundMessage.js @@ -0,0 +1,52 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getNoTestsFoundMessage; + +var _getNoTestFound = _interopRequireDefault(require('./getNoTestFound')); + +var _getNoTestFoundFailed = _interopRequireDefault( +  require('./getNoTestFoundFailed') +); + +var _getNoTestFoundPassWithNoTests = _interopRequireDefault( +  require('./getNoTestFoundPassWithNoTests') +); + +var _getNoTestFoundRelatedToChangedFiles = _interopRequireDefault( +  require('./getNoTestFoundRelatedToChangedFiles') +); + +var _getNoTestFoundVerbose = _interopRequireDefault( +  require('./getNoTestFoundVerbose') +); + +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. + */ +function getNoTestsFoundMessage(testRunData, globalConfig) { +  if (globalConfig.onlyFailures) { +    return (0, _getNoTestFoundFailed.default)(globalConfig); +  } + +  if (globalConfig.onlyChanged) { +    return (0, _getNoTestFoundRelatedToChangedFiles.default)(globalConfig); +  } + +  if (globalConfig.passWithNoTests) { +    return (0, _getNoTestFoundPassWithNoTests.default)(); +  } + +  return testRunData.length === 1 || globalConfig.verbose +    ? (0, _getNoTestFoundVerbose.default)(testRunData, globalConfig) +    : (0, _getNoTestFound.default)(testRunData, globalConfig); +} diff --git a/node_modules/@jest/core/build/getProjectDisplayName.d.ts b/node_modules/@jest/core/build/getProjectDisplayName.d.ts new file mode 100644 index 0000000..192e9fe --- /dev/null +++ b/node_modules/@jest/core/build/getProjectDisplayName.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 } from '@jest/types'; +export default function getProjectDisplayName(projectConfig: Config.ProjectConfig): string | undefined; diff --git a/node_modules/@jest/core/build/getProjectDisplayName.js b/node_modules/@jest/core/build/getProjectDisplayName.js new file mode 100644 index 0000000..70b7c9e --- /dev/null +++ b/node_modules/@jest/core/build/getProjectDisplayName.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getProjectDisplayName; + +/** + * 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 getProjectDisplayName(projectConfig) { +  var _projectConfig$displa; + +  return ( +    ((_projectConfig$displa = projectConfig.displayName) === null || +    _projectConfig$displa === void 0 +      ? void 0 +      : _projectConfig$displa.name) || undefined +  ); +} diff --git a/node_modules/@jest/core/build/getProjectNamesMissingWarning.d.ts b/node_modules/@jest/core/build/getProjectNamesMissingWarning.d.ts new file mode 100644 index 0000000..b2e17cf --- /dev/null +++ b/node_modules/@jest/core/build/getProjectNamesMissingWarning.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 } from '@jest/types'; +export default function getProjectNamesMissingWarning(projectConfigs: Array<Config.ProjectConfig>): string | undefined; diff --git a/node_modules/@jest/core/build/getProjectNamesMissingWarning.js b/node_modules/@jest/core/build/getProjectNamesMissingWarning.js new file mode 100644 index 0000000..32ac1e1 --- /dev/null +++ b/node_modules/@jest/core/build/getProjectNamesMissingWarning.js @@ -0,0 +1,49 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getProjectNamesMissingWarning; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +var _getProjectDisplayName = _interopRequireDefault( +  require('./getProjectDisplayName') +); + +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. + */ +function getProjectNamesMissingWarning(projectConfigs) { +  const numberOfProjectsWithoutAName = projectConfigs.filter( +    config => !(0, _getProjectDisplayName.default)(config) +  ).length; + +  if (numberOfProjectsWithoutAName === 0) { +    return undefined; +  } + +  return _chalk().default.yellow( +    `You provided values for --selectProjects but ${ +      numberOfProjectsWithoutAName === 1 +        ? 'a project does not have a name' +        : `${numberOfProjectsWithoutAName} projects do not have a name` +    }.\n` + +      'Set displayName in the config of all projects in order to disable this warning.\n' +  ); +} diff --git a/node_modules/@jest/core/build/getSelectProjectsMessage.d.ts b/node_modules/@jest/core/build/getSelectProjectsMessage.d.ts new file mode 100644 index 0000000..21a4cd2 --- /dev/null +++ b/node_modules/@jest/core/build/getSelectProjectsMessage.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 } from '@jest/types'; +export default function getSelectProjectsMessage(projectConfigs: Array<Config.ProjectConfig>): string; diff --git a/node_modules/@jest/core/build/getSelectProjectsMessage.js b/node_modules/@jest/core/build/getSelectProjectsMessage.js new file mode 100644 index 0000000..5607f69 --- /dev/null +++ b/node_modules/@jest/core/build/getSelectProjectsMessage.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getSelectProjectsMessage; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +var _getProjectDisplayName = _interopRequireDefault( +  require('./getProjectDisplayName') +); + +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. + */ +function getSelectProjectsMessage(projectConfigs) { +  if (projectConfigs.length === 0) { +    return getNoSelectionWarning(); +  } + +  return getProjectsRunningMessage(projectConfigs); +} + +function getNoSelectionWarning() { +  return _chalk().default.yellow( +    'You provided values for --selectProjects but no projects were found matching the selection.\n' +  ); +} + +function getProjectsRunningMessage(projectConfigs) { +  if (projectConfigs.length === 1) { +    const name = (0, _getProjectDisplayName.default)(projectConfigs[0]); +    return `Running one project: ${_chalk().default.bold(name)}\n`; +  } + +  const projectsList = projectConfigs +    .map(getProjectNameListElement) +    .sort() +    .join('\n'); +  return `Running ${projectConfigs.length} projects:\n${projectsList}\n`; +} + +function getProjectNameListElement(projectConfig) { +  const name = (0, _getProjectDisplayName.default)(projectConfig); +  const elementContent = name +    ? _chalk().default.bold(name) +    : '<unnamed project>'; +  return `- ${elementContent}`; +} diff --git a/node_modules/@jest/core/build/jest.d.ts b/node_modules/@jest/core/build/jest.d.ts new file mode 100644 index 0000000..58b0335 --- /dev/null +++ b/node_modules/@jest/core/build/jest.d.ts @@ -0,0 +1,11 @@ +/** + * 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 as SearchSource } from './SearchSource'; +export { createTestScheduler } from './TestScheduler'; +export { default as TestWatcher } from './TestWatcher'; +export { runCLI } from './cli'; +export { default as getVersion } from './version'; diff --git a/node_modules/@jest/core/build/jest.js b/node_modules/@jest/core/build/jest.js new file mode 100644 index 0000000..d320303 --- /dev/null +++ b/node_modules/@jest/core/build/jest.js @@ -0,0 +1,49 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +Object.defineProperty(exports, 'SearchSource', { +  enumerable: true, +  get: function () { +    return _SearchSource.default; +  } +}); +Object.defineProperty(exports, 'TestWatcher', { +  enumerable: true, +  get: function () { +    return _TestWatcher.default; +  } +}); +Object.defineProperty(exports, 'createTestScheduler', { +  enumerable: true, +  get: function () { +    return _TestScheduler.createTestScheduler; +  } +}); +Object.defineProperty(exports, 'getVersion', { +  enumerable: true, +  get: function () { +    return _version.default; +  } +}); +Object.defineProperty(exports, 'runCLI', { +  enumerable: true, +  get: function () { +    return _cli.runCLI; +  } +}); + +var _SearchSource = _interopRequireDefault(require('./SearchSource')); + +var _TestScheduler = require('./TestScheduler'); + +var _TestWatcher = _interopRequireDefault(require('./TestWatcher')); + +var _cli = require('./cli'); + +var _version = _interopRequireDefault(require('./version')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/core/build/lib/activeFiltersMessage.d.ts b/node_modules/@jest/core/build/lib/activeFiltersMessage.d.ts new file mode 100644 index 0000000..15f595a --- /dev/null +++ b/node_modules/@jest/core/build/lib/activeFiltersMessage.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. + */ +import type { Config } from '@jest/types'; +declare const activeFilters: (globalConfig: Config.GlobalConfig, delimiter?: string) => string; +export default activeFilters; diff --git a/node_modules/@jest/core/build/lib/activeFiltersMessage.js b/node_modules/@jest/core/build/lib/activeFiltersMessage.js new file mode 100644 index 0000000..ff63332 --- /dev/null +++ b/node_modules/@jest/core/build/lib/activeFiltersMessage.js @@ -0,0 +1,54 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +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 activeFilters = (globalConfig, delimiter = '\n') => { +  const {testNamePattern, testPathPattern} = globalConfig; + +  if (testNamePattern || testPathPattern) { +    const filters = [ +      testPathPattern +        ? _chalk().default.dim('filename ') + +          _chalk().default.yellow('/' + testPathPattern + '/') +        : null, +      testNamePattern +        ? _chalk().default.dim('test name ') + +          _chalk().default.yellow('/' + testNamePattern + '/') +        : null +    ] +      .filter(f => f) +      .join(', '); +    const messages = [ +      '\n' + _chalk().default.bold('Active Filters: ') + filters +    ]; +    return messages.filter(message => !!message).join(delimiter); +  } + +  return ''; +}; + +var _default = activeFilters; +exports.default = _default; diff --git a/node_modules/@jest/core/build/lib/createContext.d.ts b/node_modules/@jest/core/build/lib/createContext.d.ts new file mode 100644 index 0000000..c98a3ef --- /dev/null +++ b/node_modules/@jest/core/build/lib/createContext.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 type { Config } from '@jest/types'; +import type { HasteMapObject } from 'jest-haste-map'; +import { Context } from 'jest-runtime'; +export default function createContext(config: Config.ProjectConfig, { hasteFS, moduleMap }: HasteMapObject): Context; diff --git a/node_modules/@jest/core/build/lib/createContext.js b/node_modules/@jest/core/build/lib/createContext.js new file mode 100644 index 0000000..b360e9c --- /dev/null +++ b/node_modules/@jest/core/build/lib/createContext.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = createContext; + +function _jestRuntime() { +  const data = _interopRequireDefault(require('jest-runtime')); + +  _jestRuntime = function () { +    return data; +  }; + +  return data; +} + +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. + */ +function createContext(config, {hasteFS, moduleMap}) { +  return { +    config, +    hasteFS, +    moduleMap, +    resolver: _jestRuntime().default.createResolver(config, moduleMap) +  }; +} diff --git a/node_modules/@jest/core/build/lib/handleDeprecationWarnings.d.ts b/node_modules/@jest/core/build/lib/handleDeprecationWarnings.d.ts new file mode 100644 index 0000000..8d2151e --- /dev/null +++ b/node_modules/@jest/core/build/lib/handleDeprecationWarnings.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. + */ +/// <reference types="node" /> +export default function handleDeprecationWarnings(pipe: NodeJS.WriteStream, stdin?: NodeJS.ReadStream): Promise<void>; diff --git a/node_modules/@jest/core/build/lib/handleDeprecationWarnings.js b/node_modules/@jest/core/build/lib/handleDeprecationWarnings.js new file mode 100644 index 0000000..f0a15d6 --- /dev/null +++ b/node_modules/@jest/core/build/lib/handleDeprecationWarnings.js @@ -0,0 +1,72 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = handleDeprecationWarnings; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +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. + */ +function handleDeprecationWarnings(pipe, stdin = process.stdin) { +  return new Promise((resolve, reject) => { +    if (typeof stdin.setRawMode === 'function') { +      const messages = [ +        _chalk().default.red('There are deprecation warnings.\n'), +        _chalk().default.dim(' \u203A Press ') + +          'Enter' + +          _chalk().default.dim(' to continue.'), +        _chalk().default.dim(' \u203A Press ') + +          'Esc' + +          _chalk().default.dim(' to exit.') +      ]; +      pipe.write(messages.join('\n')); +      stdin.setRawMode(true); +      stdin.resume(); +      stdin.setEncoding('utf8'); // this is a string since we set encoding above + +      stdin.on('data', key => { +        if (key === _jestWatcher().KEYS.ENTER) { +          resolve(); +        } else if ( +          [ +            _jestWatcher().KEYS.ESCAPE, +            _jestWatcher().KEYS.CONTROL_C, +            _jestWatcher().KEYS.CONTROL_D +          ].indexOf(key) !== -1 +        ) { +          reject(); +        } +      }); +    } else { +      resolve(); +    } +  }); +} diff --git a/node_modules/@jest/core/build/lib/isValidPath.d.ts b/node_modules/@jest/core/build/lib/isValidPath.d.ts new file mode 100644 index 0000000..d81880a --- /dev/null +++ b/node_modules/@jest/core/build/lib/isValidPath.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 } from '@jest/types'; +export default function isValidPath(globalConfig: Config.GlobalConfig, filePath: Config.Path): boolean; diff --git a/node_modules/@jest/core/build/lib/isValidPath.js b/node_modules/@jest/core/build/lib/isValidPath.js new file mode 100644 index 0000000..10971d3 --- /dev/null +++ b/node_modules/@jest/core/build/lib/isValidPath.js @@ -0,0 +1,29 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = isValidPath; + +function _jestSnapshot() { +  const data = require('jest-snapshot'); + +  _jestSnapshot = function () { +    return data; +  }; + +  return data; +} + +/** + * 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 isValidPath(globalConfig, filePath) { +  return ( +    !filePath.includes(globalConfig.coverageDirectory) && +    !(0, _jestSnapshot().isSnapshotPath)(filePath) +  ); +} diff --git a/node_modules/@jest/core/build/lib/logDebugMessages.d.ts b/node_modules/@jest/core/build/lib/logDebugMessages.d.ts new file mode 100644 index 0000000..b312cd9 --- /dev/null +++ b/node_modules/@jest/core/build/lib/logDebugMessages.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. + */ +/// <reference types="node" /> +import type { Config } from '@jest/types'; +export default function logDebugMessages(globalConfig: Config.GlobalConfig, configs: Array<Config.ProjectConfig> | Config.ProjectConfig, outputStream: NodeJS.WriteStream): void; diff --git a/node_modules/@jest/core/build/lib/logDebugMessages.js b/node_modules/@jest/core/build/lib/logDebugMessages.js new file mode 100644 index 0000000..9c1f2f5 --- /dev/null +++ b/node_modules/@jest/core/build/lib/logDebugMessages.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = logDebugMessages; + +/** + * 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 VERSION = require('../../package.json').version; // if the output here changes, update `getConfig` in e2e/runJest.ts + +function logDebugMessages(globalConfig, configs, outputStream) { +  const output = { +    configs, +    globalConfig, +    version: VERSION +  }; +  outputStream.write(JSON.stringify(output, null, '  ') + '\n'); +} diff --git a/node_modules/@jest/core/build/lib/updateGlobalConfig.d.ts b/node_modules/@jest/core/build/lib/updateGlobalConfig.d.ts new file mode 100644 index 0000000..8282936 --- /dev/null +++ b/node_modules/@jest/core/build/lib/updateGlobalConfig.d.ts @@ -0,0 +1,11 @@ +/** + * 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 type { AllowedConfigOptions } from 'jest-watcher'; +declare type ExtraConfigOptions = Partial<Pick<Config.GlobalConfig, 'noSCM' | 'passWithNoTests'>>; +export default function updateGlobalConfig(globalConfig: Config.GlobalConfig, options?: AllowedConfigOptions & ExtraConfigOptions): Config.GlobalConfig; +export {}; diff --git a/node_modules/@jest/core/build/lib/updateGlobalConfig.js b/node_modules/@jest/core/build/lib/updateGlobalConfig.js new file mode 100644 index 0000000..5c49586 --- /dev/null +++ b/node_modules/@jest/core/build/lib/updateGlobalConfig.js @@ -0,0 +1,121 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = updateGlobalConfig; + +function _jestRegexUtil() { +  const data = require('jest-regex-util'); + +  _jestRegexUtil = function () { +    return data; +  }; + +  return data; +} + +/** + * 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 updateGlobalConfig(globalConfig, options = {}) { +  const newConfig = {...globalConfig}; + +  if (options.mode === 'watch') { +    newConfig.watch = true; +    newConfig.watchAll = false; +  } else if (options.mode === 'watchAll') { +    newConfig.watch = false; +    newConfig.watchAll = true; +  } + +  if (options.testNamePattern !== undefined) { +    newConfig.testNamePattern = options.testNamePattern || ''; +  } + +  if (options.testPathPattern !== undefined) { +    newConfig.testPathPattern = +      (0, _jestRegexUtil().replacePathSepForRegex)(options.testPathPattern) || +      ''; +  } + +  newConfig.onlyChanged = +    !newConfig.watchAll && +    !newConfig.testNamePattern && +    !newConfig.testPathPattern; + +  if (typeof options.bail === 'boolean') { +    newConfig.bail = options.bail ? 1 : 0; +  } else if (options.bail !== undefined) { +    newConfig.bail = options.bail; +  } + +  if (options.changedSince !== undefined) { +    newConfig.changedSince = options.changedSince; +  } + +  if (options.collectCoverage !== undefined) { +    newConfig.collectCoverage = options.collectCoverage || false; +  } + +  if (options.collectCoverageFrom !== undefined) { +    newConfig.collectCoverageFrom = options.collectCoverageFrom; +  } + +  if (options.collectCoverageOnlyFrom !== undefined) { +    newConfig.collectCoverageOnlyFrom = options.collectCoverageOnlyFrom; +  } + +  if (options.coverageDirectory !== undefined) { +    newConfig.coverageDirectory = options.coverageDirectory; +  } + +  if (options.coverageReporters !== undefined) { +    newConfig.coverageReporters = options.coverageReporters; +  } + +  if (options.findRelatedTests !== undefined) { +    newConfig.findRelatedTests = options.findRelatedTests; +  } + +  if (options.nonFlagArgs !== undefined) { +    newConfig.nonFlagArgs = options.nonFlagArgs; +  } + +  if (options.noSCM) { +    newConfig.noSCM = true; +  } + +  if (options.notify !== undefined) { +    newConfig.notify = options.notify || false; +  } + +  if (options.notifyMode !== undefined) { +    newConfig.notifyMode = options.notifyMode; +  } + +  if (options.onlyFailures !== undefined) { +    newConfig.onlyFailures = options.onlyFailures || false; +  } + +  if (options.passWithNoTests !== undefined) { +    newConfig.passWithNoTests = true; +  } + +  if (options.reporters !== undefined) { +    newConfig.reporters = options.reporters; +  } + +  if (options.updateSnapshot !== undefined) { +    newConfig.updateSnapshot = options.updateSnapshot; +  } + +  if (options.verbose !== undefined) { +    newConfig.verbose = options.verbose || false; +  } + +  return Object.freeze(newConfig); +} diff --git a/node_modules/@jest/core/build/lib/watchPluginsHelpers.d.ts b/node_modules/@jest/core/build/lib/watchPluginsHelpers.d.ts new file mode 100644 index 0000000..99e8d7f --- /dev/null +++ b/node_modules/@jest/core/build/lib/watchPluginsHelpers.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 type { Config } from '@jest/types'; +import type { UsageData, WatchPlugin } from 'jest-watcher'; +export declare const filterInteractivePlugins: (watchPlugins: Array<WatchPlugin>, globalConfig: Config.GlobalConfig) => Array<WatchPlugin>; +export declare const getSortedUsageRows: (watchPlugins: Array<WatchPlugin>, globalConfig: Config.GlobalConfig) => Array<UsageData>; diff --git a/node_modules/@jest/core/build/lib/watchPluginsHelpers.js b/node_modules/@jest/core/build/lib/watchPluginsHelpers.js new file mode 100644 index 0000000..9f595ce --- /dev/null +++ b/node_modules/@jest/core/build/lib/watchPluginsHelpers.js @@ -0,0 +1,62 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.getSortedUsageRows = exports.filterInteractivePlugins = 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. + */ +const filterInteractivePlugins = (watchPlugins, globalConfig) => { +  const usageInfos = watchPlugins.map( +    p => p.getUsageInfo && p.getUsageInfo(globalConfig) +  ); +  return watchPlugins.filter((_plugin, i) => { +    const usageInfo = usageInfos[i]; + +    if (usageInfo) { +      const {key} = usageInfo; +      return !usageInfos.slice(i + 1).some(u => !!u && key === u.key); +    } + +    return false; +  }); +}; + +exports.filterInteractivePlugins = filterInteractivePlugins; + +function notEmpty(value) { +  return value != null; +} + +const getSortedUsageRows = (watchPlugins, globalConfig) => +  filterInteractivePlugins(watchPlugins, globalConfig) +    .sort((a, b) => { +      if (a.isInternal && b.isInternal) { +        // internal plugins in the order we specify them +        return 0; +      } + +      if (a.isInternal !== b.isInternal) { +        // external plugins afterwards +        return a.isInternal ? -1 : 1; +      } + +      const usageInfoA = a.getUsageInfo && a.getUsageInfo(globalConfig); +      const usageInfoB = b.getUsageInfo && b.getUsageInfo(globalConfig); + +      if (usageInfoA && usageInfoB) { +        // external plugins in alphabetical order +        return usageInfoA.key.localeCompare(usageInfoB.key); +      } + +      return 0; +    }) +    .map(p => p.getUsageInfo && p.getUsageInfo(globalConfig)) +    .filter(notEmpty); + +exports.getSortedUsageRows = getSortedUsageRows; diff --git a/node_modules/@jest/core/build/plugins/FailedTestsInteractive.d.ts b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.d.ts new file mode 100644 index 0000000..d696181 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.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. + */ +import type { Config } from '@jest/types'; +import { BaseWatchPlugin, JestHookSubscriber, UpdateConfigCallback, UsageData } from 'jest-watcher'; +export default class FailedTestsInteractivePlugin extends BaseWatchPlugin { +    private _failedTestAssertions?; +    private readonly _manager; +    apply(hooks: JestHookSubscriber): void; +    getUsageInfo(): UsageData | null; +    onKey(key: string): void; +    run(_: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>; +    private getFailedTestAssertions; +} diff --git a/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js new file mode 100644 index 0000000..a830abe --- /dev/null +++ b/node_modules/@jest/core/build/plugins/FailedTestsInteractive.js @@ -0,0 +1,135 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +var _FailedTestsInteractiveMode = _interopRequireDefault( +  require('../FailedTestsInteractiveMode') +); + +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 FailedTestsInteractivePlugin extends _jestWatcher().BaseWatchPlugin { +  constructor(...args) { +    super(...args); + +    _defineProperty(this, '_failedTestAssertions', void 0); + +    _defineProperty( +      this, +      '_manager', +      new _FailedTestsInteractiveMode.default(this._stdout) +    ); +  } + +  apply(hooks) { +    hooks.onTestRunComplete(results => { +      this._failedTestAssertions = this.getFailedTestAssertions(results); +      if (this._manager.isActive()) this._manager.updateWithResults(results); +    }); +  } + +  getUsageInfo() { +    var _this$_failedTestAsse; + +    if ( +      (_this$_failedTestAsse = this._failedTestAssertions) !== null && +      _this$_failedTestAsse !== void 0 && +      _this$_failedTestAsse.length +    ) { +      return { +        key: 'i', +        prompt: 'run failing tests interactively' +      }; +    } + +    return null; +  } + +  onKey(key) { +    if (this._manager.isActive()) { +      this._manager.put(key); +    } +  } + +  run(_, updateConfigAndRun) { +    return new Promise(resolve => { +      if ( +        !this._failedTestAssertions || +        this._failedTestAssertions.length === 0 +      ) { +        resolve(); +        return; +      } + +      this._manager.run(this._failedTestAssertions, failure => { +        updateConfigAndRun({ +          mode: 'watch', +          testNamePattern: failure ? `^${failure.fullName}$` : '', +          testPathPattern: +            (failure === null || failure === void 0 ? void 0 : failure.path) || +            '' +        }); + +        if (!this._manager.isActive()) { +          resolve(); +        } +      }); +    }); +  } + +  getFailedTestAssertions(results) { +    const failedTestPaths = []; + +    if ( +      // skip if no failed tests +      results.numFailedTests === 0 || // skip if missing test results +      !results.testResults || // skip if unmatched snapshots are present +      results.snapshot.unmatched +    ) { +      return failedTestPaths; +    } + +    results.testResults.forEach(testResult => { +      testResult.testResults.forEach(result => { +        if (result.status === 'failed') { +          failedTestPaths.push({ +            fullName: result.fullName, +            path: testResult.testFilePath +          }); +        } +      }); +    }); +    return failedTestPaths; +  } +} + +exports.default = FailedTestsInteractivePlugin; diff --git a/node_modules/@jest/core/build/plugins/Quit.d.ts b/node_modules/@jest/core/build/plugins/Quit.d.ts new file mode 100644 index 0000000..e865612 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/Quit.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. + */ +/// <reference types="node" /> +import { BaseWatchPlugin, UsageData } from 'jest-watcher'; +declare class QuitPlugin extends BaseWatchPlugin { +    isInternal: true; +    constructor(options: { +        stdin: NodeJS.ReadStream; +        stdout: NodeJS.WriteStream; +    }); +    run(): Promise<void>; +    getUsageInfo(): UsageData; +} +export default QuitPlugin; diff --git a/node_modules/@jest/core/build/plugins/Quit.js b/node_modules/@jest/core/build/plugins/Quit.js new file mode 100644 index 0000000..e643a2b --- /dev/null +++ b/node_modules/@jest/core/build/plugins/Quit.js @@ -0,0 +1,60 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +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 QuitPlugin extends _jestWatcher().BaseWatchPlugin { +  constructor(options) { +    super(options); + +    _defineProperty(this, 'isInternal', void 0); + +    this.isInternal = true; +  } + +  async run() { +    if (typeof this._stdin.setRawMode === 'function') { +      this._stdin.setRawMode(false); +    } + +    this._stdout.write('\n'); + +    process.exit(0); +  } + +  getUsageInfo() { +    return { +      key: 'q', +      prompt: 'quit watch mode' +    }; +  } +} + +var _default = QuitPlugin; +exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/TestNamePattern.d.ts b/node_modules/@jest/core/build/plugins/TestNamePattern.d.ts new file mode 100644 index 0000000..dc0409a --- /dev/null +++ b/node_modules/@jest/core/build/plugins/TestNamePattern.d.ts @@ -0,0 +1,21 @@ +/** + * 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 { Config } from '@jest/types'; +import { BaseWatchPlugin, Prompt, UpdateConfigCallback, UsageData } from 'jest-watcher'; +declare class TestNamePatternPlugin extends BaseWatchPlugin { +    _prompt: Prompt; +    isInternal: true; +    constructor(options: { +        stdin: NodeJS.ReadStream; +        stdout: NodeJS.WriteStream; +    }); +    getUsageInfo(): UsageData; +    onKey(key: string): void; +    run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>; +} +export default TestNamePatternPlugin; diff --git a/node_modules/@jest/core/build/plugins/TestNamePattern.js b/node_modules/@jest/core/build/plugins/TestNamePattern.js new file mode 100644 index 0000000..ac60851 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/TestNamePattern.js @@ -0,0 +1,91 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +var _TestNamePatternPrompt = _interopRequireDefault( +  require('../TestNamePatternPrompt') +); + +var _activeFiltersMessage = _interopRequireDefault( +  require('../lib/activeFiltersMessage') +); + +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 TestNamePatternPlugin extends _jestWatcher().BaseWatchPlugin { +  constructor(options) { +    super(options); + +    _defineProperty(this, '_prompt', void 0); + +    _defineProperty(this, 'isInternal', void 0); + +    this._prompt = new (_jestWatcher().Prompt)(); +    this.isInternal = true; +  } + +  getUsageInfo() { +    return { +      key: 't', +      prompt: 'filter by a test name regex pattern' +    }; +  } + +  onKey(key) { +    this._prompt.put(key); +  } + +  run(globalConfig, updateConfigAndRun) { +    return new Promise((res, rej) => { +      const testNamePatternPrompt = new _TestNamePatternPrompt.default( +        this._stdout, +        this._prompt +      ); +      testNamePatternPrompt.run( +        value => { +          updateConfigAndRun({ +            mode: 'watch', +            testNamePattern: value +          }); +          res(); +        }, +        rej, +        { +          header: (0, _activeFiltersMessage.default)(globalConfig) +        } +      ); +    }); +  } +} + +var _default = TestNamePatternPlugin; +exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/TestPathPattern.d.ts b/node_modules/@jest/core/build/plugins/TestPathPattern.d.ts new file mode 100644 index 0000000..9eefab9 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/TestPathPattern.d.ts @@ -0,0 +1,21 @@ +/** + * 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 { Config } from '@jest/types'; +import { BaseWatchPlugin, UpdateConfigCallback, UsageData } from 'jest-watcher'; +declare class TestPathPatternPlugin extends BaseWatchPlugin { +    private _prompt; +    isInternal: true; +    constructor(options: { +        stdin: NodeJS.ReadStream; +        stdout: NodeJS.WriteStream; +    }); +    getUsageInfo(): UsageData; +    onKey(key: string): void; +    run(globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<void>; +} +export default TestPathPatternPlugin; diff --git a/node_modules/@jest/core/build/plugins/TestPathPattern.js b/node_modules/@jest/core/build/plugins/TestPathPattern.js new file mode 100644 index 0000000..5c5c4b7 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/TestPathPattern.js @@ -0,0 +1,91 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +var _TestPathPatternPrompt = _interopRequireDefault( +  require('../TestPathPatternPrompt') +); + +var _activeFiltersMessage = _interopRequireDefault( +  require('../lib/activeFiltersMessage') +); + +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 TestPathPatternPlugin extends _jestWatcher().BaseWatchPlugin { +  constructor(options) { +    super(options); + +    _defineProperty(this, '_prompt', void 0); + +    _defineProperty(this, 'isInternal', void 0); + +    this._prompt = new (_jestWatcher().Prompt)(); +    this.isInternal = true; +  } + +  getUsageInfo() { +    return { +      key: 'p', +      prompt: 'filter by a filename regex pattern' +    }; +  } + +  onKey(key) { +    this._prompt.put(key); +  } + +  run(globalConfig, updateConfigAndRun) { +    return new Promise((res, rej) => { +      const testPathPatternPrompt = new _TestPathPatternPrompt.default( +        this._stdout, +        this._prompt +      ); +      testPathPatternPrompt.run( +        value => { +          updateConfigAndRun({ +            mode: 'watch', +            testPathPattern: value +          }); +          res(); +        }, +        rej, +        { +          header: (0, _activeFiltersMessage.default)(globalConfig) +        } +      ); +    }); +  } +} + +var _default = TestPathPatternPlugin; +exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshots.d.ts b/node_modules/@jest/core/build/plugins/UpdateSnapshots.d.ts new file mode 100644 index 0000000..3eff4c2 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/UpdateSnapshots.d.ts @@ -0,0 +1,21 @@ +/** + * 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 { Config } from '@jest/types'; +import { BaseWatchPlugin, JestHookSubscriber, UpdateConfigCallback, UsageData } from 'jest-watcher'; +declare class UpdateSnapshotsPlugin extends BaseWatchPlugin { +    private _hasSnapshotFailure; +    isInternal: true; +    constructor(options: { +        stdin: NodeJS.ReadStream; +        stdout: NodeJS.WriteStream; +    }); +    run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback): Promise<boolean>; +    apply(hooks: JestHookSubscriber): void; +    getUsageInfo(): UsageData | null; +} +export default UpdateSnapshotsPlugin; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshots.js b/node_modules/@jest/core/build/plugins/UpdateSnapshots.js new file mode 100644 index 0000000..c2a9de7 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/UpdateSnapshots.js @@ -0,0 +1,70 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +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 UpdateSnapshotsPlugin extends _jestWatcher().BaseWatchPlugin { +  constructor(options) { +    super(options); + +    _defineProperty(this, '_hasSnapshotFailure', void 0); + +    _defineProperty(this, 'isInternal', void 0); + +    this.isInternal = true; +    this._hasSnapshotFailure = false; +  } + +  run(_globalConfig, updateConfigAndRun) { +    updateConfigAndRun({ +      updateSnapshot: 'all' +    }); +    return Promise.resolve(false); +  } + +  apply(hooks) { +    hooks.onTestRunComplete(results => { +      this._hasSnapshotFailure = results.snapshot.failure; +    }); +  } + +  getUsageInfo() { +    if (this._hasSnapshotFailure) { +      return { +        key: 'u', +        prompt: 'update failing snapshots' +      }; +    } + +    return null; +  } +} + +var _default = UpdateSnapshotsPlugin; +exports.default = _default; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.d.ts b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.d.ts new file mode 100644 index 0000000..c6a60e6 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.d.ts @@ -0,0 +1,20 @@ +/** + * 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 { AggregatedResult, AssertionLocation } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import { BaseWatchPlugin, JestHookSubscriber, UsageData } from 'jest-watcher'; +declare class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin { +    private _snapshotInteractiveMode; +    private _failedSnapshotTestAssertions; +    isInternal: true; +    getFailedSnapshotTestAssertions(testResults: AggregatedResult): Array<AssertionLocation>; +    apply(hooks: JestHookSubscriber): void; +    onKey(key: string): void; +    run(_globalConfig: Config.GlobalConfig, updateConfigAndRun: Function): Promise<void>; +    getUsageInfo(): UsageData | null; +} +export default UpdateSnapshotInteractivePlugin; diff --git a/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js new file mode 100644 index 0000000..5346bc3 --- /dev/null +++ b/node_modules/@jest/core/build/plugins/UpdateSnapshotsInteractive.js @@ -0,0 +1,138 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +var _SnapshotInteractiveMode = _interopRequireDefault( +  require('../SnapshotInteractiveMode') +); + +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 UpdateSnapshotInteractivePlugin extends _jestWatcher().BaseWatchPlugin { +  constructor(...args) { +    super(...args); + +    _defineProperty( +      this, +      '_snapshotInteractiveMode', +      new _SnapshotInteractiveMode.default(this._stdout) +    ); + +    _defineProperty(this, '_failedSnapshotTestAssertions', []); + +    _defineProperty(this, 'isInternal', true); +  } + +  getFailedSnapshotTestAssertions(testResults) { +    const failedTestPaths = []; + +    if (testResults.numFailedTests === 0 || !testResults.testResults) { +      return failedTestPaths; +    } + +    testResults.testResults.forEach(testResult => { +      if (testResult.snapshot && testResult.snapshot.unmatched) { +        testResult.testResults.forEach(result => { +          if (result.status === 'failed') { +            failedTestPaths.push({ +              fullName: result.fullName, +              path: testResult.testFilePath +            }); +          } +        }); +      } +    }); +    return failedTestPaths; +  } + +  apply(hooks) { +    hooks.onTestRunComplete(results => { +      this._failedSnapshotTestAssertions = +        this.getFailedSnapshotTestAssertions(results); + +      if (this._snapshotInteractiveMode.isActive()) { +        this._snapshotInteractiveMode.updateWithResults(results); +      } +    }); +  } + +  onKey(key) { +    if (this._snapshotInteractiveMode.isActive()) { +      this._snapshotInteractiveMode.put(key); +    } +  } + +  run(_globalConfig, updateConfigAndRun) { +    if (this._failedSnapshotTestAssertions.length) { +      return new Promise(res => { +        this._snapshotInteractiveMode.run( +          this._failedSnapshotTestAssertions, +          (assertion, shouldUpdateSnapshot) => { +            updateConfigAndRun({ +              mode: 'watch', +              testNamePattern: assertion ? `^${assertion.fullName}$` : '', +              testPathPattern: assertion ? assertion.path : '', +              updateSnapshot: shouldUpdateSnapshot ? 'all' : 'none' +            }); + +            if (!this._snapshotInteractiveMode.isActive()) { +              res(); +            } +          } +        ); +      }); +    } else { +      return Promise.resolve(); +    } +  } + +  getUsageInfo() { +    var _this$_failedSnapshot; + +    if ( +      ((_this$_failedSnapshot = this._failedSnapshotTestAssertions) === null || +      _this$_failedSnapshot === void 0 +        ? void 0 +        : _this$_failedSnapshot.length) > 0 +    ) { +      return { +        key: 'i', +        prompt: 'update failing snapshots interactively' +      }; +    } + +    return null; +  } +} + +var _default = UpdateSnapshotInteractivePlugin; +exports.default = _default; diff --git a/node_modules/@jest/core/build/pluralize.d.ts b/node_modules/@jest/core/build/pluralize.d.ts new file mode 100644 index 0000000..a4e01ce --- /dev/null +++ b/node_modules/@jest/core/build/pluralize.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 pluralize(word: string, count: number, ending: string): string; diff --git a/node_modules/@jest/core/build/pluralize.js b/node_modules/@jest/core/build/pluralize.js new file mode 100644 index 0000000..08695e5 --- /dev/null +++ b/node_modules/@jest/core/build/pluralize.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = pluralize; + +/** + * 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 pluralize(word, count, ending) { +  return `${count} ${word}${count === 1 ? '' : ending}`; +} diff --git a/node_modules/@jest/core/build/runGlobalHook.d.ts b/node_modules/@jest/core/build/runGlobalHook.d.ts new file mode 100644 index 0000000..726baf0 --- /dev/null +++ b/node_modules/@jest/core/build/runGlobalHook.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 { Test } from '@jest/test-result'; +import type { Config } from '@jest/types'; +export default function runGlobalHook({ allTests, globalConfig, moduleName, }: { +    allTests: Array<Test>; +    globalConfig: Config.GlobalConfig; +    moduleName: 'globalSetup' | 'globalTeardown'; +}): Promise<void>; diff --git a/node_modules/@jest/core/build/runGlobalHook.js b/node_modules/@jest/core/build/runGlobalHook.js new file mode 100644 index 0000000..c4ebdbd --- /dev/null +++ b/node_modules/@jest/core/build/runGlobalHook.js @@ -0,0 +1,143 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = runGlobalHook; + +function util() { +  const data = _interopRequireWildcard(require('util')); + +  util = function () { +    return data; +  }; + +  return data; +} + +function _transform() { +  const data = require('@jest/transform'); + +  _transform = function () { +    return data; +  }; + +  return data; +} + +function _prettyFormat() { +  const data = _interopRequireDefault(require('pretty-format')); + +  _prettyFormat = function () { +    return data; +  }; + +  return data; +} + +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. + */ +async function runGlobalHook({allTests, globalConfig, moduleName}) { +  const globalModulePaths = new Set( +    allTests.map(test => test.context.config[moduleName]) +  ); + +  if (globalConfig[moduleName]) { +    globalModulePaths.add(globalConfig[moduleName]); +  } + +  if (globalModulePaths.size > 0) { +    for (const modulePath of globalModulePaths) { +      if (!modulePath) { +        continue; +      } + +      const correctConfig = allTests.find( +        t => t.context.config[moduleName] === modulePath +      ); +      const projectConfig = correctConfig +        ? correctConfig.context.config // Fallback to first config +        : allTests[0].context.config; +      const transformer = await (0, _transform().createScriptTransformer)( +        projectConfig +      ); + +      try { +        await transformer.requireAndTranspileModule( +          modulePath, +          async globalModule => { +            if (typeof globalModule !== 'function') { +              throw new TypeError( +                `${moduleName} file must export a function at ${modulePath}` +              ); +            } + +            await globalModule(globalConfig); +          } +        ); +      } catch (error) { +        if (util().types.isNativeError(error)) { +          error.message = `Jest: Got error running ${moduleName} - ${modulePath}, reason: ${error.message}`; +          throw error; +        } + +        throw new Error( +          `Jest: Got error running ${moduleName} - ${modulePath}, reason: ${(0, +          _prettyFormat().default)(error, { +            maxDepth: 3 +          })}` +        ); +      } +    } +  } +} diff --git a/node_modules/@jest/core/build/runJest.d.ts b/node_modules/@jest/core/build/runJest.d.ts new file mode 100644 index 0000000..9a8240b --- /dev/null +++ b/node_modules/@jest/core/build/runJest.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. + */ +/// <reference types="node" /> +import { AggregatedResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type { ChangedFilesPromise } from 'jest-changed-files'; +import type { Context } from 'jest-runtime'; +import { JestHookEmitter } from 'jest-watcher'; +import type FailedTestsCache from './FailedTestsCache'; +import type TestWatcher from './TestWatcher'; +import type { Filter } from './types'; +export default function runJest({ contexts, globalConfig, outputStream, testWatcher, jestHooks, startRun, changedFilesPromise, onComplete, failedTestsCache, filter, }: { +    globalConfig: Config.GlobalConfig; +    contexts: Array<Context>; +    outputStream: NodeJS.WriteStream; +    testWatcher: TestWatcher; +    jestHooks?: JestHookEmitter; +    startRun: (globalConfig: Config.GlobalConfig) => void; +    changedFilesPromise?: ChangedFilesPromise; +    onComplete: (testResults: AggregatedResult) => void; +    failedTestsCache?: FailedTestsCache; +    filter?: Filter; +}): Promise<void>; diff --git a/node_modules/@jest/core/build/runJest.js b/node_modules/@jest/core/build/runJest.js new file mode 100644 index 0000000..24b40ac --- /dev/null +++ b/node_modules/@jest/core/build/runJest.js @@ -0,0 +1,423 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = runJest; + +function path() { +  const data = _interopRequireWildcard(require('path')); + +  path = function () { +    return data; +  }; + +  return data; +} + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _exit() { +  const data = _interopRequireDefault(require('exit')); + +  _exit = function () { +    return data; +  }; + +  return data; +} + +function fs() { +  const data = _interopRequireWildcard(require('graceful-fs')); + +  fs = function () { +    return data; +  }; + +  return data; +} + +function _console() { +  const data = require('@jest/console'); + +  _console = function () { +    return data; +  }; + +  return data; +} + +function _testResult() { +  const data = require('@jest/test-result'); + +  _testResult = function () { +    return data; +  }; + +  return data; +} + +function _jestResolve() { +  const data = _interopRequireDefault(require('jest-resolve')); + +  _jestResolve = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +var _SearchSource = _interopRequireDefault(require('./SearchSource')); + +var _TestScheduler = require('./TestScheduler'); + +var _collectHandles = _interopRequireDefault(require('./collectHandles')); + +var _getNoTestsFoundMessage = _interopRequireDefault( +  require('./getNoTestsFoundMessage') +); + +var _runGlobalHook = _interopRequireDefault(require('./runGlobalHook')); + +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 getTestPaths = async ( +  globalConfig, +  source, +  outputStream, +  changedFiles, +  jestHooks, +  filter +) => { +  const data = await source.getTestPaths(globalConfig, changedFiles, filter); + +  if (!data.tests.length && globalConfig.onlyChanged && data.noSCM) { +    new (_console().CustomConsole)(outputStream, outputStream).log( +      'Jest can only find uncommitted changed files in a git or hg ' + +        'repository. If you make your project a git or hg ' + +        'repository (`git init` or `hg init`), Jest will be able ' + +        'to only run tests related to files changed since the last ' + +        'commit.' +    ); +  } + +  const shouldTestArray = await Promise.all( +    data.tests.map(test => +      jestHooks.shouldRunTestSuite({ +        config: test.context.config, +        duration: test.duration, +        testPath: test.path +      }) +    ) +  ); +  const filteredTests = data.tests.filter((_test, i) => shouldTestArray[i]); +  return {...data, allTests: filteredTests.length, tests: filteredTests}; +}; + +const processResults = async (runResults, options) => { +  const { +    outputFile, +    json: isJSON, +    onComplete, +    outputStream, +    testResultsProcessor, +    collectHandles +  } = options; + +  if (collectHandles) { +    runResults.openHandles = await collectHandles(); +  } else { +    runResults.openHandles = []; +  } + +  if (testResultsProcessor) { +    const processor = await (0, _jestUtil().requireOrImportModule)( +      testResultsProcessor +    ); +    runResults = processor(runResults); +  } + +  if (isJSON) { +    if (outputFile) { +      const cwd = (0, _jestUtil().tryRealpath)(process.cwd()); +      const filePath = path().resolve(cwd, outputFile); +      fs().writeFileSync( +        filePath, +        JSON.stringify((0, _testResult().formatTestResults)(runResults)) +      ); +      outputStream.write( +        `Test results written to: ${path().relative(cwd, filePath)}\n` +      ); +    } else { +      process.stdout.write( +        JSON.stringify((0, _testResult().formatTestResults)(runResults)) +      ); +    } +  } + +  onComplete === null || onComplete === void 0 +    ? void 0 +    : onComplete(runResults); +}; + +const testSchedulerContext = { +  firstRun: true, +  previousSuccess: true +}; + +async function runJest({ +  contexts, +  globalConfig, +  outputStream, +  testWatcher, +  jestHooks = new (_jestWatcher().JestHook)().getEmitter(), +  startRun, +  changedFilesPromise, +  onComplete, +  failedTestsCache, +  filter +}) { +  // Clear cache for required modules - there might be different resolutions +  // from Jest's config loading to running the tests +  _jestResolve().default.clearDefaultResolverCache(); + +  const Sequencer = await (0, _jestUtil().requireOrImportModule)( +    globalConfig.testSequencer +  ); +  const sequencer = new Sequencer(); +  let allTests = []; + +  if (changedFilesPromise && globalConfig.watch) { +    const {repos} = await changedFilesPromise; +    const noSCM = Object.keys(repos).every(scm => repos[scm].size === 0); + +    if (noSCM) { +      process.stderr.write( +        '\n' + +          _chalk().default.bold('--watch') + +          ' is not supported without git/hg, please use --watchAll ' + +          '\n' +      ); +      (0, _exit().default)(1); +    } +  } + +  const searchSources = contexts.map( +    context => new _SearchSource.default(context) +  ); +  const testRunData = await Promise.all( +    contexts.map(async (context, index) => { +      const searchSource = searchSources[index]; +      const matches = await getTestPaths( +        globalConfig, +        searchSource, +        outputStream, +        changedFilesPromise && (await changedFilesPromise), +        jestHooks, +        filter +      ); +      allTests = allTests.concat(matches.tests); +      return { +        context, +        matches +      }; +    }) +  ); +  allTests = await sequencer.sort(allTests); + +  if (globalConfig.listTests) { +    const testsPaths = Array.from(new Set(allTests.map(test => test.path))); +    /* eslint-disable no-console */ + +    if (globalConfig.json) { +      console.log(JSON.stringify(testsPaths)); +    } else { +      console.log(testsPaths.join('\n')); +    } +    /* eslint-enable */ + +    onComplete && +      onComplete((0, _testResult().makeEmptyAggregatedTestResult)()); +    return; +  } + +  if (globalConfig.onlyFailures) { +    if (failedTestsCache) { +      allTests = failedTestsCache.filterTests(allTests); +    } else { +      allTests = await sequencer.allFailedTests(allTests); +    } +  } + +  const hasTests = allTests.length > 0; + +  if (!hasTests) { +    const noTestsFoundMessage = (0, _getNoTestsFoundMessage.default)( +      testRunData, +      globalConfig +    ); + +    if ( +      globalConfig.passWithNoTests || +      globalConfig.findRelatedTests || +      globalConfig.lastCommit || +      globalConfig.onlyChanged +    ) { +      new (_console().CustomConsole)(outputStream, outputStream).log( +        noTestsFoundMessage +      ); +    } else { +      new (_console().CustomConsole)(outputStream, outputStream).error( +        noTestsFoundMessage +      ); +      (0, _exit().default)(1); +    } +  } else if ( +    allTests.length === 1 && +    globalConfig.silent !== true && +    globalConfig.verbose !== false +  ) { +    const newConfig = {...globalConfig, verbose: true}; +    globalConfig = Object.freeze(newConfig); +  } + +  let collectHandles; + +  if (globalConfig.detectOpenHandles) { +    collectHandles = (0, _collectHandles.default)(); +  } + +  if (hasTests) { +    await (0, _runGlobalHook.default)({ +      allTests, +      globalConfig, +      moduleName: 'globalSetup' +    }); +  } + +  if (changedFilesPromise) { +    const changedFilesInfo = await changedFilesPromise; + +    if (changedFilesInfo.changedFiles) { +      testSchedulerContext.changedFiles = changedFilesInfo.changedFiles; +      const sourcesRelatedToTestsInChangedFilesArray = ( +        await Promise.all( +          contexts.map(async (_, index) => { +            const searchSource = searchSources[index]; +            return searchSource.findRelatedSourcesFromTestsInChangedFiles( +              changedFilesInfo +            ); +          }) +        ) +      ).reduce((total, paths) => total.concat(paths), []); +      testSchedulerContext.sourcesRelatedToTestsInChangedFiles = new Set( +        sourcesRelatedToTestsInChangedFilesArray +      ); +    } +  } + +  const scheduler = await (0, _TestScheduler.createTestScheduler)( +    globalConfig, +    { +      startRun +    }, +    testSchedulerContext +  ); +  const results = await scheduler.scheduleTests(allTests, testWatcher); +  await sequencer.cacheResults(allTests, results); + +  if (hasTests) { +    await (0, _runGlobalHook.default)({ +      allTests, +      globalConfig, +      moduleName: 'globalTeardown' +    }); +  } + +  await processResults(results, { +    collectHandles, +    json: globalConfig.json, +    onComplete, +    outputFile: globalConfig.outputFile, +    outputStream, +    testResultsProcessor: globalConfig.testResultsProcessor +  }); +} diff --git a/node_modules/@jest/core/build/testSchedulerHelper.d.ts b/node_modules/@jest/core/build/testSchedulerHelper.d.ts new file mode 100644 index 0000000..d49d44f --- /dev/null +++ b/node_modules/@jest/core/build/testSchedulerHelper.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. + */ +import type { Test } from '@jest/test-result'; +import type { Config } from '@jest/types'; +export declare function shouldRunInBand(tests: Array<Test>, timings: Array<number>, { detectOpenHandles, maxWorkers, watch, watchAll }: Config.GlobalConfig): boolean; diff --git a/node_modules/@jest/core/build/testSchedulerHelper.js b/node_modules/@jest/core/build/testSchedulerHelper.js new file mode 100644 index 0000000..78cf48c --- /dev/null +++ b/node_modules/@jest/core/build/testSchedulerHelper.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.shouldRunInBand = shouldRunInBand; + +/** + * 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 SLOW_TEST_TIME = 1000; + +function shouldRunInBand( +  tests, +  timings, +  {detectOpenHandles, maxWorkers, watch, watchAll} +) { +  // detectOpenHandles makes no sense without runInBand, because it cannot detect leaks in workers +  if (detectOpenHandles) { +    return true; +  } +  /* +   * Run in band if we only have one test or one worker available, unless we +   * are using the watch mode, in which case the TTY has to be responsive and +   * we cannot schedule anything in the main thread. Same logic applies to +   * watchAll. +   * Also, if we are confident from previous runs that the tests will finish +   * quickly we also run in band to reduce the overhead of spawning workers. +   * Finally, the user can provide the runInBand argument in the CLI to +   * force running in band. +   * https://github.com/facebook/jest/blob/700e0dadb85f5dc8ff5dac6c7e98956690049734/packages/jest-config/src/getMaxWorkers.js#L14-L17 +   */ + +  const isWatchMode = watch || watchAll; +  const areFastTests = timings.every(timing => timing < SLOW_TEST_TIME); +  const oneWorkerOrLess = maxWorkers <= 1; +  const oneTestOrLess = tests.length <= 1; + +  if (isWatchMode) { +    return oneWorkerOrLess || (oneTestOrLess && areFastTests); +  } + +  return ( +    oneWorkerOrLess || +    oneTestOrLess || +    (tests.length <= 20 && timings.length > 0 && areFastTests) +  ); +} diff --git a/node_modules/@jest/core/build/types.d.ts b/node_modules/@jest/core/build/types.d.ts new file mode 100644 index 0000000..877941c --- /dev/null +++ b/node_modules/@jest/core/build/types.d.ts @@ -0,0 +1,39 @@ +/** + * 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 { Test } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type { Context } from 'jest-runtime'; +export declare type Stats = { +    roots: number; +    testMatch: number; +    testPathIgnorePatterns: number; +    testRegex: number; +    testPathPattern?: number; +}; +export declare type TestRunData = Array<{ +    context: Context; +    matches: { +        allTests: number; +        tests: Array<Test>; +        total?: number; +        stats?: Stats; +    }; +}>; +export declare type TestPathCases = Array<{ +    stat: keyof Stats; +    isMatch: (path: Config.Path) => boolean; +}>; +export declare type TestPathCasesWithPathPattern = TestPathCases & { +    testPathPattern: (path: Config.Path) => boolean; +}; +export declare type FilterResult = { +    test: string; +    message: string; +}; +export declare type Filter = (testPaths: Array<string>) => Promise<{ +    filtered: Array<FilterResult>; +}>; diff --git a/node_modules/@jest/core/build/types.js b/node_modules/@jest/core/build/types.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/core/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/core/build/version.d.ts b/node_modules/@jest/core/build/version.d.ts new file mode 100644 index 0000000..8646731 --- /dev/null +++ b/node_modules/@jest/core/build/version.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 getVersion(): string; diff --git a/node_modules/@jest/core/build/version.js b/node_modules/@jest/core/build/version.js new file mode 100644 index 0000000..1bcd800 --- /dev/null +++ b/node_modules/@jest/core/build/version.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getVersion; + +/** + * 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. + */ +// Cannot be `import` as it's not under TS root dir +const {version: VERSION} = require('../package.json'); + +function getVersion() { +  return VERSION; +} diff --git a/node_modules/@jest/core/build/watch.d.ts b/node_modules/@jest/core/build/watch.d.ts new file mode 100644 index 0000000..d8df910 --- /dev/null +++ b/node_modules/@jest/core/build/watch.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. + */ +/// <reference types="node" /> +import type { Config } from '@jest/types'; +import type { default as HasteMap } from 'jest-haste-map'; +import type { Context } from 'jest-runtime'; +import { JestHook } from 'jest-watcher'; +import type { Filter } from './types'; +export default function watch(initialGlobalConfig: Config.GlobalConfig, contexts: Array<Context>, outputStream: NodeJS.WriteStream, hasteMapInstances: Array<HasteMap>, stdin?: NodeJS.ReadStream, hooks?: JestHook, filter?: Filter): Promise<void>; diff --git a/node_modules/@jest/core/build/watch.js b/node_modules/@jest/core/build/watch.js new file mode 100644 index 0000000..cffb811 --- /dev/null +++ b/node_modules/@jest/core/build/watch.js @@ -0,0 +1,769 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = watch; + +function path() { +  const data = _interopRequireWildcard(require('path')); + +  path = function () { +    return data; +  }; + +  return data; +} + +function _ansiEscapes() { +  const data = _interopRequireDefault(require('ansi-escapes')); + +  _ansiEscapes = function () { +    return data; +  }; + +  return data; +} + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _exit() { +  const data = _interopRequireDefault(require('exit')); + +  _exit = function () { +    return data; +  }; + +  return data; +} + +function _slash() { +  const data = _interopRequireDefault(require('slash')); + +  _slash = function () { +    return data; +  }; + +  return data; +} + +function _jestMessageUtil() { +  const data = require('jest-message-util'); + +  _jestMessageUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestValidate() { +  const data = require('jest-validate'); + +  _jestValidate = function () { +    return data; +  }; + +  return data; +} + +function _jestWatcher() { +  const data = require('jest-watcher'); + +  _jestWatcher = function () { +    return data; +  }; + +  return data; +} + +var _FailedTestsCache = _interopRequireDefault(require('./FailedTestsCache')); + +var _SearchSource = _interopRequireDefault(require('./SearchSource')); + +var _TestWatcher = _interopRequireDefault(require('./TestWatcher')); + +var _getChangedFilesPromise = _interopRequireDefault( +  require('./getChangedFilesPromise') +); + +var _activeFiltersMessage = _interopRequireDefault( +  require('./lib/activeFiltersMessage') +); + +var _createContext = _interopRequireDefault(require('./lib/createContext')); + +var _isValidPath = _interopRequireDefault(require('./lib/isValidPath')); + +var _updateGlobalConfig = _interopRequireDefault( +  require('./lib/updateGlobalConfig') +); + +var _watchPluginsHelpers = require('./lib/watchPluginsHelpers'); + +var _FailedTestsInteractive = _interopRequireDefault( +  require('./plugins/FailedTestsInteractive') +); + +var _Quit = _interopRequireDefault(require('./plugins/Quit')); + +var _TestNamePattern = _interopRequireDefault( +  require('./plugins/TestNamePattern') +); + +var _TestPathPattern = _interopRequireDefault( +  require('./plugins/TestPathPattern') +); + +var _UpdateSnapshots = _interopRequireDefault( +  require('./plugins/UpdateSnapshots') +); + +var _UpdateSnapshotsInteractive = _interopRequireDefault( +  require('./plugins/UpdateSnapshotsInteractive') +); + +var _runJest = _interopRequireDefault(require('./runJest')); + +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 {print: preRunMessagePrint} = _jestUtil().preRunMessage; + +let hasExitListener = false; +const INTERNAL_PLUGINS = [ +  _FailedTestsInteractive.default, +  _TestPathPattern.default, +  _TestNamePattern.default, +  _UpdateSnapshots.default, +  _UpdateSnapshotsInteractive.default, +  _Quit.default +]; +const RESERVED_KEY_PLUGINS = new Map([ +  [ +    _UpdateSnapshots.default, +    { +      forbiddenOverwriteMessage: 'updating snapshots', +      key: 'u' +    } +  ], +  [ +    _UpdateSnapshotsInteractive.default, +    { +      forbiddenOverwriteMessage: 'updating snapshots interactively', +      key: 'i' +    } +  ], +  [ +    _Quit.default, +    { +      forbiddenOverwriteMessage: 'quitting watch mode' +    } +  ] +]); + +async function watch( +  initialGlobalConfig, +  contexts, +  outputStream, +  hasteMapInstances, +  stdin = process.stdin, +  hooks = new (_jestWatcher().JestHook)(), +  filter +) { +  // `globalConfig` will be constantly updated and reassigned as a result of +  // watch mode interactions. +  let globalConfig = initialGlobalConfig; +  let activePlugin; +  globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { +    mode: globalConfig.watch ? 'watch' : 'watchAll', +    passWithNoTests: true +  }); + +  const updateConfigAndRun = ({ +    bail, +    changedSince, +    collectCoverage, +    collectCoverageFrom, +    collectCoverageOnlyFrom, +    coverageDirectory, +    coverageReporters, +    findRelatedTests, +    mode, +    nonFlagArgs, +    notify, +    notifyMode, +    onlyFailures, +    reporters, +    testNamePattern, +    testPathPattern, +    updateSnapshot, +    verbose +  } = {}) => { +    const previousUpdateSnapshot = globalConfig.updateSnapshot; +    globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { +      bail, +      changedSince, +      collectCoverage, +      collectCoverageFrom, +      collectCoverageOnlyFrom, +      coverageDirectory, +      coverageReporters, +      findRelatedTests, +      mode, +      nonFlagArgs, +      notify, +      notifyMode, +      onlyFailures, +      reporters, +      testNamePattern, +      testPathPattern, +      updateSnapshot, +      verbose +    }); +    startRun(globalConfig); +    globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { +      // updateSnapshot is not sticky after a run. +      updateSnapshot: +        previousUpdateSnapshot === 'all' ? 'none' : previousUpdateSnapshot +    }); +  }; + +  const watchPlugins = INTERNAL_PLUGINS.map( +    InternalPlugin => +      new InternalPlugin({ +        stdin, +        stdout: outputStream +      }) +  ); +  watchPlugins.forEach(plugin => { +    const hookSubscriber = hooks.getSubscriber(); + +    if (plugin.apply) { +      plugin.apply(hookSubscriber); +    } +  }); + +  if (globalConfig.watchPlugins != null) { +    const watchPluginKeys = new Map(); + +    for (const plugin of watchPlugins) { +      const reservedInfo = RESERVED_KEY_PLUGINS.get(plugin.constructor) || {}; +      const key = reservedInfo.key || getPluginKey(plugin, globalConfig); + +      if (!key) { +        continue; +      } + +      const {forbiddenOverwriteMessage} = reservedInfo; +      watchPluginKeys.set(key, { +        forbiddenOverwriteMessage, +        overwritable: forbiddenOverwriteMessage == null, +        plugin +      }); +    } + +    for (const pluginWithConfig of globalConfig.watchPlugins) { +      let plugin; + +      try { +        const ThirdPartyPlugin = await (0, _jestUtil().requireOrImportModule)( +          pluginWithConfig.path +        ); +        plugin = new ThirdPartyPlugin({ +          config: pluginWithConfig.config, +          stdin, +          stdout: outputStream +        }); +      } catch (error) { +        const errorWithContext = new Error( +          `Failed to initialize watch plugin "${_chalk().default.bold( +            (0, _slash().default)( +              path().relative(process.cwd(), pluginWithConfig.path) +            ) +          )}":\n\n${(0, _jestMessageUtil().formatExecError)( +            error, +            contexts[0].config, +            { +              noStackTrace: false +            } +          )}` +        ); +        delete errorWithContext.stack; +        return Promise.reject(errorWithContext); +      } + +      checkForConflicts(watchPluginKeys, plugin, globalConfig); +      const hookSubscriber = hooks.getSubscriber(); + +      if (plugin.apply) { +        plugin.apply(hookSubscriber); +      } + +      watchPlugins.push(plugin); +    } +  } + +  const failedTestsCache = new _FailedTestsCache.default(); +  let searchSources = contexts.map(context => ({ +    context, +    searchSource: new _SearchSource.default(context) +  })); +  let isRunning = false; +  let testWatcher; +  let shouldDisplayWatchUsage = true; +  let isWatchUsageDisplayed = false; + +  const emitFileChange = () => { +    if (hooks.isUsed('onFileChange')) { +      const projects = searchSources.map(({context, searchSource}) => ({ +        config: context.config, +        testPaths: searchSource.findMatchingTests('').tests.map(t => t.path) +      })); +      hooks.getEmitter().onFileChange({ +        projects +      }); +    } +  }; + +  emitFileChange(); +  hasteMapInstances.forEach((hasteMapInstance, index) => { +    hasteMapInstance.on('change', ({eventsQueue, hasteFS, moduleMap}) => { +      const validPaths = eventsQueue.filter(({filePath}) => +        (0, _isValidPath.default)(globalConfig, filePath) +      ); + +      if (validPaths.length) { +        const context = (contexts[index] = (0, _createContext.default)( +          contexts[index].config, +          { +            hasteFS, +            moduleMap +          } +        )); +        activePlugin = null; +        searchSources = searchSources.slice(); +        searchSources[index] = { +          context, +          searchSource: new _SearchSource.default(context) +        }; +        emitFileChange(); +        startRun(globalConfig); +      } +    }); +  }); + +  if (!hasExitListener) { +    hasExitListener = true; +    process.on('exit', () => { +      if (activePlugin) { +        outputStream.write(_ansiEscapes().default.cursorDown()); +        outputStream.write(_ansiEscapes().default.eraseDown); +      } +    }); +  } + +  const startRun = globalConfig => { +    if (isRunning) { +      return Promise.resolve(null); +    } + +    testWatcher = new _TestWatcher.default({ +      isWatchMode: true +    }); +    _jestUtil().isInteractive && +      outputStream.write(_jestUtil().specialChars.CLEAR); +    preRunMessagePrint(outputStream); +    isRunning = true; +    const configs = contexts.map(context => context.config); +    const changedFilesPromise = (0, _getChangedFilesPromise.default)( +      globalConfig, +      configs +    ); +    return (0, _runJest.default)({ +      changedFilesPromise, +      contexts, +      failedTestsCache, +      filter, +      globalConfig, +      jestHooks: hooks.getEmitter(), +      onComplete: results => { +        isRunning = false; +        hooks.getEmitter().onTestRunComplete(results); // Create a new testWatcher instance so that re-runs won't be blocked. +        // The old instance that was passed to Jest will still be interrupted +        // and prevent test runs from the previous run. + +        testWatcher = new _TestWatcher.default({ +          isWatchMode: true +        }); // Do not show any Watch Usage related stuff when running in a +        // non-interactive environment + +        if (_jestUtil().isInteractive) { +          if (shouldDisplayWatchUsage) { +            outputStream.write(usage(globalConfig, watchPlugins)); +            shouldDisplayWatchUsage = false; // hide Watch Usage after first run + +            isWatchUsageDisplayed = true; +          } else { +            outputStream.write(showToggleUsagePrompt()); +            shouldDisplayWatchUsage = false; +            isWatchUsageDisplayed = false; +          } +        } else { +          outputStream.write('\n'); +        } + +        failedTestsCache.setTestResults(results.testResults); +      }, +      outputStream, +      startRun, +      testWatcher +    }).catch( +      ( +        error // Errors thrown inside `runJest`, e.g. by resolvers, are caught here for +      ) => +        // continuous watch mode execution. We need to reprint them to the +        // terminal and give just a little bit of extra space so they fit below +        // `preRunMessagePrint` message nicely. +        console.error( +          '\n\n' + +            (0, _jestMessageUtil().formatExecError)(error, contexts[0].config, { +              noStackTrace: false +            }) +        ) +    ); +  }; + +  const onKeypress = key => { +    if ( +      key === _jestWatcher().KEYS.CONTROL_C || +      key === _jestWatcher().KEYS.CONTROL_D +    ) { +      if (typeof stdin.setRawMode === 'function') { +        stdin.setRawMode(false); +      } + +      outputStream.write('\n'); +      (0, _exit().default)(0); +      return; +    } + +    if (activePlugin != null && activePlugin.onKey) { +      // if a plugin is activate, Jest should let it handle keystrokes, so ignore +      // them here +      activePlugin.onKey(key); +      return; +    } // Abort test run + +    const pluginKeys = (0, _watchPluginsHelpers.getSortedUsageRows)( +      watchPlugins, +      globalConfig +    ).map(usage => Number(usage.key).toString(16)); + +    if ( +      isRunning && +      testWatcher && +      ['q', _jestWatcher().KEYS.ENTER, 'a', 'o', 'f'] +        .concat(pluginKeys) +        .includes(key) +    ) { +      testWatcher.setState({ +        interrupted: true +      }); +      return; +    } + +    const matchingWatchPlugin = (0, +    _watchPluginsHelpers.filterInteractivePlugins)( +      watchPlugins, +      globalConfig +    ).find(plugin => getPluginKey(plugin, globalConfig) === key); + +    if (matchingWatchPlugin != null) { +      if (isRunning) { +        testWatcher.setState({ +          interrupted: true +        }); +        return; +      } // "activate" the plugin, which has jest ignore keystrokes so the plugin +      // can handle them + +      activePlugin = matchingWatchPlugin; + +      if (activePlugin.run) { +        activePlugin.run(globalConfig, updateConfigAndRun).then( +          shouldRerun => { +            activePlugin = null; + +            if (shouldRerun) { +              updateConfigAndRun(); +            } +          }, +          () => { +            activePlugin = null; +            onCancelPatternPrompt(); +          } +        ); +      } else { +        activePlugin = null; +      } +    } + +    switch (key) { +      case _jestWatcher().KEYS.ENTER: +        startRun(globalConfig); +        break; + +      case 'a': +        globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { +          mode: 'watchAll', +          testNamePattern: '', +          testPathPattern: '' +        }); +        startRun(globalConfig); +        break; + +      case 'c': +        updateConfigAndRun({ +          mode: 'watch', +          testNamePattern: '', +          testPathPattern: '' +        }); +        break; + +      case 'f': +        globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { +          onlyFailures: !globalConfig.onlyFailures +        }); +        startRun(globalConfig); +        break; + +      case 'o': +        globalConfig = (0, _updateGlobalConfig.default)(globalConfig, { +          mode: 'watch', +          testNamePattern: '', +          testPathPattern: '' +        }); +        startRun(globalConfig); +        break; + +      case '?': +        break; + +      case 'w': +        if (!shouldDisplayWatchUsage && !isWatchUsageDisplayed) { +          outputStream.write(_ansiEscapes().default.cursorUp()); +          outputStream.write(_ansiEscapes().default.eraseDown); +          outputStream.write(usage(globalConfig, watchPlugins)); +          isWatchUsageDisplayed = true; +          shouldDisplayWatchUsage = false; +        } + +        break; +    } +  }; + +  const onCancelPatternPrompt = () => { +    outputStream.write(_ansiEscapes().default.cursorHide); +    outputStream.write(_jestUtil().specialChars.CLEAR); +    outputStream.write(usage(globalConfig, watchPlugins)); +    outputStream.write(_ansiEscapes().default.cursorShow); +  }; + +  if (typeof stdin.setRawMode === 'function') { +    stdin.setRawMode(true); +    stdin.resume(); +    stdin.setEncoding('utf8'); +    stdin.on('data', onKeypress); +  } + +  startRun(globalConfig); +  return Promise.resolve(); +} + +const checkForConflicts = (watchPluginKeys, plugin, globalConfig) => { +  const key = getPluginKey(plugin, globalConfig); + +  if (!key) { +    return; +  } + +  const conflictor = watchPluginKeys.get(key); + +  if (!conflictor || conflictor.overwritable) { +    watchPluginKeys.set(key, { +      overwritable: false, +      plugin +    }); +    return; +  } + +  let error; + +  if (conflictor.forbiddenOverwriteMessage) { +    error = ` +  Watch plugin ${_chalk().default.bold.red( +    getPluginIdentifier(plugin) +  )} attempted to register key ${_chalk().default.bold.red(`<${key}>`)}, +  that is reserved internally for ${_chalk().default.bold.red( +    conflictor.forbiddenOverwriteMessage +  )}. +  Please change the configuration key for this plugin.`.trim(); +  } else { +    const plugins = [conflictor.plugin, plugin] +      .map(p => _chalk().default.bold.red(getPluginIdentifier(p))) +      .join(' and '); +    error = ` +  Watch plugins ${plugins} both attempted to register key ${_chalk().default.bold.red( +      `<${key}>` +    )}. +  Please change the key configuration for one of the conflicting plugins to avoid overlap.`.trim(); +  } + +  throw new (_jestValidate().ValidationError)( +    'Watch plugin configuration error', +    error +  ); +}; + +const getPluginIdentifier = ( +  plugin // This breaks as `displayName` is not defined as a static, but since +) => +  // WatchPlugin is an interface, and it is my understanding interface +  // static fields are not definable anymore, no idea how to circumvent +  // this :-( +  // @ts-expect-error: leave `displayName` be. +  plugin.constructor.displayName || plugin.constructor.name; + +const getPluginKey = (plugin, globalConfig) => { +  if (typeof plugin.getUsageInfo === 'function') { +    return ( +      plugin.getUsageInfo(globalConfig) || { +        key: null +      } +    ).key; +  } + +  return null; +}; + +const usage = (globalConfig, watchPlugins, delimiter = '\n') => { +  const messages = [ +    (0, _activeFiltersMessage.default)(globalConfig), +    globalConfig.testPathPattern || globalConfig.testNamePattern +      ? _chalk().default.dim(' \u203A Press ') + +        'c' + +        _chalk().default.dim(' to clear filters.') +      : null, +    '\n' + _chalk().default.bold('Watch Usage'), +    globalConfig.watch +      ? _chalk().default.dim(' \u203A Press ') + +        'a' + +        _chalk().default.dim(' to run all tests.') +      : null, +    globalConfig.onlyFailures +      ? _chalk().default.dim(' \u203A Press ') + +        'f' + +        _chalk().default.dim(' to quit "only failed tests" mode.') +      : _chalk().default.dim(' \u203A Press ') + +        'f' + +        _chalk().default.dim(' to run only failed tests.'), +    (globalConfig.watchAll || +      globalConfig.testPathPattern || +      globalConfig.testNamePattern) && +    !globalConfig.noSCM +      ? _chalk().default.dim(' \u203A Press ') + +        'o' + +        _chalk().default.dim(' to only run tests related to changed files.') +      : null, +    ...(0, _watchPluginsHelpers.getSortedUsageRows)( +      watchPlugins, +      globalConfig +    ).map( +      plugin => +        _chalk().default.dim(' \u203A Press') + +        ' ' + +        plugin.key + +        ' ' + +        _chalk().default.dim(`to ${plugin.prompt}.`) +    ), +    _chalk().default.dim(' \u203A Press ') + +      'Enter' + +      _chalk().default.dim(' to trigger a test run.') +  ]; +  return messages.filter(message => !!message).join(delimiter) + '\n'; +}; + +const showToggleUsagePrompt = () => +  '\n' + +  _chalk().default.bold('Watch Usage: ') + +  _chalk().default.dim('Press ') + +  'w' + +  _chalk().default.dim(' to show more.'); diff --git a/node_modules/@jest/core/package.json b/node_modules/@jest/core/package.json new file mode 100644 index 0000000..a160167 --- /dev/null +++ b/node_modules/@jest/core/package.json @@ -0,0 +1,103 @@ +{ +  "name": "@jest/core", +  "description": "Delightful JavaScript Testing.", +  "version": "27.5.1", +  "main": "./build/jest.js", +  "types": "./build/jest.d.ts", +  "exports": { +    ".": { +      "types": "./build/jest.d.ts", +      "default": "./build/jest.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@jest/console": "^27.5.1", +    "@jest/reporters": "^27.5.1", +    "@jest/test-result": "^27.5.1", +    "@jest/transform": "^27.5.1", +    "@jest/types": "^27.5.1", +    "@types/node": "*", +    "ansi-escapes": "^4.2.1", +    "chalk": "^4.0.0", +    "emittery": "^0.8.1", +    "exit": "^0.1.2", +    "graceful-fs": "^4.2.9", +    "jest-changed-files": "^27.5.1", +    "jest-config": "^27.5.1", +    "jest-haste-map": "^27.5.1", +    "jest-message-util": "^27.5.1", +    "jest-regex-util": "^27.5.1", +    "jest-resolve": "^27.5.1", +    "jest-resolve-dependencies": "^27.5.1", +    "jest-runner": "^27.5.1", +    "jest-runtime": "^27.5.1", +    "jest-snapshot": "^27.5.1", +    "jest-util": "^27.5.1", +    "jest-validate": "^27.5.1", +    "jest-watcher": "^27.5.1", +    "micromatch": "^4.0.4", +    "rimraf": "^3.0.0", +    "slash": "^3.0.0", +    "strip-ansi": "^6.0.0" +  }, +  "devDependencies": { +    "@jest/test-sequencer": "^27.5.1", +    "@jest/test-utils": "^27.5.1", +    "@types/exit": "^0.1.30", +    "@types/graceful-fs": "^4.1.2", +    "@types/micromatch": "^4.0.1", +    "@types/rimraf": "^3.0.0" +  }, +  "peerDependencies": { +    "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" +  }, +  "peerDependenciesMeta": { +    "node-notifier": { +      "optional": true +    } +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest", +    "directory": "packages/jest-core" +  }, +  "bugs": { +    "url": "https://github.com/facebook/jest/issues" +  }, +  "homepage": "https://jestjs.io/", +  "license": "MIT", +  "keywords": [ +    "ava", +    "babel", +    "coverage", +    "easy", +    "expect", +    "facebook", +    "immersive", +    "instant", +    "jasmine", +    "jest", +    "jsdom", +    "mocha", +    "mocking", +    "painless", +    "qunit", +    "runner", +    "sandboxed", +    "snapshot", +    "tap", +    "tape", +    "test", +    "testing", +    "typescript", +    "watch" +  ], +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/environment/LICENSE b/node_modules/@jest/environment/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/environment/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/environment/build/index.d.ts b/node_modules/@jest/environment/build/index.d.ts new file mode 100644 index 0000000..fe18ff0 --- /dev/null +++ b/node_modules/@jest/environment/build/index.d.ts @@ -0,0 +1,267 @@ +/** + * 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 { Context } from 'vm'; +import type { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers'; +import type { Circus, Config, Global } from '@jest/types'; +import type { fn as JestMockFn, mocked as JestMockMocked, spyOn as JestMockSpyOn, ModuleMocker } from 'jest-mock'; +export declare type EnvironmentContext = { +    console: Console; +    docblockPragmas: Record<string, string | Array<string>>; +    testPath: Config.Path; +}; +export declare type ModuleWrapper = (this: Module['exports'], module: Module, exports: Module['exports'], require: Module['require'], __dirname: string, __filename: Module['filename'], jest?: Jest, ...extraGlobals: Array<Global.Global[keyof Global.Global]>) => unknown; +export declare class JestEnvironment<Timer = unknown> { +    constructor(config: Config.ProjectConfig, context?: EnvironmentContext); +    global: Global.Global; +    fakeTimers: LegacyFakeTimers<Timer> | null; +    fakeTimersModern: ModernFakeTimers | null; +    moduleMocker: ModuleMocker | null; +    getVmContext(): Context | null; +    setup(): Promise<void>; +    teardown(): Promise<void>; +    handleTestEvent?: Circus.EventHandler; +    exportConditions?: () => Array<string>; +} +export declare type Module = NodeModule; +export interface Jest { +    /** +     * Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run. +     * Optionally, you can provide steps, so it will run steps amount of next timeouts/intervals. +     */ +    advanceTimersToNextTimer(steps?: number): void; +    /** +     * Disables automatic mocking in the module loader. +     */ +    autoMockOff(): Jest; +    /** +     * Enables automatic mocking in the module loader. +     */ +    autoMockOn(): Jest; +    /** +     * Clears the mock.calls and mock.instances properties of all mocks. +     * Equivalent to calling .mockClear() on every mocked function. +     */ +    clearAllMocks(): Jest; +    /** +     * Removes any pending timers from the timer system. If any timers have been +     * scheduled, they will be cleared and will never have the opportunity to +     * execute in the future. +     */ +    clearAllTimers(): void; +    /** +     * Indicates that the module system should never return a mocked version +     * of the specified module, including all of the specified module's +     * dependencies. +     */ +    deepUnmock(moduleName: string): Jest; +    /** +     * Disables automatic mocking in the module loader. +     * +     * After this method is called, all `require()`s will return the real +     * versions of each module (rather than a mocked version). +     */ +    disableAutomock(): Jest; +    /** +     * When using `babel-jest`, calls to mock will automatically be hoisted to +     * the top of the code block. Use this method if you want to explicitly avoid +     * this behavior. +     */ +    doMock(moduleName: string, moduleFactory?: () => unknown, options?: { +        virtual?: boolean; +    }): Jest; +    /** +     * Indicates that the module system should never return a mocked version +     * of the specified module from require() (e.g. that it should always return +     * the real module). +     */ +    dontMock(moduleName: string): Jest; +    /** +     * Enables automatic mocking in the module loader. +     */ +    enableAutomock(): Jest; +    /** +     * Creates a mock function. Optionally takes a mock implementation. +     */ +    fn: typeof JestMockFn; +    /** +     * Given the name of a module, use the automatic mocking system to generate a +     * mocked version of the module for you. +     * +     * This is useful when you want to create a manual mock that extends the +     * automatic mock's behavior. +     * +     * @deprecated Use `jest.createMockFromModule()` instead +     */ +    genMockFromModule(moduleName: string): unknown; +    /** +     * Given the name of a module, use the automatic mocking system to generate a +     * mocked version of the module for you. +     * +     * This is useful when you want to create a manual mock that extends the +     * automatic mock's behavior. +     */ +    createMockFromModule(moduleName: string): unknown; +    /** +     * Determines if the given function is a mocked function. +     */ +    isMockFunction(fn: (...args: Array<any>) => unknown): fn is ReturnType<typeof JestMockFn>; +    /** +     * Mocks a module with an auto-mocked version when it is being required. +     */ +    mock(moduleName: string, moduleFactory?: () => unknown, options?: { +        virtual?: boolean; +    }): Jest; +    /** +     * Mocks a module with the provided module factory when it is being imported. +     */ +    unstable_mockModule<T = unknown>(moduleName: string, moduleFactory: () => Promise<T> | T, options?: { +        virtual?: boolean; +    }): Jest; +    /** +     * Returns the actual module instead of a mock, bypassing all checks on +     * whether the module should receive a mock implementation or not. +     * +     * @example +     ``` +      jest.mock('../myModule', () => { +      // Require the original module to not be mocked... +      const originalModule = jest.requireActual(moduleName); +        return { +          __esModule: true, // Use it when dealing with esModules +          ...originalModule, +          getRandom: jest.fn().mockReturnValue(10), +        }; +      }); +   +      const getRandom = require('../myModule').getRandom; +   +      getRandom(); // Always returns 10 +      ``` +     */ +    requireActual: (moduleName: string) => unknown; +    /** +     * Returns a mock module instead of the actual module, bypassing all checks +     * on whether the module should be required normally or not. +     */ +    requireMock: (moduleName: string) => unknown; +    /** +     * Resets the state of all mocks. +     * Equivalent to calling .mockReset() on every mocked function. +     */ +    resetAllMocks(): Jest; +    /** +     * Resets the module registry - the cache of all required modules. This is +     * useful to isolate modules where local state might conflict between tests. +     */ +    resetModules(): Jest; +    /** +     * Restores all mocks back to their original value. Equivalent to calling +     * `.mockRestore` on every mocked function. +     * +     * Beware that jest.restoreAllMocks() only works when the mock was created with +     * jest.spyOn; other mocks will require you to manually restore them. +     */ +    restoreAllMocks(): Jest; +    mocked: typeof JestMockMocked; +    /** +     * Runs failed tests n-times until they pass or until the max number of +     * retries is exhausted. This only works with `jest-circus`! +     */ +    retryTimes(numRetries: number): Jest; +    /** +     * Exhausts tasks queued by setImmediate(). +     * +     * > Note: This function is not available when using Lolex as fake timers implementation +     */ +    runAllImmediates(): void; +    /** +     * Exhausts the micro-task queue (usually interfaced in node via +     * process.nextTick). +     */ +    runAllTicks(): void; +    /** +     * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() +     * and setInterval()). +     */ +    runAllTimers(): void; +    /** +     * Executes only the macro-tasks that are currently pending (i.e., only the +     * tasks that have been queued by setTimeout() or setInterval() up to this +     * point). If any of the currently pending macro-tasks schedule new +     * macro-tasks, those new tasks will not be executed by this call. +     */ +    runOnlyPendingTimers(): void; +    /** +     * Advances all timers by msToRun milliseconds. All pending "macro-tasks" +     * that have been queued via setTimeout() or setInterval(), and would be +     * executed within this timeframe will be executed. +     */ +    advanceTimersByTime(msToRun: number): void; +    /** +     * Returns the number of fake timers still left to run. +     */ +    getTimerCount(): number; +    /** +     * Explicitly supplies the mock object that the module system should return +     * for the specified module. +     * +     * Note It is recommended to use `jest.mock()` instead. The `jest.mock` +     * API's second argument is a module factory instead of the expected +     * exported module object. +     */ +    setMock(moduleName: string, moduleExports: unknown): Jest; +    /** +     * Set the default timeout interval for tests and before/after hooks in +     * milliseconds. +     * +     * Note: The default timeout interval is 5 seconds if this method is not +     * called. +     */ +    setTimeout(timeout: number): Jest; +    /** +     * Creates a mock function similar to `jest.fn` but also tracks calls to +     * `object[methodName]`. +     * +     * Note: By default, jest.spyOn also calls the spied method. This is +     * different behavior from most other test libraries. +     */ +    spyOn: typeof JestMockSpyOn; +    /** +     * Indicates that the module system should never return a mocked version of +     * the specified module from require() (e.g. that it should always return the +     * real module). +     */ +    unmock(moduleName: string): Jest; +    /** +     * Instructs Jest to use fake versions of the standard timer functions. +     */ +    useFakeTimers(implementation?: 'modern' | 'legacy'): Jest; +    /** +     * Instructs Jest to use the real versions of the standard timer functions. +     */ +    useRealTimers(): Jest; +    /** +     * `jest.isolateModules(fn)` goes a step further than `jest.resetModules()` +     * and creates a sandbox registry for the modules that are loaded inside +     * the callback function. This is useful to isolate specific modules for +     * every test so that local module state doesn't conflict between tests. +     */ +    isolateModules(fn: () => void): Jest; +    /** +     * When mocking time, `Date.now()` will also be mocked. If you for some reason need access to the real current time, you can invoke this function. +     * +     * > Note: This function is only available when using Lolex as fake timers implementation +     */ +    getRealSystemTime(): number; +    /** +     *  Set the current system time used by fake timers. Simulates a user changing the system clock while your program is running. It affects the current time but it does not in itself cause e.g. timers to fire; they will fire exactly as they would have done without the call to `jest.setSystemTime()`. +     * +     *  > Note: This function is only available when using Lolex as fake timers implementation +     */ +    setSystemTime(now?: number | Date): void; +} diff --git a/node_modules/@jest/environment/build/index.js b/node_modules/@jest/environment/build/index.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/environment/build/index.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/environment/package.json b/node_modules/@jest/environment/package.json new file mode 100644 index 0000000..96ef04d --- /dev/null +++ b/node_modules/@jest/environment/package.json @@ -0,0 +1,32 @@ +{ +  "name": "@jest/environment", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-environment" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@jest/fake-timers": "^27.5.1", +    "@jest/types": "^27.5.1", +    "@types/node": "*", +    "jest-mock": "^27.5.1" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/fake-timers/LICENSE b/node_modules/@jest/fake-timers/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/fake-timers/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/fake-timers/build/index.d.ts b/node_modules/@jest/fake-timers/build/index.d.ts new file mode 100644 index 0000000..5a6e64c --- /dev/null +++ b/node_modules/@jest/fake-timers/build/index.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 as LegacyFakeTimers } from './legacyFakeTimers'; +export { default as ModernFakeTimers } from './modernFakeTimers'; diff --git a/node_modules/@jest/fake-timers/build/index.js b/node_modules/@jest/fake-timers/build/index.js new file mode 100644 index 0000000..5fe1fbe --- /dev/null +++ b/node_modules/@jest/fake-timers/build/index.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +Object.defineProperty(exports, 'LegacyFakeTimers', { +  enumerable: true, +  get: function () { +    return _legacyFakeTimers.default; +  } +}); +Object.defineProperty(exports, 'ModernFakeTimers', { +  enumerable: true, +  get: function () { +    return _modernFakeTimers.default; +  } +}); + +var _legacyFakeTimers = _interopRequireDefault(require('./legacyFakeTimers')); + +var _modernFakeTimers = _interopRequireDefault(require('./modernFakeTimers')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/fake-timers/build/legacyFakeTimers.d.ts b/node_modules/@jest/fake-timers/build/legacyFakeTimers.d.ts new file mode 100644 index 0000000..059d029 --- /dev/null +++ b/node_modules/@jest/fake-timers/build/legacyFakeTimers.d.ts @@ -0,0 +1,67 @@ +/** + * 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 { StackTraceConfig } from 'jest-message-util'; +import type { ModuleMocker } from 'jest-mock'; +declare type Callback = (...args: Array<unknown>) => void; +declare type TimerConfig<Ref> = { +    idToRef: (id: number) => Ref; +    refToId: (ref: Ref) => number | void; +}; +declare type GlobalThis = typeof globalThis; +interface FakeTimersGlobal extends GlobalThis { +    cancelAnimationFrame: (handle: number) => void; +    requestAnimationFrame: (callback: (time: number) => void) => number; +} +export default class FakeTimers<TimerRef> { +    private _cancelledTicks; +    private _config; +    private _disposed?; +    private _fakeTimerAPIs; +    private _global; +    private _immediates; +    private _maxLoops; +    private _moduleMocker; +    private _now; +    private _ticks; +    private _timerAPIs; +    private _timers; +    private _uuidCounter; +    private _timerConfig; +    constructor({ global, moduleMocker, timerConfig, config, maxLoops, }: { +        global: FakeTimersGlobal; +        moduleMocker: ModuleMocker; +        timerConfig: TimerConfig<TimerRef>; +        config: StackTraceConfig; +        maxLoops?: number; +    }); +    clearAllTimers(): void; +    dispose(): void; +    reset(): void; +    runAllTicks(): void; +    runAllImmediates(): void; +    private _runImmediate; +    runAllTimers(): void; +    runOnlyPendingTimers(): void; +    advanceTimersToNextTimer(steps?: number): void; +    advanceTimersByTime(msToRun: number): void; +    runWithRealTimers(cb: Callback): void; +    useRealTimers(): void; +    useFakeTimers(): void; +    getTimerCount(): number; +    private _checkFakeTimers; +    private _createMocks; +    private _fakeClearTimer; +    private _fakeClearImmediate; +    private _fakeNextTick; +    private _fakeRequestAnimationFrame; +    private _fakeSetImmediate; +    private _fakeSetInterval; +    private _fakeSetTimeout; +    private _getNextTimerHandle; +    private _runTimerHandle; +} +export {}; diff --git a/node_modules/@jest/fake-timers/build/legacyFakeTimers.js b/node_modules/@jest/fake-timers/build/legacyFakeTimers.js new file mode 100644 index 0000000..2abaf4e --- /dev/null +++ b/node_modules/@jest/fake-timers/build/legacyFakeTimers.js @@ -0,0 +1,673 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _util() { +  const data = _interopRequireDefault(require('util')); + +  _util = function () { +    return data; +  }; + +  return data; +} + +function _jestMessageUtil() { +  const data = require('jest-message-util'); + +  _jestMessageUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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 MS_IN_A_YEAR = 31536000000; + +class FakeTimers { +  constructor({global, moduleMocker, timerConfig, config, maxLoops}) { +    _defineProperty(this, '_cancelledTicks', void 0); + +    _defineProperty(this, '_config', void 0); + +    _defineProperty(this, '_disposed', void 0); + +    _defineProperty(this, '_fakeTimerAPIs', void 0); + +    _defineProperty(this, '_global', void 0); + +    _defineProperty(this, '_immediates', void 0); + +    _defineProperty(this, '_maxLoops', void 0); + +    _defineProperty(this, '_moduleMocker', void 0); + +    _defineProperty(this, '_now', void 0); + +    _defineProperty(this, '_ticks', void 0); + +    _defineProperty(this, '_timerAPIs', void 0); + +    _defineProperty(this, '_timers', void 0); + +    _defineProperty(this, '_uuidCounter', void 0); + +    _defineProperty(this, '_timerConfig', void 0); + +    this._global = global; +    this._timerConfig = timerConfig; +    this._config = config; +    this._maxLoops = maxLoops || 100000; +    this._uuidCounter = 1; +    this._moduleMocker = moduleMocker; // Store original timer APIs for future reference + +    this._timerAPIs = { +      cancelAnimationFrame: global.cancelAnimationFrame, +      clearImmediate: global.clearImmediate, +      clearInterval: global.clearInterval, +      clearTimeout: global.clearTimeout, +      nextTick: global.process && global.process.nextTick, +      requestAnimationFrame: global.requestAnimationFrame, +      setImmediate: global.setImmediate, +      setInterval: global.setInterval, +      setTimeout: global.setTimeout +    }; +    this.reset(); +  } + +  clearAllTimers() { +    this._immediates = []; + +    this._timers.clear(); +  } + +  dispose() { +    this._disposed = true; +    this.clearAllTimers(); +  } + +  reset() { +    this._cancelledTicks = {}; +    this._now = 0; +    this._ticks = []; +    this._immediates = []; +    this._timers = new Map(); +  } + +  runAllTicks() { +    this._checkFakeTimers(); // Only run a generous number of ticks and then bail. +    // This is just to help avoid recursive loops + +    let i; + +    for (i = 0; i < this._maxLoops; i++) { +      const tick = this._ticks.shift(); + +      if (tick === undefined) { +        break; +      } + +      if (!this._cancelledTicks.hasOwnProperty(tick.uuid)) { +        // Callback may throw, so update the map prior calling. +        this._cancelledTicks[tick.uuid] = true; +        tick.callback(); +      } +    } + +    if (i === this._maxLoops) { +      throw new Error( +        'Ran ' + +          this._maxLoops + +          ' ticks, and there are still more! ' + +          "Assuming we've hit an infinite recursion and bailing out..." +      ); +    } +  } + +  runAllImmediates() { +    this._checkFakeTimers(); // Only run a generous number of immediates and then bail. + +    let i; + +    for (i = 0; i < this._maxLoops; i++) { +      const immediate = this._immediates.shift(); + +      if (immediate === undefined) { +        break; +      } + +      this._runImmediate(immediate); +    } + +    if (i === this._maxLoops) { +      throw new Error( +        'Ran ' + +          this._maxLoops + +          ' immediates, and there are still more! Assuming ' + +          "we've hit an infinite recursion and bailing out..." +      ); +    } +  } + +  _runImmediate(immediate) { +    try { +      immediate.callback(); +    } finally { +      this._fakeClearImmediate(immediate.uuid); +    } +  } + +  runAllTimers() { +    this._checkFakeTimers(); + +    this.runAllTicks(); +    this.runAllImmediates(); // Only run a generous number of timers and then bail. +    // This is just to help avoid recursive loops + +    let i; + +    for (i = 0; i < this._maxLoops; i++) { +      const nextTimerHandle = this._getNextTimerHandle(); // If there are no more timer handles, stop! + +      if (nextTimerHandle === null) { +        break; +      } + +      this._runTimerHandle(nextTimerHandle); // Some of the immediate calls could be enqueued +      // during the previous handling of the timers, we should +      // run them as well. + +      if (this._immediates.length) { +        this.runAllImmediates(); +      } + +      if (this._ticks.length) { +        this.runAllTicks(); +      } +    } + +    if (i === this._maxLoops) { +      throw new Error( +        'Ran ' + +          this._maxLoops + +          ' timers, and there are still more! ' + +          "Assuming we've hit an infinite recursion and bailing out..." +      ); +    } +  } + +  runOnlyPendingTimers() { +    // We need to hold the current shape of `this._timers` because existing +    // timers can add new ones to the map and hence would run more than necessary. +    // See https://github.com/facebook/jest/pull/4608 for details +    const timerEntries = Array.from(this._timers.entries()); + +    this._checkFakeTimers(); + +    this._immediates.forEach(this._runImmediate, this); + +    timerEntries +      .sort(([, left], [, right]) => left.expiry - right.expiry) +      .forEach(([timerHandle]) => this._runTimerHandle(timerHandle)); +  } + +  advanceTimersToNextTimer(steps = 1) { +    if (steps < 1) { +      return; +    } + +    const nextExpiry = Array.from(this._timers.values()).reduce( +      (minExpiry, timer) => { +        if (minExpiry === null || timer.expiry < minExpiry) return timer.expiry; +        return minExpiry; +      }, +      null +    ); + +    if (nextExpiry !== null) { +      this.advanceTimersByTime(nextExpiry - this._now); +      this.advanceTimersToNextTimer(steps - 1); +    } +  } + +  advanceTimersByTime(msToRun) { +    this._checkFakeTimers(); // Only run a generous number of timers and then bail. +    // This is just to help avoid recursive loops + +    let i; + +    for (i = 0; i < this._maxLoops; i++) { +      const timerHandle = this._getNextTimerHandle(); // If there are no more timer handles, stop! + +      if (timerHandle === null) { +        break; +      } + +      const timerValue = this._timers.get(timerHandle); + +      if (timerValue === undefined) { +        break; +      } + +      const nextTimerExpiry = timerValue.expiry; + +      if (this._now + msToRun < nextTimerExpiry) { +        // There are no timers between now and the target we're running to, so +        // adjust our time cursor and quit +        this._now += msToRun; +        break; +      } else { +        msToRun -= nextTimerExpiry - this._now; +        this._now = nextTimerExpiry; + +        this._runTimerHandle(timerHandle); +      } +    } + +    if (i === this._maxLoops) { +      throw new Error( +        'Ran ' + +          this._maxLoops + +          ' timers, and there are still more! ' + +          "Assuming we've hit an infinite recursion and bailing out..." +      ); +    } +  } + +  runWithRealTimers(cb) { +    const prevClearImmediate = this._global.clearImmediate; +    const prevClearInterval = this._global.clearInterval; +    const prevClearTimeout = this._global.clearTimeout; +    const prevNextTick = this._global.process.nextTick; +    const prevSetImmediate = this._global.setImmediate; +    const prevSetInterval = this._global.setInterval; +    const prevSetTimeout = this._global.setTimeout; +    this.useRealTimers(); +    let cbErr = null; +    let errThrown = false; + +    try { +      cb(); +    } catch (e) { +      errThrown = true; +      cbErr = e; +    } + +    this._global.clearImmediate = prevClearImmediate; +    this._global.clearInterval = prevClearInterval; +    this._global.clearTimeout = prevClearTimeout; +    this._global.process.nextTick = prevNextTick; +    this._global.setImmediate = prevSetImmediate; +    this._global.setInterval = prevSetInterval; +    this._global.setTimeout = prevSetTimeout; + +    if (errThrown) { +      throw cbErr; +    } +  } + +  useRealTimers() { +    const global = this._global; + +    if (typeof global.cancelAnimationFrame === 'function') { +      (0, _jestUtil().setGlobal)( +        global, +        'cancelAnimationFrame', +        this._timerAPIs.cancelAnimationFrame +      ); +    } + +    if (typeof global.clearImmediate === 'function') { +      (0, _jestUtil().setGlobal)( +        global, +        'clearImmediate', +        this._timerAPIs.clearImmediate +      ); +    } + +    (0, _jestUtil().setGlobal)( +      global, +      'clearInterval', +      this._timerAPIs.clearInterval +    ); +    (0, _jestUtil().setGlobal)( +      global, +      'clearTimeout', +      this._timerAPIs.clearTimeout +    ); + +    if (typeof global.requestAnimationFrame === 'function') { +      (0, _jestUtil().setGlobal)( +        global, +        'requestAnimationFrame', +        this._timerAPIs.requestAnimationFrame +      ); +    } + +    if (typeof global.setImmediate === 'function') { +      (0, _jestUtil().setGlobal)( +        global, +        'setImmediate', +        this._timerAPIs.setImmediate +      ); +    } + +    (0, _jestUtil().setGlobal)( +      global, +      'setInterval', +      this._timerAPIs.setInterval +    ); +    (0, _jestUtil().setGlobal)( +      global, +      'setTimeout', +      this._timerAPIs.setTimeout +    ); +    global.process.nextTick = this._timerAPIs.nextTick; +  } + +  useFakeTimers() { +    this._createMocks(); + +    const global = this._global; + +    if (typeof global.cancelAnimationFrame === 'function') { +      (0, _jestUtil().setGlobal)( +        global, +        'cancelAnimationFrame', +        this._fakeTimerAPIs.cancelAnimationFrame +      ); +    } + +    if (typeof global.clearImmediate === 'function') { +      (0, _jestUtil().setGlobal)( +        global, +        'clearImmediate', +        this._fakeTimerAPIs.clearImmediate +      ); +    } + +    (0, _jestUtil().setGlobal)( +      global, +      'clearInterval', +      this._fakeTimerAPIs.clearInterval +    ); +    (0, _jestUtil().setGlobal)( +      global, +      'clearTimeout', +      this._fakeTimerAPIs.clearTimeout +    ); + +    if (typeof global.requestAnimationFrame === 'function') { +      (0, _jestUtil().setGlobal)( +        global, +        'requestAnimationFrame', +        this._fakeTimerAPIs.requestAnimationFrame +      ); +    } + +    if (typeof global.setImmediate === 'function') { +      (0, _jestUtil().setGlobal)( +        global, +        'setImmediate', +        this._fakeTimerAPIs.setImmediate +      ); +    } + +    (0, _jestUtil().setGlobal)( +      global, +      'setInterval', +      this._fakeTimerAPIs.setInterval +    ); +    (0, _jestUtil().setGlobal)( +      global, +      'setTimeout', +      this._fakeTimerAPIs.setTimeout +    ); +    global.process.nextTick = this._fakeTimerAPIs.nextTick; +  } + +  getTimerCount() { +    this._checkFakeTimers(); + +    return this._timers.size + this._immediates.length + this._ticks.length; +  } + +  _checkFakeTimers() { +    var _this$_fakeTimerAPIs; + +    if ( +      this._global.setTimeout !== +      ((_this$_fakeTimerAPIs = this._fakeTimerAPIs) === null || +      _this$_fakeTimerAPIs === void 0 +        ? void 0 +        : _this$_fakeTimerAPIs.setTimeout) +    ) { +      this._global.console.warn( +        'A function to advance timers was called but the timers API is not ' + +          'mocked with fake timers. Call `jest.useFakeTimers()` in this ' + +          'test or enable fake timers globally by setting ' + +          '`"timers": "fake"` in ' + +          'the configuration file. This warning is likely a result of a ' + +          'default configuration change in Jest 15.\n\n' + +          'Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15\n' + +          'Stack Trace:\n' + +          (0, _jestMessageUtil().formatStackTrace)( +            new Error().stack, +            this._config, +            { +              noStackTrace: false +            } +          ) +      ); +    } +  } + +  _createMocks() { +    const fn = ( +      impl // @ts-expect-error TODO: figure out better typings here +    ) => this._moduleMocker.fn().mockImplementation(impl); + +    const promisifiableFakeSetTimeout = fn(this._fakeSetTimeout.bind(this)); // @ts-expect-error TODO: figure out better typings here + +    promisifiableFakeSetTimeout[_util().default.promisify.custom] = ( +      delay, +      arg +    ) => +      new Promise(resolve => promisifiableFakeSetTimeout(resolve, delay, arg)); // TODO: add better typings; these are mocks, but typed as regular timers + +    this._fakeTimerAPIs = { +      cancelAnimationFrame: fn(this._fakeClearTimer.bind(this)), +      clearImmediate: fn(this._fakeClearImmediate.bind(this)), +      clearInterval: fn(this._fakeClearTimer.bind(this)), +      clearTimeout: fn(this._fakeClearTimer.bind(this)), +      nextTick: fn(this._fakeNextTick.bind(this)), +      // @ts-expect-error TODO: figure out better typings here +      requestAnimationFrame: fn(this._fakeRequestAnimationFrame.bind(this)), +      // @ts-expect-error TODO: figure out better typings here +      setImmediate: fn(this._fakeSetImmediate.bind(this)), +      // @ts-expect-error TODO: figure out better typings here +      setInterval: fn(this._fakeSetInterval.bind(this)), +      // @ts-expect-error TODO: figure out better typings here +      setTimeout: promisifiableFakeSetTimeout +    }; +  } + +  _fakeClearTimer(timerRef) { +    const uuid = this._timerConfig.refToId(timerRef); + +    if (uuid) { +      this._timers.delete(String(uuid)); +    } +  } + +  _fakeClearImmediate(uuid) { +    this._immediates = this._immediates.filter( +      immediate => immediate.uuid !== uuid +    ); +  } + +  _fakeNextTick(callback, ...args) { +    if (this._disposed) { +      return; +    } + +    const uuid = String(this._uuidCounter++); + +    this._ticks.push({ +      callback: () => callback.apply(null, args), +      uuid +    }); + +    const cancelledTicks = this._cancelledTicks; + +    this._timerAPIs.nextTick(() => { +      if (!cancelledTicks.hasOwnProperty(uuid)) { +        // Callback may throw, so update the map prior calling. +        cancelledTicks[uuid] = true; +        callback.apply(null, args); +      } +    }); +  } + +  _fakeRequestAnimationFrame(callback) { +    return this._fakeSetTimeout(() => { +      // TODO: Use performance.now() once it's mocked +      callback(this._now); +    }, 1000 / 60); +  } + +  _fakeSetImmediate(callback, ...args) { +    if (this._disposed) { +      return null; +    } + +    const uuid = String(this._uuidCounter++); + +    this._immediates.push({ +      callback: () => callback.apply(null, args), +      uuid +    }); + +    this._timerAPIs.setImmediate(() => { +      if (this._immediates.find(x => x.uuid === uuid)) { +        try { +          callback.apply(null, args); +        } finally { +          this._fakeClearImmediate(uuid); +        } +      } +    }); + +    return uuid; +  } + +  _fakeSetInterval(callback, intervalDelay, ...args) { +    if (this._disposed) { +      return null; +    } + +    if (intervalDelay == null) { +      intervalDelay = 0; +    } + +    const uuid = this._uuidCounter++; + +    this._timers.set(String(uuid), { +      callback: () => callback.apply(null, args), +      expiry: this._now + intervalDelay, +      interval: intervalDelay, +      type: 'interval' +    }); + +    return this._timerConfig.idToRef(uuid); +  } + +  _fakeSetTimeout(callback, delay, ...args) { +    if (this._disposed) { +      return null; +    } // eslint-disable-next-line no-bitwise + +    delay = Number(delay) | 0; +    const uuid = this._uuidCounter++; + +    this._timers.set(String(uuid), { +      callback: () => callback.apply(null, args), +      expiry: this._now + delay, +      interval: undefined, +      type: 'timeout' +    }); + +    return this._timerConfig.idToRef(uuid); +  } + +  _getNextTimerHandle() { +    let nextTimerHandle = null; +    let soonestTime = MS_IN_A_YEAR; + +    this._timers.forEach((timer, uuid) => { +      if (timer.expiry < soonestTime) { +        soonestTime = timer.expiry; +        nextTimerHandle = uuid; +      } +    }); + +    return nextTimerHandle; +  } + +  _runTimerHandle(timerHandle) { +    const timer = this._timers.get(timerHandle); + +    if (!timer) { +      return; +    } + +    switch (timer.type) { +      case 'timeout': +        this._timers.delete(timerHandle); + +        timer.callback(); +        break; + +      case 'interval': +        timer.expiry = this._now + (timer.interval || 0); +        timer.callback(); +        break; + +      default: +        throw new Error('Unexpected timer type: ' + timer.type); +    } +  } +} + +exports.default = FakeTimers; diff --git a/node_modules/@jest/fake-timers/build/modernFakeTimers.d.ts b/node_modules/@jest/fake-timers/build/modernFakeTimers.d.ts new file mode 100644 index 0000000..b7cefc4 --- /dev/null +++ b/node_modules/@jest/fake-timers/build/modernFakeTimers.d.ts @@ -0,0 +1,34 @@ +/** + * 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 { StackTraceConfig } from 'jest-message-util'; +export default class FakeTimers { +    private _clock; +    private _config; +    private _fakingTime; +    private _global; +    private _fakeTimers; +    private _maxLoops; +    constructor({ global, config, maxLoops, }: { +        global: typeof globalThis; +        config: StackTraceConfig; +        maxLoops?: number; +    }); +    clearAllTimers(): void; +    dispose(): void; +    runAllTimers(): void; +    runOnlyPendingTimers(): void; +    advanceTimersToNextTimer(steps?: number): void; +    advanceTimersByTime(msToRun: number): void; +    runAllTicks(): void; +    useRealTimers(): void; +    useFakeTimers(): void; +    reset(): void; +    setSystemTime(now?: number | Date): void; +    getRealSystemTime(): number; +    getTimerCount(): number; +    private _checkFakeTimers; +} diff --git a/node_modules/@jest/fake-timers/build/modernFakeTimers.js b/node_modules/@jest/fake-timers/build/modernFakeTimers.js new file mode 100644 index 0000000..9e1963e --- /dev/null +++ b/node_modules/@jest/fake-timers/build/modernFakeTimers.js @@ -0,0 +1,181 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _fakeTimers() { +  const data = require('@sinonjs/fake-timers'); + +  _fakeTimers = function () { +    return data; +  }; + +  return data; +} + +function _jestMessageUtil() { +  const data = require('jest-message-util'); + +  _jestMessageUtil = function () { +    return data; +  }; + +  return data; +} + +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 FakeTimers { +  constructor({global, config, maxLoops}) { +    _defineProperty(this, '_clock', void 0); + +    _defineProperty(this, '_config', void 0); + +    _defineProperty(this, '_fakingTime', void 0); + +    _defineProperty(this, '_global', void 0); + +    _defineProperty(this, '_fakeTimers', void 0); + +    _defineProperty(this, '_maxLoops', void 0); + +    this._global = global; +    this._config = config; +    this._maxLoops = maxLoops || 100000; +    this._fakingTime = false; +    this._fakeTimers = (0, _fakeTimers().withGlobal)(global); +  } + +  clearAllTimers() { +    if (this._fakingTime) { +      this._clock.reset(); +    } +  } + +  dispose() { +    this.useRealTimers(); +  } + +  runAllTimers() { +    if (this._checkFakeTimers()) { +      this._clock.runAll(); +    } +  } + +  runOnlyPendingTimers() { +    if (this._checkFakeTimers()) { +      this._clock.runToLast(); +    } +  } + +  advanceTimersToNextTimer(steps = 1) { +    if (this._checkFakeTimers()) { +      for (let i = steps; i > 0; i--) { +        this._clock.next(); // Fire all timers at this point: https://github.com/sinonjs/fake-timers/issues/250 + +        this._clock.tick(0); + +        if (this._clock.countTimers() === 0) { +          break; +        } +      } +    } +  } + +  advanceTimersByTime(msToRun) { +    if (this._checkFakeTimers()) { +      this._clock.tick(msToRun); +    } +  } + +  runAllTicks() { +    if (this._checkFakeTimers()) { +      // @ts-expect-error +      this._clock.runMicrotasks(); +    } +  } + +  useRealTimers() { +    if (this._fakingTime) { +      this._clock.uninstall(); + +      this._fakingTime = false; +    } +  } + +  useFakeTimers() { +    if (!this._fakingTime) { +      const toFake = Object.keys(this._fakeTimers.timers); +      this._clock = this._fakeTimers.install({ +        loopLimit: this._maxLoops, +        now: Date.now(), +        toFake +      }); +      this._fakingTime = true; +    } +  } + +  reset() { +    if (this._checkFakeTimers()) { +      const {now} = this._clock; + +      this._clock.reset(); + +      this._clock.setSystemTime(now); +    } +  } + +  setSystemTime(now) { +    if (this._checkFakeTimers()) { +      this._clock.setSystemTime(now); +    } +  } + +  getRealSystemTime() { +    return Date.now(); +  } + +  getTimerCount() { +    if (this._checkFakeTimers()) { +      return this._clock.countTimers(); +    } + +    return 0; +  } + +  _checkFakeTimers() { +    if (!this._fakingTime) { +      this._global.console.warn( +        'A function to advance timers was called but the timers API is not ' + +          'mocked with fake timers. Call `jest.useFakeTimers()` in this test or ' + +          'enable fake timers globally by setting `"timers": "fake"` in the ' + +          'configuration file\nStack Trace:\n' + +          (0, _jestMessageUtil().formatStackTrace)( +            new Error().stack, +            this._config, +            { +              noStackTrace: false +            } +          ) +      ); +    } + +    return this._fakingTime; +  } +} + +exports.default = FakeTimers; diff --git a/node_modules/@jest/fake-timers/package.json b/node_modules/@jest/fake-timers/package.json new file mode 100644 index 0000000..861e2ce --- /dev/null +++ b/node_modules/@jest/fake-timers/package.json @@ -0,0 +1,37 @@ +{ +  "name": "@jest/fake-timers", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-fake-timers" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@jest/types": "^27.5.1", +    "@sinonjs/fake-timers": "^8.0.1", +    "@types/node": "*", +    "jest-message-util": "^27.5.1", +    "jest-mock": "^27.5.1", +    "jest-util": "^27.5.1" +  }, +  "devDependencies": { +    "@types/sinonjs__fake-timers": "^8.1.1" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/globals/LICENSE b/node_modules/@jest/globals/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/globals/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/globals/build/index.d.ts b/node_modules/@jest/globals/build/index.d.ts new file mode 100644 index 0000000..1cc83b8 --- /dev/null +++ b/node_modules/@jest/globals/build/index.d.ts @@ -0,0 +1,23 @@ +/** + * 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 { Jest } from '@jest/environment'; +import type { Global } from '@jest/types'; +import importedExpect = require('expect'); +export declare const jest: Jest; +export declare const expect: typeof importedExpect; +export declare const it: Global.GlobalAdditions['it']; +export declare const test: Global.GlobalAdditions['test']; +export declare const fit: Global.GlobalAdditions['fit']; +export declare const xit: Global.GlobalAdditions['xit']; +export declare const xtest: Global.GlobalAdditions['xtest']; +export declare const describe: Global.GlobalAdditions['describe']; +export declare const xdescribe: Global.GlobalAdditions['xdescribe']; +export declare const fdescribe: Global.GlobalAdditions['fdescribe']; +export declare const beforeAll: Global.GlobalAdditions['beforeAll']; +export declare const beforeEach: Global.GlobalAdditions['beforeEach']; +export declare const afterEach: Global.GlobalAdditions['afterEach']; +export declare const afterAll: Global.GlobalAdditions['afterAll']; diff --git a/node_modules/@jest/globals/build/index.js b/node_modules/@jest/globals/build/index.js new file mode 100644 index 0000000..06f90c1 --- /dev/null +++ b/node_modules/@jest/globals/build/index.js @@ -0,0 +1,25 @@ +'use strict'; + +function _expect() { +  const data = _interopRequireDefault(require('expect')); + +  _expect = function () { +    return data; +  }; + +  return data; +} + +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. + */ +throw new Error( +  'Do not import `@jest/globals` outside of the Jest test environment' +); diff --git a/node_modules/@jest/globals/package.json b/node_modules/@jest/globals/package.json new file mode 100644 index 0000000..9cadc9b --- /dev/null +++ b/node_modules/@jest/globals/package.json @@ -0,0 +1,31 @@ +{ +  "name": "@jest/globals", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-globals" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@jest/environment": "^27.5.1", +    "@jest/types": "^27.5.1", +    "expect": "^27.5.1" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/reporters/LICENSE b/node_modules/@jest/reporters/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/reporters/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/reporters/build/BaseReporter.d.ts b/node_modules/@jest/reporters/build/BaseReporter.d.ts new file mode 100644 index 0000000..17b36a0 --- /dev/null +++ b/node_modules/@jest/reporters/build/BaseReporter.d.ts @@ -0,0 +1,19 @@ +/** + * 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 { AggregatedResult, TestCaseResult, TestResult } from '@jest/test-result'; +import type { Context, Reporter, ReporterOnStartOptions, Test } from './types'; +export default class BaseReporter implements Reporter { +    private _error?; +    log(message: string): void; +    onRunStart(_results?: AggregatedResult, _options?: ReporterOnStartOptions): void; +    onTestCaseResult(_test: Test, _testCaseResult: TestCaseResult): void; +    onTestResult(_test?: Test, _testResult?: TestResult, _results?: AggregatedResult): void; +    onTestStart(_test?: Test): void; +    onRunComplete(_contexts?: Set<Context>, _aggregatedResults?: AggregatedResult): Promise<void> | void; +    protected _setError(error: Error): void; +    getLastError(): Error | undefined; +} diff --git a/node_modules/@jest/reporters/build/BaseReporter.js b/node_modules/@jest/reporters/build/BaseReporter.js new file mode 100644 index 0000000..d457307 --- /dev/null +++ b/node_modules/@jest/reporters/build/BaseReporter.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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 {remove: preRunMessageRemove} = _jestUtil().preRunMessage; + +class BaseReporter { +  constructor() { +    _defineProperty(this, '_error', void 0); +  } + +  log(message) { +    process.stderr.write(message + '\n'); +  } + +  onRunStart(_results, _options) { +    preRunMessageRemove(process.stderr); +  } + +  onTestCaseResult(_test, _testCaseResult) {} + +  onTestResult(_test, _testResult, _results) {} + +  onTestStart(_test) {} + +  onRunComplete(_contexts, _aggregatedResults) {} + +  _setError(error) { +    this._error = error; +  } // Return an error that occurred during reporting. This error will +  // define whether the test run was successful or failed. + +  getLastError() { +    return this._error; +  } +} + +exports.default = BaseReporter; diff --git a/node_modules/@jest/reporters/build/CoverageReporter.d.ts b/node_modules/@jest/reporters/build/CoverageReporter.d.ts new file mode 100644 index 0000000..fd600f3 --- /dev/null +++ b/node_modules/@jest/reporters/build/CoverageReporter.d.ts @@ -0,0 +1,24 @@ +/** + * 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 { AggregatedResult, TestResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import BaseReporter from './BaseReporter'; +import type { Context, CoverageReporterOptions, Test } from './types'; +export default class CoverageReporter extends BaseReporter { +    private _coverageMap; +    private _globalConfig; +    private _sourceMapStore; +    private _options; +    private _v8CoverageResults; +    static readonly filename: string; +    constructor(globalConfig: Config.GlobalConfig, options?: CoverageReporterOptions); +    onTestResult(_test: Test, testResult: TestResult): void; +    onRunComplete(contexts: Set<Context>, aggregatedResults: AggregatedResult): Promise<void>; +    private _addUntestedFiles; +    private _checkThreshold; +    private _getCoverageResult; +} diff --git a/node_modules/@jest/reporters/build/CoverageReporter.js b/node_modules/@jest/reporters/build/CoverageReporter.js new file mode 100644 index 0000000..4ea3f0e --- /dev/null +++ b/node_modules/@jest/reporters/build/CoverageReporter.js @@ -0,0 +1,668 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function path() { +  const data = _interopRequireWildcard(require('path')); + +  path = function () { +    return data; +  }; + +  return data; +} + +function _v8Coverage() { +  const data = require('@bcoe/v8-coverage'); + +  _v8Coverage = function () { +    return data; +  }; + +  return data; +} + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _glob() { +  const data = _interopRequireDefault(require('glob')); + +  _glob = function () { +    return data; +  }; + +  return data; +} + +function fs() { +  const data = _interopRequireWildcard(require('graceful-fs')); + +  fs = function () { +    return data; +  }; + +  return data; +} + +function _istanbulLibCoverage() { +  const data = _interopRequireDefault(require('istanbul-lib-coverage')); + +  _istanbulLibCoverage = function () { +    return data; +  }; + +  return data; +} + +function _istanbulLibReport() { +  const data = _interopRequireDefault(require('istanbul-lib-report')); + +  _istanbulLibReport = function () { +    return data; +  }; + +  return data; +} + +function _istanbulLibSourceMaps() { +  const data = _interopRequireDefault(require('istanbul-lib-source-maps')); + +  _istanbulLibSourceMaps = function () { +    return data; +  }; + +  return data; +} + +function _istanbulReports() { +  const data = _interopRequireDefault(require('istanbul-reports')); + +  _istanbulReports = function () { +    return data; +  }; + +  return data; +} + +function _v8ToIstanbul() { +  const data = _interopRequireDefault(require('v8-to-istanbul')); + +  _v8ToIstanbul = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestWorker() { +  const data = require('jest-worker'); + +  _jestWorker = function () { +    return data; +  }; + +  return data; +} + +var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); + +var _getWatermarks = _interopRequireDefault(require('./getWatermarks')); + +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; +} + +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 FAIL_COLOR = _chalk().default.bold.red; + +const RUNNING_TEST_COLOR = _chalk().default.bold.dim; + +class CoverageReporter extends _BaseReporter.default { +  constructor(globalConfig, options) { +    super(); + +    _defineProperty(this, '_coverageMap', void 0); + +    _defineProperty(this, '_globalConfig', void 0); + +    _defineProperty(this, '_sourceMapStore', void 0); + +    _defineProperty(this, '_options', void 0); + +    _defineProperty(this, '_v8CoverageResults', void 0); + +    this._coverageMap = _istanbulLibCoverage().default.createCoverageMap({}); +    this._globalConfig = globalConfig; +    this._sourceMapStore = +      _istanbulLibSourceMaps().default.createSourceMapStore(); +    this._v8CoverageResults = []; +    this._options = options || {}; +  } + +  onTestResult(_test, testResult) { +    if (testResult.v8Coverage) { +      this._v8CoverageResults.push(testResult.v8Coverage); + +      return; +    } + +    if (testResult.coverage) { +      this._coverageMap.merge(testResult.coverage); +    } +  } + +  async onRunComplete(contexts, aggregatedResults) { +    await this._addUntestedFiles(contexts); +    const {map, reportContext} = await this._getCoverageResult(); + +    try { +      const coverageReporters = this._globalConfig.coverageReporters || []; + +      if (!this._globalConfig.useStderr && coverageReporters.length < 1) { +        coverageReporters.push('text-summary'); +      } + +      coverageReporters.forEach(reporter => { +        let additionalOptions = {}; + +        if (Array.isArray(reporter)) { +          [reporter, additionalOptions] = reporter; +        } + +        _istanbulReports() +          .default.create(reporter, { +            maxCols: process.stdout.columns || Infinity, +            ...additionalOptions +          }) +          .execute(reportContext); +      }); +      aggregatedResults.coverageMap = map; +    } catch (e) { +      console.error( +        _chalk().default.red(` +        Failed to write coverage reports: +        ERROR: ${e.toString()} +        STACK: ${e.stack} +      `) +      ); +    } + +    this._checkThreshold(map); +  } + +  async _addUntestedFiles(contexts) { +    const files = []; +    contexts.forEach(context => { +      const config = context.config; + +      if ( +        this._globalConfig.collectCoverageFrom && +        this._globalConfig.collectCoverageFrom.length +      ) { +        context.hasteFS +          .matchFilesWithGlob( +            this._globalConfig.collectCoverageFrom, +            config.rootDir +          ) +          .forEach(filePath => +            files.push({ +              config, +              path: filePath +            }) +          ); +      } +    }); + +    if (!files.length) { +      return; +    } + +    if (_jestUtil().isInteractive) { +      process.stderr.write( +        RUNNING_TEST_COLOR('Running coverage on untested files...') +      ); +    } + +    let worker; + +    if (this._globalConfig.maxWorkers <= 1) { +      worker = require('./CoverageWorker'); +    } else { +      worker = new (_jestWorker().Worker)(require.resolve('./CoverageWorker'), { +        exposedMethods: ['worker'], +        maxRetries: 2, +        numWorkers: this._globalConfig.maxWorkers +      }); +    } + +    const instrumentation = files.map(async fileObj => { +      const filename = fileObj.path; +      const config = fileObj.config; + +      const hasCoverageData = this._v8CoverageResults.some(v8Res => +        v8Res.some(innerRes => innerRes.result.url === filename) +      ); + +      if ( +        !hasCoverageData && +        !this._coverageMap.data[filename] && +        'worker' in worker +      ) { +        try { +          const result = await worker.worker({ +            config, +            globalConfig: this._globalConfig, +            options: { +              ...this._options, +              changedFiles: +                this._options.changedFiles && +                Array.from(this._options.changedFiles), +              sourcesRelatedToTestsInChangedFiles: +                this._options.sourcesRelatedToTestsInChangedFiles && +                Array.from(this._options.sourcesRelatedToTestsInChangedFiles) +            }, +            path: filename +          }); + +          if (result) { +            if (result.kind === 'V8Coverage') { +              this._v8CoverageResults.push([ +                { +                  codeTransformResult: undefined, +                  result: result.result +                } +              ]); +            } else { +              this._coverageMap.addFileCoverage(result.coverage); +            } +          } +        } catch (error) { +          console.error( +            _chalk().default.red( +              [ +                `Failed to collect coverage from ${filename}`, +                `ERROR: ${error.message}`, +                `STACK: ${error.stack}` +              ].join('\n') +            ) +          ); +        } +      } +    }); + +    try { +      await Promise.all(instrumentation); +    } catch { +      // Do nothing; errors were reported earlier to the console. +    } + +    if (_jestUtil().isInteractive) { +      (0, _jestUtil().clearLine)(process.stderr); +    } + +    if (worker && 'end' in worker && typeof worker.end === 'function') { +      await worker.end(); +    } +  } + +  _checkThreshold(map) { +    const {coverageThreshold} = this._globalConfig; + +    if (coverageThreshold) { +      function check(name, thresholds, actuals) { +        return ['statements', 'branches', 'lines', 'functions'].reduce( +          (errors, key) => { +            const actual = actuals[key].pct; +            const actualUncovered = actuals[key].total - actuals[key].covered; +            const threshold = thresholds[key]; + +            if (threshold !== undefined) { +              if (threshold < 0) { +                if (threshold * -1 < actualUncovered) { +                  errors.push( +                    `Jest: Uncovered count for ${key} (${actualUncovered}) ` + +                      `exceeds ${name} threshold (${-1 * threshold})` +                  ); +                } +              } else if (actual < threshold) { +                errors.push( +                  `Jest: "${name}" coverage threshold for ${key} (${threshold}%) not met: ${actual}%` +                ); +              } +            } + +            return errors; +          }, +          [] +        ); +      } + +      const THRESHOLD_GROUP_TYPES = { +        GLOB: 'glob', +        GLOBAL: 'global', +        PATH: 'path' +      }; +      const coveredFiles = map.files(); +      const thresholdGroups = Object.keys(coverageThreshold); +      const groupTypeByThresholdGroup = {}; +      const filesByGlob = {}; +      const coveredFilesSortedIntoThresholdGroup = coveredFiles.reduce( +        (files, file) => { +          const pathOrGlobMatches = thresholdGroups.reduce( +            (agg, thresholdGroup) => { +              const absoluteThresholdGroup = path().resolve(thresholdGroup); // The threshold group might be a path: + +              if (file.indexOf(absoluteThresholdGroup) === 0) { +                groupTypeByThresholdGroup[thresholdGroup] = +                  THRESHOLD_GROUP_TYPES.PATH; +                return agg.concat([[file, thresholdGroup]]); +              } // If the threshold group is not a path it might be a glob: +              // Note: glob.sync is slow. By memoizing the files matching each glob +              // (rather than recalculating it for each covered file) we save a tonne +              // of execution time. + +              if (filesByGlob[absoluteThresholdGroup] === undefined) { +                filesByGlob[absoluteThresholdGroup] = _glob() +                  .default.sync(absoluteThresholdGroup) +                  .map(filePath => path().resolve(filePath)); +              } + +              if (filesByGlob[absoluteThresholdGroup].indexOf(file) > -1) { +                groupTypeByThresholdGroup[thresholdGroup] = +                  THRESHOLD_GROUP_TYPES.GLOB; +                return agg.concat([[file, thresholdGroup]]); +              } + +              return agg; +            }, +            [] +          ); + +          if (pathOrGlobMatches.length > 0) { +            return files.concat(pathOrGlobMatches); +          } // Neither a glob or a path? Toss it in global if there's a global threshold: + +          if (thresholdGroups.indexOf(THRESHOLD_GROUP_TYPES.GLOBAL) > -1) { +            groupTypeByThresholdGroup[THRESHOLD_GROUP_TYPES.GLOBAL] = +              THRESHOLD_GROUP_TYPES.GLOBAL; +            return files.concat([[file, THRESHOLD_GROUP_TYPES.GLOBAL]]); +          } // A covered file that doesn't have a threshold: + +          return files.concat([[file, undefined]]); +        }, +        [] +      ); + +      const getFilesInThresholdGroup = thresholdGroup => +        coveredFilesSortedIntoThresholdGroup +          .filter(fileAndGroup => fileAndGroup[1] === thresholdGroup) +          .map(fileAndGroup => fileAndGroup[0]); + +      function combineCoverage(filePaths) { +        return filePaths +          .map(filePath => map.fileCoverageFor(filePath)) +          .reduce((combinedCoverage, nextFileCoverage) => { +            if (combinedCoverage === undefined || combinedCoverage === null) { +              return nextFileCoverage.toSummary(); +            } + +            return combinedCoverage.merge(nextFileCoverage.toSummary()); +          }, undefined); +      } + +      let errors = []; +      thresholdGroups.forEach(thresholdGroup => { +        switch (groupTypeByThresholdGroup[thresholdGroup]) { +          case THRESHOLD_GROUP_TYPES.GLOBAL: { +            const coverage = combineCoverage( +              getFilesInThresholdGroup(THRESHOLD_GROUP_TYPES.GLOBAL) +            ); + +            if (coverage) { +              errors = errors.concat( +                check( +                  thresholdGroup, +                  coverageThreshold[thresholdGroup], +                  coverage +                ) +              ); +            } + +            break; +          } + +          case THRESHOLD_GROUP_TYPES.PATH: { +            const coverage = combineCoverage( +              getFilesInThresholdGroup(thresholdGroup) +            ); + +            if (coverage) { +              errors = errors.concat( +                check( +                  thresholdGroup, +                  coverageThreshold[thresholdGroup], +                  coverage +                ) +              ); +            } + +            break; +          } + +          case THRESHOLD_GROUP_TYPES.GLOB: +            getFilesInThresholdGroup(thresholdGroup).forEach( +              fileMatchingGlob => { +                errors = errors.concat( +                  check( +                    fileMatchingGlob, +                    coverageThreshold[thresholdGroup], +                    map.fileCoverageFor(fileMatchingGlob).toSummary() +                  ) +                ); +              } +            ); +            break; + +          default: +            // If the file specified by path is not found, error is returned. +            if (thresholdGroup !== THRESHOLD_GROUP_TYPES.GLOBAL) { +              errors = errors.concat( +                `Jest: Coverage data for ${thresholdGroup} was not found.` +              ); +            } + +          // Sometimes all files in the coverage data are matched by +          // PATH and GLOB threshold groups in which case, don't error when +          // the global threshold group doesn't match any files. +        } +      }); +      errors = errors.filter( +        err => err !== undefined && err !== null && err.length > 0 +      ); + +      if (errors.length > 0) { +        this.log(`${FAIL_COLOR(errors.join('\n'))}`); + +        this._setError(new Error(errors.join('\n'))); +      } +    } +  } + +  async _getCoverageResult() { +    if (this._globalConfig.coverageProvider === 'v8') { +      const mergedCoverages = (0, _v8Coverage().mergeProcessCovs)( +        this._v8CoverageResults.map(cov => ({ +          result: cov.map(r => r.result) +        })) +      ); +      const fileTransforms = new Map(); + +      this._v8CoverageResults.forEach(res => +        res.forEach(r => { +          if (r.codeTransformResult && !fileTransforms.has(r.result.url)) { +            fileTransforms.set(r.result.url, r.codeTransformResult); +          } +        }) +      ); + +      const transformedCoverage = await Promise.all( +        mergedCoverages.result.map(async res => { +          var _fileTransform$wrappe; + +          const fileTransform = fileTransforms.get(res.url); +          let sourcemapContent = undefined; + +          if ( +            fileTransform !== null && +            fileTransform !== void 0 && +            fileTransform.sourceMapPath && +            fs().existsSync(fileTransform.sourceMapPath) +          ) { +            sourcemapContent = JSON.parse( +              fs().readFileSync(fileTransform.sourceMapPath, 'utf8') +            ); +          } + +          const converter = (0, _v8ToIstanbul().default)( +            res.url, +            (_fileTransform$wrappe = +              fileTransform === null || fileTransform === void 0 +                ? void 0 +                : fileTransform.wrapperLength) !== null && +              _fileTransform$wrappe !== void 0 +              ? _fileTransform$wrappe +              : 0, +            fileTransform && sourcemapContent +              ? { +                  originalSource: fileTransform.originalCode, +                  source: fileTransform.code, +                  sourceMap: { +                    sourcemap: { +                      file: res.url, +                      ...sourcemapContent +                    } +                  } +                } +              : { +                  source: fs().readFileSync(res.url, 'utf8') +                } +          ); +          await converter.load(); +          converter.applyCoverage(res.functions); +          const istanbulData = converter.toIstanbul(); +          converter.destroy(); +          return istanbulData; +        }) +      ); + +      const map = _istanbulLibCoverage().default.createCoverageMap({}); + +      transformedCoverage.forEach(res => map.merge(res)); + +      const reportContext = _istanbulLibReport().default.createContext({ +        coverageMap: map, +        dir: this._globalConfig.coverageDirectory, +        watermarks: (0, _getWatermarks.default)(this._globalConfig) +      }); + +      return { +        map, +        reportContext +      }; +    } + +    const map = await this._sourceMapStore.transformCoverage(this._coverageMap); + +    const reportContext = _istanbulLibReport().default.createContext({ +      coverageMap: map, +      dir: this._globalConfig.coverageDirectory, +      sourceFinder: this._sourceMapStore.sourceFinder, +      watermarks: (0, _getWatermarks.default)(this._globalConfig) +    }); + +    return { +      map, +      reportContext +    }; +  } +} + +exports.default = CoverageReporter; + +_defineProperty(CoverageReporter, 'filename', __filename); diff --git a/node_modules/@jest/reporters/build/CoverageWorker.d.ts b/node_modules/@jest/reporters/build/CoverageWorker.d.ts new file mode 100644 index 0000000..068ad0f --- /dev/null +++ b/node_modules/@jest/reporters/build/CoverageWorker.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. + */ +import type { Config } from '@jest/types'; +import { CoverageWorkerResult } from './generateEmptyCoverage'; +import type { CoverageReporterSerializedOptions } from './types'; +export declare type CoverageWorkerData = { +    globalConfig: Config.GlobalConfig; +    config: Config.ProjectConfig; +    path: Config.Path; +    options?: CoverageReporterSerializedOptions; +}; +export type { CoverageWorkerResult }; +export declare function worker({ config, globalConfig, path, options, }: CoverageWorkerData): Promise<CoverageWorkerResult | null>; diff --git a/node_modules/@jest/reporters/build/CoverageWorker.js b/node_modules/@jest/reporters/build/CoverageWorker.js new file mode 100644 index 0000000..24de6c6 --- /dev/null +++ b/node_modules/@jest/reporters/build/CoverageWorker.js @@ -0,0 +1,103 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.worker = worker; + +function _exit() { +  const data = _interopRequireDefault(require('exit')); + +  _exit = function () { +    return data; +  }; + +  return data; +} + +function fs() { +  const data = _interopRequireWildcard(require('graceful-fs')); + +  fs = function () { +    return data; +  }; + +  return data; +} + +var _generateEmptyCoverage = _interopRequireDefault( +  require('./generateEmptyCoverage') +); + +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; +} + +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. + */ +// Make sure uncaught errors are logged before we exit. +process.on('uncaughtException', err => { +  console.error(err.stack); +  (0, _exit().default)(1); +}); + +function worker({config, globalConfig, path, options}) { +  return (0, _generateEmptyCoverage.default)( +    fs().readFileSync(path, 'utf8'), +    path, +    globalConfig, +    config, +    (options === null || options === void 0 ? void 0 : options.changedFiles) && +      new Set(options.changedFiles), +    (options === null || options === void 0 +      ? void 0 +      : options.sourcesRelatedToTestsInChangedFiles) && +      new Set(options.sourcesRelatedToTestsInChangedFiles) +  ); +} diff --git a/node_modules/@jest/reporters/build/DefaultReporter.d.ts b/node_modules/@jest/reporters/build/DefaultReporter.d.ts new file mode 100644 index 0000000..bb346ba --- /dev/null +++ b/node_modules/@jest/reporters/build/DefaultReporter.d.ts @@ -0,0 +1,33 @@ +/** + * 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 { AggregatedResult, TestCaseResult, TestResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import BaseReporter from './BaseReporter'; +import type { ReporterOnStartOptions, Test } from './types'; +export default class DefaultReporter extends BaseReporter { +    private _clear; +    private _err; +    protected _globalConfig: Config.GlobalConfig; +    private _out; +    private _status; +    private _bufferedOutput; +    static readonly filename: string; +    constructor(globalConfig: Config.GlobalConfig); +    protected __wrapStdio(stream: NodeJS.WritableStream | NodeJS.WriteStream): void; +    forceFlushBufferedOutput(): void; +    protected __clearStatus(): void; +    protected __printStatus(): void; +    onRunStart(aggregatedResults: AggregatedResult, options: ReporterOnStartOptions): void; +    onTestStart(test: Test): void; +    onTestCaseResult(test: Test, testCaseResult: TestCaseResult): void; +    onRunComplete(): void; +    onTestResult(test: Test, testResult: TestResult, aggregatedResults: AggregatedResult): void; +    testFinished(config: Config.ProjectConfig, testResult: TestResult, aggregatedResults: AggregatedResult): void; +    printTestFileHeader(_testPath: Config.Path, config: Config.ProjectConfig, result: TestResult): void; +    printTestFileFailureMessage(_testPath: Config.Path, _config: Config.ProjectConfig, result: TestResult): void; +} diff --git a/node_modules/@jest/reporters/build/DefaultReporter.js b/node_modules/@jest/reporters/build/DefaultReporter.js new file mode 100644 index 0000000..6349e68 --- /dev/null +++ b/node_modules/@jest/reporters/build/DefaultReporter.js @@ -0,0 +1,254 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _console() { +  const data = require('@jest/console'); + +  _console = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); + +var _Status = _interopRequireDefault(require('./Status')); + +var _getResultHeader = _interopRequireDefault(require('./getResultHeader')); + +var _getSnapshotStatus = _interopRequireDefault(require('./getSnapshotStatus')); + +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 TITLE_BULLET = _chalk().default.bold('\u25cf '); + +class DefaultReporter extends _BaseReporter.default { +  // ANSI clear sequence for the last printed status +  constructor(globalConfig) { +    super(); + +    _defineProperty(this, '_clear', void 0); + +    _defineProperty(this, '_err', void 0); + +    _defineProperty(this, '_globalConfig', void 0); + +    _defineProperty(this, '_out', void 0); + +    _defineProperty(this, '_status', void 0); + +    _defineProperty(this, '_bufferedOutput', void 0); + +    this._globalConfig = globalConfig; +    this._clear = ''; +    this._out = process.stdout.write.bind(process.stdout); +    this._err = process.stderr.write.bind(process.stderr); +    this._status = new _Status.default(); +    this._bufferedOutput = new Set(); + +    this.__wrapStdio(process.stdout); + +    this.__wrapStdio(process.stderr); + +    this._status.onChange(() => { +      this.__clearStatus(); + +      this.__printStatus(); +    }); +  } + +  __wrapStdio(stream) { +    const write = stream.write.bind(stream); +    let buffer = []; +    let timeout = null; + +    const flushBufferedOutput = () => { +      const string = buffer.join(''); +      buffer = []; // This is to avoid conflicts between random output and status text + +      this.__clearStatus(); + +      if (string) { +        write(string); +      } + +      this.__printStatus(); + +      this._bufferedOutput.delete(flushBufferedOutput); +    }; + +    this._bufferedOutput.add(flushBufferedOutput); + +    const debouncedFlush = () => { +      // If the process blows up no errors would be printed. +      // There should be a smart way to buffer stderr, but for now +      // we just won't buffer it. +      if (stream === process.stderr) { +        flushBufferedOutput(); +      } else { +        if (!timeout) { +          timeout = setTimeout(() => { +            flushBufferedOutput(); +            timeout = null; +          }, 100); +        } +      } +    }; + +    stream.write = chunk => { +      buffer.push(chunk); +      debouncedFlush(); +      return true; +    }; +  } // Don't wait for the debounced call and flush all output immediately. + +  forceFlushBufferedOutput() { +    for (const flushBufferedOutput of this._bufferedOutput) { +      flushBufferedOutput(); +    } +  } + +  __clearStatus() { +    if (_jestUtil().isInteractive) { +      if (this._globalConfig.useStderr) { +        this._err(this._clear); +      } else { +        this._out(this._clear); +      } +    } +  } + +  __printStatus() { +    const {content, clear} = this._status.get(); + +    this._clear = clear; + +    if (_jestUtil().isInteractive) { +      if (this._globalConfig.useStderr) { +        this._err(content); +      } else { +        this._out(content); +      } +    } +  } + +  onRunStart(aggregatedResults, options) { +    this._status.runStarted(aggregatedResults, options); +  } + +  onTestStart(test) { +    this._status.testStarted(test.path, test.context.config); +  } + +  onTestCaseResult(test, testCaseResult) { +    this._status.addTestCaseResult(test, testCaseResult); +  } + +  onRunComplete() { +    this.forceFlushBufferedOutput(); + +    this._status.runFinished(); + +    process.stdout.write = this._out; +    process.stderr.write = this._err; +    (0, _jestUtil().clearLine)(process.stderr); +  } + +  onTestResult(test, testResult, aggregatedResults) { +    this.testFinished(test.context.config, testResult, aggregatedResults); + +    if (!testResult.skipped) { +      this.printTestFileHeader( +        testResult.testFilePath, +        test.context.config, +        testResult +      ); +      this.printTestFileFailureMessage( +        testResult.testFilePath, +        test.context.config, +        testResult +      ); +    } + +    this.forceFlushBufferedOutput(); +  } + +  testFinished(config, testResult, aggregatedResults) { +    this._status.testFinished(config, testResult, aggregatedResults); +  } + +  printTestFileHeader(_testPath, config, result) { +    this.log((0, _getResultHeader.default)(result, this._globalConfig, config)); + +    if (result.console) { +      this.log( +        '  ' + +          TITLE_BULLET + +          'Console\n\n' + +          (0, _console().getConsoleOutput)( +            result.console, +            config, +            this._globalConfig +          ) +      ); +    } +  } + +  printTestFileFailureMessage(_testPath, _config, result) { +    if (result.failureMessage) { +      this.log(result.failureMessage); +    } + +    const didUpdate = this._globalConfig.updateSnapshot === 'all'; +    const snapshotStatuses = (0, _getSnapshotStatus.default)( +      result.snapshot, +      didUpdate +    ); +    snapshotStatuses.forEach(this.log); +  } +} + +exports.default = DefaultReporter; + +_defineProperty(DefaultReporter, 'filename', __filename); diff --git a/node_modules/@jest/reporters/build/NotifyReporter.d.ts b/node_modules/@jest/reporters/build/NotifyReporter.d.ts new file mode 100644 index 0000000..eaa0f7f --- /dev/null +++ b/node_modules/@jest/reporters/build/NotifyReporter.d.ts @@ -0,0 +1,19 @@ +/** + * 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 { AggregatedResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import BaseReporter from './BaseReporter'; +import type { Context, TestSchedulerContext } from './types'; +export default class NotifyReporter extends BaseReporter { +    private _notifier; +    private _startRun; +    private _globalConfig; +    private _context; +    static readonly filename: string; +    constructor(globalConfig: Config.GlobalConfig, startRun: (globalConfig: Config.GlobalConfig) => unknown, context: TestSchedulerContext); +    onRunComplete(contexts: Set<Context>, result: AggregatedResult): void; +} diff --git a/node_modules/@jest/reporters/build/NotifyReporter.js b/node_modules/@jest/reporters/build/NotifyReporter.js new file mode 100644 index 0000000..14242b6 --- /dev/null +++ b/node_modules/@jest/reporters/build/NotifyReporter.js @@ -0,0 +1,256 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function path() { +  const data = _interopRequireWildcard(require('path')); + +  path = function () { +    return data; +  }; + +  return data; +} + +function util() { +  const data = _interopRequireWildcard(require('util')); + +  util = function () { +    return data; +  }; + +  return data; +} + +function _exit() { +  const data = _interopRequireDefault(require('exit')); + +  _exit = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); + +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; +} + +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 isDarwin = process.platform === 'darwin'; +const icon = path().resolve(__dirname, '../assets/jest_logo.png'); + +class NotifyReporter extends _BaseReporter.default { +  constructor(globalConfig, startRun, context) { +    super(); + +    _defineProperty(this, '_notifier', loadNotifier()); + +    _defineProperty(this, '_startRun', void 0); + +    _defineProperty(this, '_globalConfig', void 0); + +    _defineProperty(this, '_context', void 0); + +    this._globalConfig = globalConfig; +    this._startRun = startRun; +    this._context = context; +  } + +  onRunComplete(contexts, result) { +    const success = +      result.numFailedTests === 0 && result.numRuntimeErrorTestSuites === 0; +    const firstContext = contexts.values().next(); +    const hasteFS = +      firstContext && firstContext.value && firstContext.value.hasteFS; +    let packageName; + +    if (hasteFS != null) { +      // assuming root package.json is the first one +      const [filePath] = hasteFS.matchFiles('package.json'); +      packageName = +        filePath != null +          ? hasteFS.getModuleName(filePath) +          : this._globalConfig.rootDir; +    } else { +      packageName = this._globalConfig.rootDir; +    } + +    packageName = packageName != null ? `${packageName} - ` : ''; +    const notifyMode = this._globalConfig.notifyMode; +    const statusChanged = +      this._context.previousSuccess !== success || this._context.firstRun; +    const testsHaveRun = result.numTotalTests !== 0; + +    if ( +      testsHaveRun && +      success && +      (notifyMode === 'always' || +        notifyMode === 'success' || +        notifyMode === 'success-change' || +        (notifyMode === 'change' && statusChanged) || +        (notifyMode === 'failure-change' && statusChanged)) +    ) { +      const title = util().format('%s%d%% Passed', packageName, 100); +      const message = `${isDarwin ? '\u2705 ' : ''}${(0, _jestUtil().pluralize)( +        'test', +        result.numPassedTests +      )} passed`; + +      this._notifier.notify({ +        icon, +        message, +        timeout: false, +        title +      }); +    } else if ( +      testsHaveRun && +      !success && +      (notifyMode === 'always' || +        notifyMode === 'failure' || +        notifyMode === 'failure-change' || +        (notifyMode === 'change' && statusChanged) || +        (notifyMode === 'success-change' && statusChanged)) +    ) { +      const failed = result.numFailedTests / result.numTotalTests; +      const title = util().format( +        '%s%d%% Failed', +        packageName, +        Math.ceil(Number.isNaN(failed) ? 0 : failed * 100) +      ); +      const message = util().format( +        (isDarwin ? '\u26D4\uFE0F ' : '') + '%d of %d tests failed', +        result.numFailedTests, +        result.numTotalTests +      ); +      const watchMode = this._globalConfig.watch || this._globalConfig.watchAll; +      const restartAnswer = 'Run again'; +      const quitAnswer = 'Exit tests'; + +      if (!watchMode) { +        this._notifier.notify({ +          icon, +          message, +          timeout: false, +          title +        }); +      } else { +        this._notifier.notify( +          { +            actions: [restartAnswer, quitAnswer], +            closeLabel: 'Close', +            icon, +            message, +            timeout: false, +            title +          }, +          (err, _, metadata) => { +            if (err || !metadata) { +              return; +            } + +            if (metadata.activationValue === quitAnswer) { +              (0, _exit().default)(0); +              return; +            } + +            if (metadata.activationValue === restartAnswer) { +              this._startRun(this._globalConfig); +            } +          } +        ); +      } +    } + +    this._context.previousSuccess = success; +    this._context.firstRun = false; +  } +} + +exports.default = NotifyReporter; + +_defineProperty(NotifyReporter, 'filename', __filename); + +function loadNotifier() { +  try { +    return require('node-notifier'); +  } catch (err) { +    if (err.code !== 'MODULE_NOT_FOUND') { +      throw err; +    } + +    throw Error( +      'notify reporter requires optional peer dependency "node-notifier" but it was not found' +    ); +  } +} diff --git a/node_modules/@jest/reporters/build/Status.d.ts b/node_modules/@jest/reporters/build/Status.d.ts new file mode 100644 index 0000000..36bb7d9 --- /dev/null +++ b/node_modules/@jest/reporters/build/Status.d.ts @@ -0,0 +1,42 @@ +/** + * 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 { AggregatedResult, TestCaseResult, TestResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type { ReporterOnStartOptions, Test } from './types'; +declare type Cache = { +    content: string; +    clear: string; +}; +/** + * A class that generates the CLI status of currently running tests + * and also provides an ANSI escape sequence to remove status lines + * from the terminal. + */ +export default class Status { +    private _cache; +    private _callback?; +    private _currentTests; +    private _currentTestCases; +    private _done; +    private _emitScheduled; +    private _estimatedTime; +    private _interval?; +    private _aggregatedResults?; +    private _showStatus; +    constructor(); +    onChange(callback: () => void): void; +    runStarted(aggregatedResults: AggregatedResult, options: ReporterOnStartOptions): void; +    runFinished(): void; +    addTestCaseResult(test: Test, testCaseResult: TestCaseResult): void; +    testStarted(testPath: Config.Path, config: Config.ProjectConfig): void; +    testFinished(_config: Config.ProjectConfig, testResult: TestResult, aggregatedResults: AggregatedResult): void; +    get(): Cache; +    private _emit; +    private _debouncedEmit; +    private _tick; +} +export {}; diff --git a/node_modules/@jest/reporters/build/Status.js b/node_modules/@jest/reporters/build/Status.js new file mode 100644 index 0000000..72f4fc6 --- /dev/null +++ b/node_modules/@jest/reporters/build/Status.js @@ -0,0 +1,272 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _stringLength() { +  const data = _interopRequireDefault(require('string-length')); + +  _stringLength = function () { +    return data; +  }; + +  return data; +} + +var _utils = require('./utils'); + +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 RUNNING_TEXT = ' RUNS '; +const RUNNING = _chalk().default.reset.inverse.yellow.bold(RUNNING_TEXT) + ' '; +/** + * This class is a perf optimization for sorting the list of currently + * running tests. It tries to keep tests in the same positions without + * shifting the whole list. + */ + +class CurrentTestList { +  constructor() { +    _defineProperty(this, '_array', void 0); + +    this._array = []; +  } + +  add(testPath, config) { +    const index = this._array.indexOf(null); + +    const record = { +      config, +      testPath +    }; + +    if (index !== -1) { +      this._array[index] = record; +    } else { +      this._array.push(record); +    } +  } + +  delete(testPath) { +    const record = this._array.find( +      record => record !== null && record.testPath === testPath +    ); + +    this._array[this._array.indexOf(record || null)] = null; +  } + +  get() { +    return this._array; +  } +} + +/** + * A class that generates the CLI status of currently running tests + * and also provides an ANSI escape sequence to remove status lines + * from the terminal. + */ +class Status { +  constructor() { +    _defineProperty(this, '_cache', void 0); + +    _defineProperty(this, '_callback', void 0); + +    _defineProperty(this, '_currentTests', void 0); + +    _defineProperty(this, '_currentTestCases', void 0); + +    _defineProperty(this, '_done', void 0); + +    _defineProperty(this, '_emitScheduled', void 0); + +    _defineProperty(this, '_estimatedTime', void 0); + +    _defineProperty(this, '_interval', void 0); + +    _defineProperty(this, '_aggregatedResults', void 0); + +    _defineProperty(this, '_showStatus', void 0); + +    this._cache = null; +    this._currentTests = new CurrentTestList(); +    this._currentTestCases = []; +    this._done = false; +    this._emitScheduled = false; +    this._estimatedTime = 0; +    this._showStatus = false; +  } + +  onChange(callback) { +    this._callback = callback; +  } + +  runStarted(aggregatedResults, options) { +    this._estimatedTime = (options && options.estimatedTime) || 0; +    this._showStatus = options && options.showStatus; +    this._interval = setInterval(() => this._tick(), 1000); +    this._aggregatedResults = aggregatedResults; + +    this._debouncedEmit(); +  } + +  runFinished() { +    this._done = true; +    if (this._interval) clearInterval(this._interval); + +    this._emit(); +  } + +  addTestCaseResult(test, testCaseResult) { +    this._currentTestCases.push({ +      test, +      testCaseResult +    }); + +    if (!this._showStatus) { +      this._emit(); +    } else { +      this._debouncedEmit(); +    } +  } + +  testStarted(testPath, config) { +    this._currentTests.add(testPath, config); + +    if (!this._showStatus) { +      this._emit(); +    } else { +      this._debouncedEmit(); +    } +  } + +  testFinished(_config, testResult, aggregatedResults) { +    const {testFilePath} = testResult; +    this._aggregatedResults = aggregatedResults; + +    this._currentTests.delete(testFilePath); + +    this._currentTestCases = this._currentTestCases.filter(({test}) => { +      if (_config !== test.context.config) { +        return true; +      } + +      return test.path !== testFilePath; +    }); + +    this._debouncedEmit(); +  } + +  get() { +    if (this._cache) { +      return this._cache; +    } + +    if (this._done) { +      return { +        clear: '', +        content: '' +      }; +    } + +    const width = process.stdout.columns; +    let content = '\n'; + +    this._currentTests.get().forEach(record => { +      if (record) { +        const {config, testPath} = record; +        const projectDisplayName = config.displayName +          ? (0, _utils.printDisplayName)(config) + ' ' +          : ''; +        const prefix = RUNNING + projectDisplayName; +        content += +          (0, _utils.wrapAnsiString)( +            prefix + +              (0, _utils.trimAndFormatPath)( +                (0, _stringLength().default)(prefix), +                config, +                testPath, +                width +              ), +            width +          ) + '\n'; +      } +    }); + +    if (this._showStatus && this._aggregatedResults) { +      content += +        '\n' + +        (0, _utils.getSummary)(this._aggregatedResults, { +          currentTestCases: this._currentTestCases, +          estimatedTime: this._estimatedTime, +          roundTime: true, +          width +        }); +    } + +    let height = 0; + +    for (let i = 0; i < content.length; i++) { +      if (content[i] === '\n') { +        height++; +      } +    } + +    const clear = '\r\x1B[K\r\x1B[1A'.repeat(height); +    return (this._cache = { +      clear, +      content +    }); +  } + +  _emit() { +    this._cache = null; +    if (this._callback) this._callback(); +  } + +  _debouncedEmit() { +    if (!this._emitScheduled) { +      // Perf optimization to avoid two separate renders When +      // one test finishes and another test starts executing. +      this._emitScheduled = true; +      setTimeout(() => { +        this._emit(); + +        this._emitScheduled = false; +      }, 100); +    } +  } + +  _tick() { +    this._debouncedEmit(); +  } +} + +exports.default = Status; diff --git a/node_modules/@jest/reporters/build/SummaryReporter.d.ts b/node_modules/@jest/reporters/build/SummaryReporter.d.ts new file mode 100644 index 0000000..3d7570d --- /dev/null +++ b/node_modules/@jest/reporters/build/SummaryReporter.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 { AggregatedResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import BaseReporter from './BaseReporter'; +import type { Context, ReporterOnStartOptions } from './types'; +export default class SummaryReporter extends BaseReporter { +    private _estimatedTime; +    private _globalConfig; +    static readonly filename: string; +    constructor(globalConfig: Config.GlobalConfig); +    private _write; +    onRunStart(aggregatedResults: AggregatedResult, options: ReporterOnStartOptions): void; +    onRunComplete(contexts: Set<Context>, aggregatedResults: AggregatedResult): void; +    private _printSnapshotSummary; +    private _printSummary; +    private _getTestSummary; +} diff --git a/node_modules/@jest/reporters/build/SummaryReporter.js b/node_modules/@jest/reporters/build/SummaryReporter.js new file mode 100644 index 0000000..5696da1 --- /dev/null +++ b/node_modules/@jest/reporters/build/SummaryReporter.js @@ -0,0 +1,271 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); + +var _getResultHeader = _interopRequireDefault(require('./getResultHeader')); + +var _getSnapshotSummary = _interopRequireDefault( +  require('./getSnapshotSummary') +); + +var _utils = require('./utils'); + +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 TEST_SUMMARY_THRESHOLD = 20; +const NPM_EVENTS = new Set([ +  'prepublish', +  'publish', +  'postpublish', +  'preinstall', +  'install', +  'postinstall', +  'preuninstall', +  'uninstall', +  'postuninstall', +  'preversion', +  'version', +  'postversion', +  'pretest', +  'test', +  'posttest', +  'prestop', +  'stop', +  'poststop', +  'prestart', +  'start', +  'poststart', +  'prerestart', +  'restart', +  'postrestart' +]); +const {npm_config_user_agent, npm_lifecycle_event, npm_lifecycle_script} = +  process.env; + +class SummaryReporter extends _BaseReporter.default { +  constructor(globalConfig) { +    super(); + +    _defineProperty(this, '_estimatedTime', void 0); + +    _defineProperty(this, '_globalConfig', void 0); + +    this._globalConfig = globalConfig; +    this._estimatedTime = 0; +  } // If we write more than one character at a time it is possible that +  // Node.js exits in the middle of printing the result. This was first observed +  // in Node.js 0.10 and still persists in Node.js 6.7+. +  // Let's print the test failure summary character by character which is safer +  // when hundreds of tests are failing. + +  _write(string) { +    for (let i = 0; i < string.length; i++) { +      process.stderr.write(string.charAt(i)); +    } +  } + +  onRunStart(aggregatedResults, options) { +    super.onRunStart(aggregatedResults, options); +    this._estimatedTime = options.estimatedTime; +  } + +  onRunComplete(contexts, aggregatedResults) { +    const {numTotalTestSuites, testResults, wasInterrupted} = aggregatedResults; + +    if (numTotalTestSuites) { +      const lastResult = testResults[testResults.length - 1]; // Print a newline if the last test did not fail to line up newlines +      // similar to when an error would have been thrown in the test. + +      if ( +        !this._globalConfig.verbose && +        lastResult && +        !lastResult.numFailingTests && +        !lastResult.testExecError +      ) { +        this.log(''); +      } + +      this._printSummary(aggregatedResults, this._globalConfig); + +      this._printSnapshotSummary( +        aggregatedResults.snapshot, +        this._globalConfig +      ); + +      if (numTotalTestSuites) { +        let message = (0, _utils.getSummary)(aggregatedResults, { +          estimatedTime: this._estimatedTime +        }); + +        if (!this._globalConfig.silent) { +          message += +            '\n' + +            (wasInterrupted +              ? _chalk().default.bold.red('Test run was interrupted.') +              : this._getTestSummary(contexts, this._globalConfig)); +        } + +        this.log(message); +      } +    } +  } + +  _printSnapshotSummary(snapshots, globalConfig) { +    if ( +      snapshots.added || +      snapshots.filesRemoved || +      snapshots.unchecked || +      snapshots.unmatched || +      snapshots.updated +    ) { +      let updateCommand; +      const event = npm_lifecycle_event || ''; +      const prefix = NPM_EVENTS.has(event) ? '' : 'run '; +      const isYarn = +        typeof npm_config_user_agent === 'string' && +        npm_config_user_agent.includes('yarn'); +      const client = isYarn ? 'yarn' : 'npm'; +      const scriptUsesJest = +        typeof npm_lifecycle_script === 'string' && +        npm_lifecycle_script.includes('jest'); + +      if (globalConfig.watch || globalConfig.watchAll) { +        updateCommand = 'press `u`'; +      } else if (event && scriptUsesJest) { +        updateCommand = `run \`${ +          client + ' ' + prefix + event + (isYarn ? '' : ' --') +        } -u\``; +      } else { +        updateCommand = 're-run jest with `-u`'; +      } + +      const snapshotSummary = (0, _getSnapshotSummary.default)( +        snapshots, +        globalConfig, +        updateCommand +      ); +      snapshotSummary.forEach(this.log); +      this.log(''); // print empty line +    } +  } + +  _printSummary(aggregatedResults, globalConfig) { +    // If there were any failing tests and there was a large number of tests +    // executed, re-print the failing results at the end of execution output. +    const failedTests = aggregatedResults.numFailedTests; +    const runtimeErrors = aggregatedResults.numRuntimeErrorTestSuites; + +    if ( +      failedTests + runtimeErrors > 0 && +      aggregatedResults.numTotalTestSuites > TEST_SUMMARY_THRESHOLD +    ) { +      this.log(_chalk().default.bold('Summary of all failing tests')); +      aggregatedResults.testResults.forEach(testResult => { +        const {failureMessage} = testResult; + +        if (failureMessage) { +          this._write( +            (0, _getResultHeader.default)(testResult, globalConfig) + +              '\n' + +              failureMessage + +              '\n' +          ); +        } +      }); +      this.log(''); // print empty line +    } +  } + +  _getTestSummary(contexts, globalConfig) { +    const getMatchingTestsInfo = () => { +      const prefix = globalConfig.findRelatedTests +        ? ' related to files matching ' +        : ' matching '; +      return ( +        _chalk().default.dim(prefix) + +        (0, _jestUtil().testPathPatternToRegExp)( +          globalConfig.testPathPattern +        ).toString() +      ); +    }; + +    let testInfo = ''; + +    if (globalConfig.runTestsByPath) { +      testInfo = _chalk().default.dim(' within paths'); +    } else if (globalConfig.onlyChanged) { +      testInfo = _chalk().default.dim(' related to changed files'); +    } else if (globalConfig.testPathPattern) { +      testInfo = getMatchingTestsInfo(); +    } + +    let nameInfo = ''; + +    if (globalConfig.runTestsByPath) { +      nameInfo = ' ' + globalConfig.nonFlagArgs.map(p => `"${p}"`).join(', '); +    } else if (globalConfig.testNamePattern) { +      nameInfo = +        _chalk().default.dim(' with tests matching ') + +        `"${globalConfig.testNamePattern}"`; +    } + +    const contextInfo = +      contexts.size > 1 +        ? _chalk().default.dim(' in ') + +          contexts.size + +          _chalk().default.dim(' projects') +        : ''; +    return ( +      _chalk().default.dim('Ran all test suites') + +      testInfo + +      nameInfo + +      contextInfo + +      _chalk().default.dim('.') +    ); +  } +} + +exports.default = SummaryReporter; + +_defineProperty(SummaryReporter, 'filename', __filename); diff --git a/node_modules/@jest/reporters/build/VerboseReporter.d.ts b/node_modules/@jest/reporters/build/VerboseReporter.d.ts new file mode 100644 index 0000000..1ab4ffc --- /dev/null +++ b/node_modules/@jest/reporters/build/VerboseReporter.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. + */ +/// <reference types="node" /> +import type { AggregatedResult, AssertionResult, Suite, TestResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import DefaultReporter from './DefaultReporter'; +import type { Test } from './types'; +export default class VerboseReporter extends DefaultReporter { +    protected _globalConfig: Config.GlobalConfig; +    static readonly filename: string; +    constructor(globalConfig: Config.GlobalConfig); +    protected __wrapStdio(stream: NodeJS.WritableStream | NodeJS.WriteStream): void; +    static filterTestResults(testResults: Array<AssertionResult>): Array<AssertionResult>; +    static groupTestsBySuites(testResults: Array<AssertionResult>): Suite; +    onTestResult(test: Test, result: TestResult, aggregatedResults: AggregatedResult): void; +    private _logTestResults; +    private _logSuite; +    private _getIcon; +    private _logTest; +    private _logTests; +    private _logTodoOrPendingTest; +    private _logLine; +} diff --git a/node_modules/@jest/reporters/build/VerboseReporter.js b/node_modules/@jest/reporters/build/VerboseReporter.js new file mode 100644 index 0000000..57758ed --- /dev/null +++ b/node_modules/@jest/reporters/build/VerboseReporter.js @@ -0,0 +1,226 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _DefaultReporter = _interopRequireDefault(require('./DefaultReporter')); + +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 {ICONS} = _jestUtil().specialChars; + +class VerboseReporter extends _DefaultReporter.default { +  constructor(globalConfig) { +    super(globalConfig); + +    _defineProperty(this, '_globalConfig', void 0); + +    this._globalConfig = globalConfig; +  } // Verbose mode is for debugging. Buffering of output is undesirable. +  // See https://github.com/facebook/jest/issues/8208 + +  __wrapStdio(stream) { +    const write = stream.write.bind(stream); + +    stream.write = chunk => { +      this.__clearStatus(); + +      write(chunk); + +      this.__printStatus(); + +      return true; +    }; +  } + +  static filterTestResults(testResults) { +    return testResults.filter(({status}) => status !== 'pending'); +  } + +  static groupTestsBySuites(testResults) { +    const root = { +      suites: [], +      tests: [], +      title: '' +    }; +    testResults.forEach(testResult => { +      let targetSuite = root; // Find the target suite for this test, +      // creating nested suites as necessary. + +      for (const title of testResult.ancestorTitles) { +        let matchingSuite = targetSuite.suites.find(s => s.title === title); + +        if (!matchingSuite) { +          matchingSuite = { +            suites: [], +            tests: [], +            title +          }; +          targetSuite.suites.push(matchingSuite); +        } + +        targetSuite = matchingSuite; +      } + +      targetSuite.tests.push(testResult); +    }); +    return root; +  } + +  onTestResult(test, result, aggregatedResults) { +    super.testFinished(test.context.config, result, aggregatedResults); + +    if (!result.skipped) { +      this.printTestFileHeader( +        result.testFilePath, +        test.context.config, +        result +      ); + +      if (!result.testExecError && !result.skipped) { +        this._logTestResults(result.testResults); +      } + +      this.printTestFileFailureMessage( +        result.testFilePath, +        test.context.config, +        result +      ); +    } + +    super.forceFlushBufferedOutput(); +  } + +  _logTestResults(testResults) { +    this._logSuite(VerboseReporter.groupTestsBySuites(testResults), 0); + +    this._logLine(); +  } + +  _logSuite(suite, indentLevel) { +    if (suite.title) { +      this._logLine(suite.title, indentLevel); +    } + +    this._logTests(suite.tests, indentLevel + 1); + +    suite.suites.forEach(suite => this._logSuite(suite, indentLevel + 1)); +  } + +  _getIcon(status) { +    if (status === 'failed') { +      return _chalk().default.red(ICONS.failed); +    } else if (status === 'pending') { +      return _chalk().default.yellow(ICONS.pending); +    } else if (status === 'todo') { +      return _chalk().default.magenta(ICONS.todo); +    } else { +      return _chalk().default.green(ICONS.success); +    } +  } + +  _logTest(test, indentLevel) { +    const status = this._getIcon(test.status); + +    const time = test.duration +      ? ` (${(0, _jestUtil().formatTime)(Math.round(test.duration))})` +      : ''; + +    this._logLine( +      status + ' ' + _chalk().default.dim(test.title + time), +      indentLevel +    ); +  } + +  _logTests(tests, indentLevel) { +    if (this._globalConfig.expand) { +      tests.forEach(test => this._logTest(test, indentLevel)); +    } else { +      const summedTests = tests.reduce( +        (result, test) => { +          if (test.status === 'pending') { +            result.pending.push(test); +          } else if (test.status === 'todo') { +            result.todo.push(test); +          } else { +            this._logTest(test, indentLevel); +          } + +          return result; +        }, +        { +          pending: [], +          todo: [] +        } +      ); + +      if (summedTests.pending.length > 0) { +        summedTests.pending.forEach(this._logTodoOrPendingTest(indentLevel)); +      } + +      if (summedTests.todo.length > 0) { +        summedTests.todo.forEach(this._logTodoOrPendingTest(indentLevel)); +      } +    } +  } + +  _logTodoOrPendingTest(indentLevel) { +    return test => { +      const printedTestStatus = +        test.status === 'pending' ? 'skipped' : test.status; + +      const icon = this._getIcon(test.status); + +      const text = _chalk().default.dim(`${printedTestStatus} ${test.title}`); + +      this._logLine(`${icon} ${text}`, indentLevel); +    }; +  } + +  _logLine(str, indentLevel) { +    const indentation = '  '.repeat(indentLevel || 0); +    this.log(indentation + (str || '')); +  } +} + +exports.default = VerboseReporter; + +_defineProperty(VerboseReporter, 'filename', __filename); diff --git a/node_modules/@jest/reporters/build/generateEmptyCoverage.d.ts b/node_modules/@jest/reporters/build/generateEmptyCoverage.d.ts new file mode 100644 index 0000000..fdeecdb --- /dev/null +++ b/node_modules/@jest/reporters/build/generateEmptyCoverage.d.ts @@ -0,0 +1,19 @@ +/** + * 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 { V8Coverage } from 'collect-v8-coverage'; +import { FileCoverage } from 'istanbul-lib-coverage'; +import type { Config } from '@jest/types'; +declare type SingleV8Coverage = V8Coverage[number]; +export declare type CoverageWorkerResult = { +    kind: 'BabelCoverage'; +    coverage: FileCoverage; +} | { +    kind: 'V8Coverage'; +    result: SingleV8Coverage; +}; +export default function generateEmptyCoverage(source: string, filename: Config.Path, globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, changedFiles?: Set<Config.Path>, sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>): Promise<CoverageWorkerResult | null>; +export {}; diff --git a/node_modules/@jest/reporters/build/generateEmptyCoverage.js b/node_modules/@jest/reporters/build/generateEmptyCoverage.js new file mode 100644 index 0000000..f8490f9 --- /dev/null +++ b/node_modules/@jest/reporters/build/generateEmptyCoverage.js @@ -0,0 +1,168 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = generateEmptyCoverage; + +function fs() { +  const data = _interopRequireWildcard(require('graceful-fs')); + +  fs = function () { +    return data; +  }; + +  return data; +} + +function _istanbulLibCoverage() { +  const data = require('istanbul-lib-coverage'); + +  _istanbulLibCoverage = function () { +    return data; +  }; + +  return data; +} + +function _istanbulLibInstrument() { +  const data = require('istanbul-lib-instrument'); + +  _istanbulLibInstrument = function () { +    return data; +  }; + +  return data; +} + +function _transform() { +  const data = require('@jest/transform'); + +  _transform = function () { +    return data; +  }; + +  return data; +} + +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. + */ +async function generateEmptyCoverage( +  source, +  filename, +  globalConfig, +  config, +  changedFiles, +  sourcesRelatedToTestsInChangedFiles +) { +  const coverageOptions = { +    changedFiles, +    collectCoverage: globalConfig.collectCoverage, +    collectCoverageFrom: globalConfig.collectCoverageFrom, +    collectCoverageOnlyFrom: globalConfig.collectCoverageOnlyFrom, +    coverageProvider: globalConfig.coverageProvider, +    sourcesRelatedToTestsInChangedFiles +  }; +  let coverageWorkerResult = null; + +  if ((0, _transform().shouldInstrument)(filename, coverageOptions, config)) { +    if (coverageOptions.coverageProvider === 'v8') { +      const stat = fs().statSync(filename); +      return { +        kind: 'V8Coverage', +        result: { +          functions: [ +            { +              functionName: '(empty-report)', +              isBlockCoverage: true, +              ranges: [ +                { +                  count: 0, +                  endOffset: stat.size, +                  startOffset: 0 +                } +              ] +            } +          ], +          scriptId: '0', +          url: filename +        } +      }; +    } + +    const scriptTransformer = await (0, _transform().createScriptTransformer)( +      config +    ); // Transform file with instrumentation to make sure initial coverage data is well mapped to original code. + +    const {code} = await scriptTransformer.transformSourceAsync( +      filename, +      source, +      { +        instrument: true, +        supportsDynamicImport: true, +        supportsExportNamespaceFrom: true, +        supportsStaticESM: true, +        supportsTopLevelAwait: true +      } +    ); // TODO: consider passing AST + +    const extracted = (0, _istanbulLibInstrument().readInitialCoverage)(code); // Check extracted initial coverage is not null, this can happen when using /* istanbul ignore file */ + +    if (extracted) { +      coverageWorkerResult = { +        coverage: (0, _istanbulLibCoverage().createFileCoverage)( +          extracted.coverageData +        ), +        kind: 'BabelCoverage' +      }; +    } +  } + +  return coverageWorkerResult; +} diff --git a/node_modules/@jest/reporters/build/getResultHeader.d.ts b/node_modules/@jest/reporters/build/getResultHeader.d.ts new file mode 100644 index 0000000..b9cb738 --- /dev/null +++ b/node_modules/@jest/reporters/build/getResultHeader.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. + */ +import type { TestResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +export default function getResultHeader(result: TestResult, globalConfig: Config.GlobalConfig, projectConfig?: Config.ProjectConfig): string; diff --git a/node_modules/@jest/reporters/build/getResultHeader.js b/node_modules/@jest/reporters/build/getResultHeader.js new file mode 100644 index 0000000..f497921 --- /dev/null +++ b/node_modules/@jest/reporters/build/getResultHeader.js @@ -0,0 +1,104 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getResultHeader; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _terminalLink() { +  const data = _interopRequireDefault(require('terminal-link')); + +  _terminalLink = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _utils = require('./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 LONG_TEST_COLOR = _chalk().default.reset.bold.bgRed; // Explicitly reset for these messages since they can get written out in the +// middle of error logging + +const FAIL_TEXT = 'FAIL'; +const PASS_TEXT = 'PASS'; +const FAIL = _chalk().default.supportsColor +  ? _chalk().default.reset.inverse.bold.red(` ${FAIL_TEXT} `) +  : FAIL_TEXT; +const PASS = _chalk().default.supportsColor +  ? _chalk().default.reset.inverse.bold.green(` ${PASS_TEXT} `) +  : PASS_TEXT; + +function getResultHeader(result, globalConfig, projectConfig) { +  var _result$perfStats; + +  const testPath = result.testFilePath; +  const formattedTestPath = (0, _utils.formatTestPath)( +    projectConfig ? projectConfig : globalConfig, +    testPath +  ); +  const fileLink = (0, _terminalLink().default)( +    formattedTestPath, +    `file://${testPath}`, +    { +      fallback: () => formattedTestPath +    } +  ); +  const status = +    result.numFailingTests > 0 || result.testExecError ? FAIL : PASS; +  const testDetail = []; + +  if ( +    (_result$perfStats = result.perfStats) !== null && +    _result$perfStats !== void 0 && +    _result$perfStats.slow +  ) { +    const runTime = result.perfStats.runtime / 1000; +    testDetail.push(LONG_TEST_COLOR((0, _jestUtil().formatTime)(runTime, 0))); +  } + +  if (result.memoryUsage) { +    const toMB = bytes => Math.floor(bytes / 1024 / 1024); + +    testDetail.push(`${toMB(result.memoryUsage)} MB heap size`); +  } + +  const projectDisplayName = +    projectConfig && projectConfig.displayName +      ? (0, _utils.printDisplayName)(projectConfig) + ' ' +      : ''; +  return ( +    `${status} ${projectDisplayName}${fileLink}` + +    (testDetail.length ? ` (${testDetail.join(', ')})` : '') +  ); +} diff --git a/node_modules/@jest/reporters/build/getSnapshotStatus.d.ts b/node_modules/@jest/reporters/build/getSnapshotStatus.d.ts new file mode 100644 index 0000000..573ea9a --- /dev/null +++ b/node_modules/@jest/reporters/build/getSnapshotStatus.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 { TestResult } from '@jest/test-result'; +export default function getSnapshotStatus(snapshot: TestResult['snapshot'], afterUpdate: boolean): Array<string>; diff --git a/node_modules/@jest/reporters/build/getSnapshotStatus.js b/node_modules/@jest/reporters/build/getSnapshotStatus.js new file mode 100644 index 0000000..ddda3ab --- /dev/null +++ b/node_modules/@jest/reporters/build/getSnapshotStatus.js @@ -0,0 +1,111 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getSnapshotStatus; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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 ARROW = ' \u203A '; +const DOT = ' \u2022 '; + +const FAIL_COLOR = _chalk().default.bold.red; + +const SNAPSHOT_ADDED = _chalk().default.bold.green; + +const SNAPSHOT_UPDATED = _chalk().default.bold.green; + +const SNAPSHOT_OUTDATED = _chalk().default.bold.yellow; + +function getSnapshotStatus(snapshot, afterUpdate) { +  const statuses = []; + +  if (snapshot.added) { +    statuses.push( +      SNAPSHOT_ADDED( +        ARROW + +          (0, _jestUtil().pluralize)('snapshot', snapshot.added) + +          ' written.' +      ) +    ); +  } + +  if (snapshot.updated) { +    statuses.push( +      SNAPSHOT_UPDATED( +        ARROW + +          (0, _jestUtil().pluralize)('snapshot', snapshot.updated) + +          ' updated.' +      ) +    ); +  } + +  if (snapshot.unmatched) { +    statuses.push( +      FAIL_COLOR( +        ARROW + +          (0, _jestUtil().pluralize)('snapshot', snapshot.unmatched) + +          ' failed.' +      ) +    ); +  } + +  if (snapshot.unchecked) { +    if (afterUpdate) { +      statuses.push( +        SNAPSHOT_UPDATED( +          ARROW + +            (0, _jestUtil().pluralize)('snapshot', snapshot.unchecked) + +            ' removed.' +        ) +      ); +    } else { +      statuses.push( +        SNAPSHOT_OUTDATED( +          ARROW + +            (0, _jestUtil().pluralize)('snapshot', snapshot.unchecked) + +            ' obsolete' +        ) + '.' +      ); +    } + +    snapshot.uncheckedKeys.forEach(key => { +      statuses.push(`  ${DOT}${key}`); +    }); +  } + +  if (snapshot.fileDeleted) { +    statuses.push(SNAPSHOT_UPDATED(ARROW + 'snapshot file removed.')); +  } + +  return statuses; +} diff --git a/node_modules/@jest/reporters/build/getSnapshotSummary.d.ts b/node_modules/@jest/reporters/build/getSnapshotSummary.d.ts new file mode 100644 index 0000000..8ccf669 --- /dev/null +++ b/node_modules/@jest/reporters/build/getSnapshotSummary.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. + */ +import type { SnapshotSummary } from '@jest/test-result'; +import type { Config } from '@jest/types'; +export default function getSnapshotSummary(snapshots: SnapshotSummary, globalConfig: Config.GlobalConfig, updateCommand: string): Array<string>; diff --git a/node_modules/@jest/reporters/build/getSnapshotSummary.js b/node_modules/@jest/reporters/build/getSnapshotSummary.js new file mode 100644 index 0000000..1afce24 --- /dev/null +++ b/node_modules/@jest/reporters/build/getSnapshotSummary.js @@ -0,0 +1,203 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getSnapshotSummary; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _utils = require('./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 ARROW = ' \u203A '; +const DOWN_ARROW = ' \u21B3 '; +const DOT = ' \u2022 '; + +const FAIL_COLOR = _chalk().default.bold.red; + +const OBSOLETE_COLOR = _chalk().default.bold.yellow; + +const SNAPSHOT_ADDED = _chalk().default.bold.green; + +const SNAPSHOT_NOTE = _chalk().default.dim; + +const SNAPSHOT_REMOVED = _chalk().default.bold.green; + +const SNAPSHOT_SUMMARY = _chalk().default.bold; + +const SNAPSHOT_UPDATED = _chalk().default.bold.green; + +function getSnapshotSummary(snapshots, globalConfig, updateCommand) { +  const summary = []; +  summary.push(SNAPSHOT_SUMMARY('Snapshot Summary')); + +  if (snapshots.added) { +    summary.push( +      SNAPSHOT_ADDED( +        ARROW + +          (0, _jestUtil().pluralize)('snapshot', snapshots.added) + +          ' written ' +      ) + +        `from ${(0, _jestUtil().pluralize)( +          'test suite', +          snapshots.filesAdded +        )}.` +    ); +  } + +  if (snapshots.unmatched) { +    summary.push( +      FAIL_COLOR( +        `${ARROW}${(0, _jestUtil().pluralize)( +          'snapshot', +          snapshots.unmatched +        )} failed` +      ) + +        ` from ${(0, _jestUtil().pluralize)( +          'test suite', +          snapshots.filesUnmatched +        )}. ` + +        SNAPSHOT_NOTE( +          'Inspect your code changes or ' + updateCommand + ' to update them.' +        ) +    ); +  } + +  if (snapshots.updated) { +    summary.push( +      SNAPSHOT_UPDATED( +        ARROW + +          (0, _jestUtil().pluralize)('snapshot', snapshots.updated) + +          ' updated ' +      ) + +        `from ${(0, _jestUtil().pluralize)( +          'test suite', +          snapshots.filesUpdated +        )}.` +    ); +  } + +  if (snapshots.filesRemoved) { +    if (snapshots.didUpdate) { +      summary.push( +        SNAPSHOT_REMOVED( +          `${ARROW}${(0, _jestUtil().pluralize)( +            'snapshot file', +            snapshots.filesRemoved +          )} removed ` +        ) + +          `from ${(0, _jestUtil().pluralize)( +            'test suite', +            snapshots.filesRemoved +          )}.` +      ); +    } else { +      summary.push( +        OBSOLETE_COLOR( +          `${ARROW}${(0, _jestUtil().pluralize)( +            'snapshot file', +            snapshots.filesRemoved +          )} obsolete ` +        ) + +          `from ${(0, _jestUtil().pluralize)( +            'test suite', +            snapshots.filesRemoved +          )}. ` + +          SNAPSHOT_NOTE( +            `To remove ${ +              snapshots.filesRemoved === 1 ? 'it' : 'them all' +            }, ${updateCommand}.` +          ) +      ); +    } +  } + +  if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) { +    const [head, ...tail] = snapshots.filesRemovedList; +    summary.push( +      `  ${DOWN_ARROW} ${DOT}${(0, _utils.formatTestPath)(globalConfig, head)}` +    ); +    tail.forEach(key => { +      summary.push( +        `      ${DOT}${(0, _utils.formatTestPath)(globalConfig, key)}` +      ); +    }); +  } + +  if (snapshots.unchecked) { +    if (snapshots.didUpdate) { +      summary.push( +        SNAPSHOT_REMOVED( +          `${ARROW}${(0, _jestUtil().pluralize)( +            'snapshot', +            snapshots.unchecked +          )} removed ` +        ) + +          `from ${(0, _jestUtil().pluralize)( +            'test suite', +            snapshots.uncheckedKeysByFile.length +          )}.` +      ); +    } else { +      summary.push( +        OBSOLETE_COLOR( +          `${ARROW}${(0, _jestUtil().pluralize)( +            'snapshot', +            snapshots.unchecked +          )} obsolete ` +        ) + +          `from ${(0, _jestUtil().pluralize)( +            'test suite', +            snapshots.uncheckedKeysByFile.length +          )}. ` + +          SNAPSHOT_NOTE( +            `To remove ${ +              snapshots.unchecked === 1 ? 'it' : 'them all' +            }, ${updateCommand}.` +          ) +      ); +    } + +    snapshots.uncheckedKeysByFile.forEach(uncheckedFile => { +      summary.push( +        `  ${DOWN_ARROW}${(0, _utils.formatTestPath)( +          globalConfig, +          uncheckedFile.filePath +        )}` +      ); +      uncheckedFile.keys.forEach(key => { +        summary.push(`      ${DOT}${key}`); +      }); +    }); +  } + +  return summary; +} diff --git a/node_modules/@jest/reporters/build/getWatermarks.d.ts b/node_modules/@jest/reporters/build/getWatermarks.d.ts new file mode 100644 index 0000000..a64751e --- /dev/null +++ b/node_modules/@jest/reporters/build/getWatermarks.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. + */ +import istanbulReport = require('istanbul-lib-report'); +import type { Config } from '@jest/types'; +export default function getWatermarks(config: Config.GlobalConfig): istanbulReport.Watermarks; diff --git a/node_modules/@jest/reporters/build/getWatermarks.js b/node_modules/@jest/reporters/build/getWatermarks.js new file mode 100644 index 0000000..5e27e41 --- /dev/null +++ b/node_modules/@jest/reporters/build/getWatermarks.js @@ -0,0 +1,47 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getWatermarks; + +function _istanbulLibReport() { +  const data = _interopRequireDefault(require('istanbul-lib-report')); + +  _istanbulLibReport = function () { +    return data; +  }; + +  return data; +} + +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. + */ +function getWatermarks(config) { +  const defaultWatermarks = _istanbulLibReport().default.getDefaultWatermarks(); + +  const {coverageThreshold} = config; + +  if (!coverageThreshold || !coverageThreshold.global) { +    return defaultWatermarks; +  } + +  const keys = ['branches', 'functions', 'lines', 'statements']; +  return keys.reduce((watermarks, key) => { +    const value = coverageThreshold.global[key]; + +    if (value !== undefined) { +      watermarks[key][1] = value; +    } + +    return watermarks; +  }, defaultWatermarks); +} diff --git a/node_modules/@jest/reporters/build/index.d.ts b/node_modules/@jest/reporters/build/index.d.ts new file mode 100644 index 0000000..96e583a --- /dev/null +++ b/node_modules/@jest/reporters/build/index.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 getResultHeader from './getResultHeader'; +export type { Config } from '@jest/types'; +export type { AggregatedResult, SnapshotSummary, TestResult, } from '@jest/test-result'; +export { default as BaseReporter } from './BaseReporter'; +export { default as CoverageReporter } from './CoverageReporter'; +export { default as DefaultReporter } from './DefaultReporter'; +export { default as NotifyReporter } from './NotifyReporter'; +export { default as SummaryReporter } from './SummaryReporter'; +export { default as VerboseReporter } from './VerboseReporter'; +export type { Context, Reporter, ReporterOnStartOptions, SummaryOptions, Test, } from './types'; +export declare const utils: { +    formatTestPath: (config: import("@jest/types/build/Config").ProjectConfig | import("@jest/types/build/Config").GlobalConfig, testPath: string) => string; +    getResultHeader: typeof getResultHeader; +    getSummary: (aggregatedResults: import("@jest/test-result").AggregatedResult, options?: import("./types").SummaryOptions | undefined) => string; +    printDisplayName: (config: import("@jest/types/build/Config").ProjectConfig) => string; +    relativePath: (config: import("@jest/types/build/Config").ProjectConfig | import("@jest/types/build/Config").GlobalConfig, testPath: string) => { +        basename: string; +        dirname: string; +    }; +    trimAndFormatPath: (pad: number, config: import("@jest/types/build/Config").ProjectConfig | import("@jest/types/build/Config").GlobalConfig, testPath: string, columns: number) => string; +}; diff --git a/node_modules/@jest/reporters/build/index.js b/node_modules/@jest/reporters/build/index.js new file mode 100644 index 0000000..bafd8e9 --- /dev/null +++ b/node_modules/@jest/reporters/build/index.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +Object.defineProperty(exports, 'BaseReporter', { +  enumerable: true, +  get: function () { +    return _BaseReporter.default; +  } +}); +Object.defineProperty(exports, 'CoverageReporter', { +  enumerable: true, +  get: function () { +    return _CoverageReporter.default; +  } +}); +Object.defineProperty(exports, 'DefaultReporter', { +  enumerable: true, +  get: function () { +    return _DefaultReporter.default; +  } +}); +Object.defineProperty(exports, 'NotifyReporter', { +  enumerable: true, +  get: function () { +    return _NotifyReporter.default; +  } +}); +Object.defineProperty(exports, 'SummaryReporter', { +  enumerable: true, +  get: function () { +    return _SummaryReporter.default; +  } +}); +Object.defineProperty(exports, 'VerboseReporter', { +  enumerable: true, +  get: function () { +    return _VerboseReporter.default; +  } +}); +exports.utils = void 0; + +var _getResultHeader = _interopRequireDefault(require('./getResultHeader')); + +var _utils = require('./utils'); + +var _BaseReporter = _interopRequireDefault(require('./BaseReporter')); + +var _CoverageReporter = _interopRequireDefault(require('./CoverageReporter')); + +var _DefaultReporter = _interopRequireDefault(require('./DefaultReporter')); + +var _NotifyReporter = _interopRequireDefault(require('./NotifyReporter')); + +var _SummaryReporter = _interopRequireDefault(require('./SummaryReporter')); + +var _VerboseReporter = _interopRequireDefault(require('./VerboseReporter')); + +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 utils = { +  formatTestPath: _utils.formatTestPath, +  getResultHeader: _getResultHeader.default, +  getSummary: _utils.getSummary, +  printDisplayName: _utils.printDisplayName, +  relativePath: _utils.relativePath, +  trimAndFormatPath: _utils.trimAndFormatPath +}; +exports.utils = utils; diff --git a/node_modules/@jest/reporters/build/types.d.ts b/node_modules/@jest/reporters/build/types.d.ts new file mode 100644 index 0000000..0dcbe26 --- /dev/null +++ b/node_modules/@jest/reporters/build/types.d.ts @@ -0,0 +1,75 @@ +/** + * 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 { AggregatedResult, SerializableError, TestCaseResult, TestResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type { FS as HasteFS, ModuleMap } from 'jest-haste-map'; +import type Resolver from 'jest-resolve'; +import type { worker } from './CoverageWorker'; +export declare type ReporterOnStartOptions = { +    estimatedTime: number; +    showStatus: boolean; +}; +export declare type Context = { +    config: Config.ProjectConfig; +    hasteFS: HasteFS; +    moduleMap: ModuleMap; +    resolver: Resolver; +}; +export declare type Test = { +    context: Context; +    duration?: number; +    path: Config.Path; +}; +export declare type CoverageWorker = { +    worker: typeof worker; +}; +export declare type CoverageReporterOptions = { +    changedFiles?: Set<Config.Path>; +    sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>; +}; +export declare type CoverageReporterSerializedOptions = { +    changedFiles?: Array<Config.Path>; +    sourcesRelatedToTestsInChangedFiles?: Array<Config.Path>; +}; +export declare type OnTestStart = (test: Test) => Promise<void>; +export declare type OnTestFailure = (test: Test, error: SerializableError) => Promise<unknown>; +export declare type OnTestSuccess = (test: Test, result: TestResult) => Promise<unknown>; +export interface Reporter { +    readonly onTestResult?: (test: Test, testResult: TestResult, aggregatedResult: AggregatedResult) => Promise<void> | void; +    readonly onTestFileResult?: (test: Test, testResult: TestResult, aggregatedResult: AggregatedResult) => Promise<void> | void; +    readonly onTestCaseResult?: (test: Test, testCaseResult: TestCaseResult) => Promise<void> | void; +    readonly onRunStart: (results: AggregatedResult, options: ReporterOnStartOptions) => Promise<void> | void; +    readonly onTestStart?: (test: Test) => Promise<void> | void; +    readonly onTestFileStart?: (test: Test) => Promise<void> | void; +    readonly onRunComplete: (contexts: Set<Context>, results: AggregatedResult) => Promise<void> | void; +    readonly getLastError: () => Error | void; +} +export declare type SummaryOptions = { +    currentTestCases?: Array<{ +        test: Test; +        testCaseResult: TestCaseResult; +    }>; +    estimatedTime?: number; +    roundTime?: boolean; +    width?: number; +}; +export declare type TestRunnerOptions = { +    serial: boolean; +}; +export declare type TestRunData = Array<{ +    context: Context; +    matches: { +        allTests: number; +        tests: Array<Test>; +        total: number; +    }; +}>; +export declare type TestSchedulerContext = { +    firstRun: boolean; +    previousSuccess: boolean; +    changedFiles?: Set<Config.Path>; +}; diff --git a/node_modules/@jest/reporters/build/types.js b/node_modules/@jest/reporters/build/types.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/reporters/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/reporters/build/utils.d.ts b/node_modules/@jest/reporters/build/utils.d.ts new file mode 100644 index 0000000..ed676be --- /dev/null +++ b/node_modules/@jest/reporters/build/utils.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 { AggregatedResult } from '@jest/test-result'; +import type { Config } from '@jest/types'; +import type { SummaryOptions } from './types'; +export declare const printDisplayName: (config: Config.ProjectConfig) => string; +export declare const trimAndFormatPath: (pad: number, config: Config.ProjectConfig | Config.GlobalConfig, testPath: Config.Path, columns: number) => string; +export declare const formatTestPath: (config: Config.GlobalConfig | Config.ProjectConfig, testPath: Config.Path) => string; +export declare const relativePath: (config: Config.GlobalConfig | Config.ProjectConfig, testPath: Config.Path) => { +    basename: string; +    dirname: string; +}; +export declare const getSummary: (aggregatedResults: AggregatedResult, options?: SummaryOptions | undefined) => string; +export declare const wrapAnsiString: (string: string, terminalWidth: number) => string; diff --git a/node_modules/@jest/reporters/build/utils.js b/node_modules/@jest/reporters/build/utils.js new file mode 100644 index 0000000..558ac92 --- /dev/null +++ b/node_modules/@jest/reporters/build/utils.js @@ -0,0 +1,435 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.wrapAnsiString = +  exports.trimAndFormatPath = +  exports.relativePath = +  exports.printDisplayName = +  exports.getSummary = +  exports.formatTestPath = +    void 0; + +function path() { +  const data = _interopRequireWildcard(require('path')); + +  path = function () { +    return data; +  }; + +  return data; +} + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _slash() { +  const data = _interopRequireDefault(require('slash')); + +  _slash = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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 PROGRESS_BAR_WIDTH = 40; + +const printDisplayName = config => { +  const {displayName} = config; + +  const white = _chalk().default.reset.inverse.white; + +  if (!displayName) { +    return ''; +  } + +  const {name, color} = displayName; +  const chosenColor = _chalk().default.reset.inverse[color] +    ? _chalk().default.reset.inverse[color] +    : white; +  return _chalk().default.supportsColor ? chosenColor(` ${name} `) : name; +}; + +exports.printDisplayName = printDisplayName; + +const trimAndFormatPath = (pad, config, testPath, columns) => { +  const maxLength = columns - pad; +  const relative = relativePath(config, testPath); +  const {basename} = relative; +  let {dirname} = relative; // length is ok + +  if ((dirname + path().sep + basename).length <= maxLength) { +    return (0, _slash().default)( +      _chalk().default.dim(dirname + path().sep) + +        _chalk().default.bold(basename) +    ); +  } // we can fit trimmed dirname and full basename + +  const basenameLength = basename.length; + +  if (basenameLength + 4 < maxLength) { +    const dirnameLength = maxLength - 4 - basenameLength; +    dirname = +      '...' + dirname.slice(dirname.length - dirnameLength, dirname.length); +    return (0, _slash().default)( +      _chalk().default.dim(dirname + path().sep) + +        _chalk().default.bold(basename) +    ); +  } + +  if (basenameLength + 4 === maxLength) { +    return (0, _slash().default)( +      _chalk().default.dim('...' + path().sep) + _chalk().default.bold(basename) +    ); +  } // can't fit dirname, but can fit trimmed basename + +  return (0, _slash().default)( +    _chalk().default.bold( +      '...' + basename.slice(basename.length - maxLength - 4, basename.length) +    ) +  ); +}; + +exports.trimAndFormatPath = trimAndFormatPath; + +const formatTestPath = (config, testPath) => { +  const {dirname, basename} = relativePath(config, testPath); +  return (0, _slash().default)( +    _chalk().default.dim(dirname + path().sep) + _chalk().default.bold(basename) +  ); +}; + +exports.formatTestPath = formatTestPath; + +const relativePath = (config, testPath) => { +  // this function can be called with ProjectConfigs or GlobalConfigs. GlobalConfigs +  // do not have config.cwd, only config.rootDir. Try using config.cwd, fallback +  // to config.rootDir. (Also, some unit just use config.rootDir, which is ok) +  testPath = path().relative(config.cwd || config.rootDir, testPath); +  const dirname = path().dirname(testPath); +  const basename = path().basename(testPath); +  return { +    basename, +    dirname +  }; +}; + +exports.relativePath = relativePath; + +const getValuesCurrentTestCases = (currentTestCases = []) => { +  let numFailingTests = 0; +  let numPassingTests = 0; +  let numPendingTests = 0; +  let numTodoTests = 0; +  let numTotalTests = 0; +  currentTestCases.forEach(testCase => { +    switch (testCase.testCaseResult.status) { +      case 'failed': { +        numFailingTests++; +        break; +      } + +      case 'passed': { +        numPassingTests++; +        break; +      } + +      case 'skipped': { +        numPendingTests++; +        break; +      } + +      case 'todo': { +        numTodoTests++; +        break; +      } +    } + +    numTotalTests++; +  }); +  return { +    numFailingTests, +    numPassingTests, +    numPendingTests, +    numTodoTests, +    numTotalTests +  }; +}; + +const getSummary = (aggregatedResults, options) => { +  let runTime = (Date.now() - aggregatedResults.startTime) / 1000; + +  if (options && options.roundTime) { +    runTime = Math.floor(runTime); +  } + +  const valuesForCurrentTestCases = getValuesCurrentTestCases( +    options === null || options === void 0 ? void 0 : options.currentTestCases +  ); +  const estimatedTime = (options && options.estimatedTime) || 0; +  const snapshotResults = aggregatedResults.snapshot; +  const snapshotsAdded = snapshotResults.added; +  const snapshotsFailed = snapshotResults.unmatched; +  const snapshotsOutdated = snapshotResults.unchecked; +  const snapshotsFilesRemoved = snapshotResults.filesRemoved; +  const snapshotsDidUpdate = snapshotResults.didUpdate; +  const snapshotsPassed = snapshotResults.matched; +  const snapshotsTotal = snapshotResults.total; +  const snapshotsUpdated = snapshotResults.updated; +  const suitesFailed = aggregatedResults.numFailedTestSuites; +  const suitesPassed = aggregatedResults.numPassedTestSuites; +  const suitesPending = aggregatedResults.numPendingTestSuites; +  const suitesRun = suitesFailed + suitesPassed; +  const suitesTotal = aggregatedResults.numTotalTestSuites; +  const testsFailed = aggregatedResults.numFailedTests; +  const testsPassed = aggregatedResults.numPassedTests; +  const testsPending = aggregatedResults.numPendingTests; +  const testsTodo = aggregatedResults.numTodoTests; +  const testsTotal = aggregatedResults.numTotalTests; +  const width = (options && options.width) || 0; +  const suites = +    _chalk().default.bold('Test Suites: ') + +    (suitesFailed +      ? _chalk().default.bold.red(`${suitesFailed} failed`) + ', ' +      : '') + +    (suitesPending +      ? _chalk().default.bold.yellow(`${suitesPending} skipped`) + ', ' +      : '') + +    (suitesPassed +      ? _chalk().default.bold.green(`${suitesPassed} passed`) + ', ' +      : '') + +    (suitesRun !== suitesTotal +      ? suitesRun + ' of ' + suitesTotal +      : suitesTotal) + +    ' total'; +  const updatedTestsFailed = +    testsFailed + valuesForCurrentTestCases.numFailingTests; +  const updatedTestsPending = +    testsPending + valuesForCurrentTestCases.numPendingTests; +  const updatedTestsTodo = testsTodo + valuesForCurrentTestCases.numTodoTests; +  const updatedTestsPassed = +    testsPassed + valuesForCurrentTestCases.numPassingTests; +  const updatedTestsTotal = +    testsTotal + valuesForCurrentTestCases.numTotalTests; +  const tests = +    _chalk().default.bold('Tests:       ') + +    (updatedTestsFailed > 0 +      ? _chalk().default.bold.red(`${updatedTestsFailed} failed`) + ', ' +      : '') + +    (updatedTestsPending > 0 +      ? _chalk().default.bold.yellow(`${updatedTestsPending} skipped`) + ', ' +      : '') + +    (updatedTestsTodo > 0 +      ? _chalk().default.bold.magenta(`${updatedTestsTodo} todo`) + ', ' +      : '') + +    (updatedTestsPassed > 0 +      ? _chalk().default.bold.green(`${updatedTestsPassed} passed`) + ', ' +      : '') + +    `${updatedTestsTotal} total`; +  const snapshots = +    _chalk().default.bold('Snapshots:   ') + +    (snapshotsFailed +      ? _chalk().default.bold.red(`${snapshotsFailed} failed`) + ', ' +      : '') + +    (snapshotsOutdated && !snapshotsDidUpdate +      ? _chalk().default.bold.yellow(`${snapshotsOutdated} obsolete`) + ', ' +      : '') + +    (snapshotsOutdated && snapshotsDidUpdate +      ? _chalk().default.bold.green(`${snapshotsOutdated} removed`) + ', ' +      : '') + +    (snapshotsFilesRemoved && !snapshotsDidUpdate +      ? _chalk().default.bold.yellow( +          (0, _jestUtil().pluralize)('file', snapshotsFilesRemoved) + +            ' obsolete' +        ) + ', ' +      : '') + +    (snapshotsFilesRemoved && snapshotsDidUpdate +      ? _chalk().default.bold.green( +          (0, _jestUtil().pluralize)('file', snapshotsFilesRemoved) + ' removed' +        ) + ', ' +      : '') + +    (snapshotsUpdated +      ? _chalk().default.bold.green(`${snapshotsUpdated} updated`) + ', ' +      : '') + +    (snapshotsAdded +      ? _chalk().default.bold.green(`${snapshotsAdded} written`) + ', ' +      : '') + +    (snapshotsPassed +      ? _chalk().default.bold.green(`${snapshotsPassed} passed`) + ', ' +      : '') + +    `${snapshotsTotal} total`; +  const time = renderTime(runTime, estimatedTime, width); +  return [suites, tests, snapshots, time].join('\n'); +}; + +exports.getSummary = getSummary; + +const renderTime = (runTime, estimatedTime, width) => { +  // If we are more than one second over the estimated time, highlight it. +  const renderedTime = +    estimatedTime && runTime >= estimatedTime + 1 +      ? _chalk().default.bold.yellow((0, _jestUtil().formatTime)(runTime, 0)) +      : (0, _jestUtil().formatTime)(runTime, 0); +  let time = _chalk().default.bold('Time:') + `        ${renderedTime}`; + +  if (runTime < estimatedTime) { +    time += `, estimated ${(0, _jestUtil().formatTime)(estimatedTime, 0)}`; +  } // Only show a progress bar if the test run is actually going to take +  // some time. + +  if (estimatedTime > 2 && runTime < estimatedTime && width) { +    const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width); +    const length = Math.min( +      Math.floor((runTime / estimatedTime) * availableWidth), +      availableWidth +    ); + +    if (availableWidth >= 2) { +      time += +        '\n' + +        _chalk().default.green('â–ˆ').repeat(length) + +        _chalk() +          .default.white('â–ˆ') +          .repeat(availableWidth - length); +    } +  } + +  return time; +}; // word-wrap a string that contains ANSI escape sequences. +// ANSI escape sequences do not add to the string length. + +const wrapAnsiString = (string, terminalWidth) => { +  if (terminalWidth === 0) { +    // if the terminal width is zero, don't bother word-wrapping +    return string; +  } + +  const ANSI_REGEXP = /[\u001b\u009b]\[\d{1,2}m/gu; +  const tokens = []; +  let lastIndex = 0; +  let match; + +  while ((match = ANSI_REGEXP.exec(string))) { +    const ansi = match[0]; +    const index = match['index']; + +    if (index != lastIndex) { +      tokens.push(['string', string.slice(lastIndex, index)]); +    } + +    tokens.push(['ansi', ansi]); +    lastIndex = index + ansi.length; +  } + +  if (lastIndex != string.length - 1) { +    tokens.push(['string', string.slice(lastIndex, string.length)]); +  } + +  let lastLineLength = 0; +  return tokens +    .reduce( +      (lines, [kind, token]) => { +        if (kind === 'string') { +          if (lastLineLength + token.length > terminalWidth) { +            while (token.length) { +              const chunk = token.slice(0, terminalWidth - lastLineLength); +              const remaining = token.slice( +                terminalWidth - lastLineLength, +                token.length +              ); +              lines[lines.length - 1] += chunk; +              lastLineLength += chunk.length; +              token = remaining; + +              if (token.length) { +                lines.push(''); +                lastLineLength = 0; +              } +            } +          } else { +            lines[lines.length - 1] += token; +            lastLineLength += token.length; +          } +        } else { +          lines[lines.length - 1] += token; +        } + +        return lines; +      }, +      [''] +    ) +    .join('\n'); +}; + +exports.wrapAnsiString = wrapAnsiString; diff --git a/node_modules/@jest/reporters/package.json b/node_modules/@jest/reporters/package.json new file mode 100644 index 0000000..e85e6d1 --- /dev/null +++ b/node_modules/@jest/reporters/package.json @@ -0,0 +1,80 @@ +{ +  "name": "@jest/reporters", +  "description": "Jest's reporters", +  "version": "27.5.1", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@bcoe/v8-coverage": "^0.2.3", +    "@jest/console": "^27.5.1", +    "@jest/test-result": "^27.5.1", +    "@jest/transform": "^27.5.1", +    "@jest/types": "^27.5.1", +    "@types/node": "*", +    "chalk": "^4.0.0", +    "collect-v8-coverage": "^1.0.0", +    "exit": "^0.1.2", +    "glob": "^7.1.2", +    "graceful-fs": "^4.2.9", +    "istanbul-lib-coverage": "^3.0.0", +    "istanbul-lib-instrument": "^5.1.0", +    "istanbul-lib-report": "^3.0.0", +    "istanbul-lib-source-maps": "^4.0.0", +    "istanbul-reports": "^3.1.3", +    "jest-haste-map": "^27.5.1", +    "jest-resolve": "^27.5.1", +    "jest-util": "^27.5.1", +    "jest-worker": "^27.5.1", +    "slash": "^3.0.0", +    "source-map": "^0.6.0", +    "string-length": "^4.0.1", +    "terminal-link": "^2.0.0", +    "v8-to-istanbul": "^8.1.0" +  }, +  "devDependencies": { +    "@jest/test-utils": "^27.5.1", +    "@types/exit": "^0.1.30", +    "@types/glob": "^7.1.1", +    "@types/graceful-fs": "^4.1.3", +    "@types/istanbul-lib-coverage": "^2.0.0", +    "@types/istanbul-lib-instrument": "^1.7.2", +    "@types/istanbul-lib-report": "^3.0.0", +    "@types/istanbul-lib-source-maps": "^4.0.0", +    "@types/istanbul-reports": "^3.0.0", +    "@types/node-notifier": "^8.0.0", +    "mock-fs": "^4.4.1", +    "strip-ansi": "^6.0.0" +  }, +  "peerDependencies": { +    "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" +  }, +  "peerDependenciesMeta": { +    "node-notifier": { +      "optional": true +    } +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest", +    "directory": "packages/jest-reporters" +  }, +  "bugs": { +    "url": "https://github.com/facebook/jest/issues" +  }, +  "homepage": "https://jestjs.io/", +  "license": "MIT", +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/source-map/LICENSE b/node_modules/@jest/source-map/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/source-map/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/source-map/build/getCallsite.d.ts b/node_modules/@jest/source-map/build/getCallsite.d.ts new file mode 100644 index 0000000..c09ab3d --- /dev/null +++ b/node_modules/@jest/source-map/build/getCallsite.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. + */ +import callsites = require('callsites'); +import type { SourceMapRegistry } from './types'; +export default function getCallsite(level: number, sourceMaps?: SourceMapRegistry | null): callsites.CallSite; diff --git a/node_modules/@jest/source-map/build/getCallsite.js b/node_modules/@jest/source-map/build/getCallsite.js new file mode 100644 index 0000000..35c6102 --- /dev/null +++ b/node_modules/@jest/source-map/build/getCallsite.js @@ -0,0 +1,108 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = getCallsite; + +function _callsites() { +  const data = _interopRequireDefault(require('callsites')); + +  _callsites = function () { +    return data; +  }; + +  return data; +} + +function _gracefulFs() { +  const data = require('graceful-fs'); + +  _gracefulFs = function () { +    return data; +  }; + +  return data; +} + +function _sourceMap() { +  const data = require('source-map'); + +  _sourceMap = function () { +    return data; +  }; + +  return data; +} + +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. + */ +// Copied from https://github.com/rexxars/sourcemap-decorate-callsites/blob/5b9735a156964973a75dc62fd2c7f0c1975458e8/lib/index.js#L113-L158 +const addSourceMapConsumer = (callsite, consumer) => { +  const getLineNumber = callsite.getLineNumber; +  const getColumnNumber = callsite.getColumnNumber; +  let position = null; + +  function getPosition() { +    if (!position) { +      position = consumer.originalPositionFor({ +        column: getColumnNumber.call(callsite) || -1, +        line: getLineNumber.call(callsite) || -1 +      }); +    } + +    return position; +  } + +  Object.defineProperties(callsite, { +    getColumnNumber: { +      value() { +        return getPosition().column || getColumnNumber.call(callsite); +      }, + +      writable: false +    }, +    getLineNumber: { +      value() { +        return getPosition().line || getLineNumber.call(callsite); +      }, + +      writable: false +    } +  }); +}; + +function getCallsite(level, sourceMaps) { +  const levelAfterThisCall = level + 1; +  const stack = (0, _callsites().default)()[levelAfterThisCall]; +  const sourceMapFileName = +    sourceMaps === null || sourceMaps === void 0 +      ? void 0 +      : sourceMaps.get(stack.getFileName() || ''); + +  if (sourceMapFileName) { +    try { +      const sourceMap = (0, _gracefulFs().readFileSync)( +        sourceMapFileName, +        'utf8' +      ); // @ts-expect-error: Not allowed to pass string + +      addSourceMapConsumer( +        stack, +        new (_sourceMap().SourceMapConsumer)(sourceMap) +      ); +    } catch { +      // ignore +    } +  } + +  return stack; +} diff --git a/node_modules/@jest/source-map/build/index.d.ts b/node_modules/@jest/source-map/build/index.d.ts new file mode 100644 index 0000000..a6ffae9 --- /dev/null +++ b/node_modules/@jest/source-map/build/index.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 as getCallsite } from './getCallsite'; +export type { SourceMapRegistry } from './types'; diff --git a/node_modules/@jest/source-map/build/index.js b/node_modules/@jest/source-map/build/index.js new file mode 100644 index 0000000..3411605 --- /dev/null +++ b/node_modules/@jest/source-map/build/index.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +Object.defineProperty(exports, 'getCallsite', { +  enumerable: true, +  get: function () { +    return _getCallsite.default; +  } +}); + +var _getCallsite = _interopRequireDefault(require('./getCallsite')); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/source-map/build/types.d.ts b/node_modules/@jest/source-map/build/types.d.ts new file mode 100644 index 0000000..3910875 --- /dev/null +++ b/node_modules/@jest/source-map/build/types.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 declare type SourceMapRegistry = Map<string, string>; diff --git a/node_modules/@jest/source-map/build/types.js b/node_modules/@jest/source-map/build/types.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/source-map/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/source-map/package.json b/node_modules/@jest/source-map/package.json new file mode 100644 index 0000000..9ade03c --- /dev/null +++ b/node_modules/@jest/source-map/package.json @@ -0,0 +1,34 @@ +{ +  "name": "@jest/source-map", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-source-map" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "callsites": "^3.0.0", +    "graceful-fs": "^4.2.9", +    "source-map": "^0.6.0" +  }, +  "devDependencies": { +    "@types/graceful-fs": "^4.1.2" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/test-result/LICENSE b/node_modules/@jest/test-result/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/test-result/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/test-result/build/formatTestResults.d.ts b/node_modules/@jest/test-result/build/formatTestResults.d.ts new file mode 100644 index 0000000..6a3bf03 --- /dev/null +++ b/node_modules/@jest/test-result/build/formatTestResults.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 { AggregatedResult, CodeCoverageFormatter, CodeCoverageReporter, FormattedTestResults } from './types'; +export default function formatTestResults(results: AggregatedResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter): FormattedTestResults; diff --git a/node_modules/@jest/test-result/build/formatTestResults.js b/node_modules/@jest/test-result/build/formatTestResults.js new file mode 100644 index 0000000..3de0cdf --- /dev/null +++ b/node_modules/@jest/test-result/build/formatTestResults.js @@ -0,0 +1,70 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = formatTestResults; + +/** + * 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 formatTestResult = (testResult, codeCoverageFormatter, reporter) => { +  const assertionResults = testResult.testResults.map(formatTestAssertion); + +  if (testResult.testExecError) { +    const now = Date.now(); +    return { +      assertionResults, +      coverage: {}, +      endTime: now, +      message: testResult.failureMessage +        ? testResult.failureMessage +        : testResult.testExecError.message, +      name: testResult.testFilePath, +      startTime: now, +      status: 'failed', +      summary: '' +    }; +  } else { +    const allTestsPassed = testResult.numFailingTests === 0; +    return { +      assertionResults, +      coverage: codeCoverageFormatter +        ? codeCoverageFormatter(testResult.coverage, reporter) +        : testResult.coverage, +      endTime: testResult.perfStats.end, +      message: testResult.failureMessage || '', +      name: testResult.testFilePath, +      startTime: testResult.perfStats.start, +      status: allTestsPassed ? 'passed' : 'failed', +      summary: '' +    }; +  } +}; + +function formatTestAssertion(assertion) { +  const result = { +    ancestorTitles: assertion.ancestorTitles, +    failureMessages: null, +    fullName: assertion.fullName, +    location: assertion.location, +    status: assertion.status, +    title: assertion.title +  }; + +  if (assertion.failureMessages) { +    result.failureMessages = assertion.failureMessages; +  } + +  return result; +} + +function formatTestResults(results, codeCoverageFormatter, reporter) { +  const testResults = results.testResults.map(testResult => +    formatTestResult(testResult, codeCoverageFormatter, reporter) +  ); +  return {...results, testResults}; +} diff --git a/node_modules/@jest/test-result/build/helpers.d.ts b/node_modules/@jest/test-result/build/helpers.d.ts new file mode 100644 index 0000000..480c7ab --- /dev/null +++ b/node_modules/@jest/test-result/build/helpers.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 { Config } from '@jest/types'; +import type { AggregatedResult, SerializableError, TestResult } from './types'; +export declare const makeEmptyAggregatedTestResult: () => AggregatedResult; +export declare const buildFailureTestResult: (testPath: Config.Path, err: SerializableError) => TestResult; +export declare const addResult: (aggregatedResults: AggregatedResult, testResult: TestResult) => void; +export declare const createEmptyTestResult: () => TestResult; diff --git a/node_modules/@jest/test-result/build/helpers.js b/node_modules/@jest/test-result/build/helpers.js new file mode 100644 index 0000000..c63ad6b --- /dev/null +++ b/node_modules/@jest/test-result/build/helpers.js @@ -0,0 +1,188 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.makeEmptyAggregatedTestResult = +  exports.createEmptyTestResult = +  exports.buildFailureTestResult = +  exports.addResult = +    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. + */ +const makeEmptyAggregatedTestResult = () => ({ +  numFailedTestSuites: 0, +  numFailedTests: 0, +  numPassedTestSuites: 0, +  numPassedTests: 0, +  numPendingTestSuites: 0, +  numPendingTests: 0, +  numRuntimeErrorTestSuites: 0, +  numTodoTests: 0, +  numTotalTestSuites: 0, +  numTotalTests: 0, +  openHandles: [], +  snapshot: { +    added: 0, +    didUpdate: false, +    // is set only after the full run +    failure: false, +    filesAdded: 0, +    // combines individual test results + removed files after the full run +    filesRemoved: 0, +    filesRemovedList: [], +    filesUnmatched: 0, +    filesUpdated: 0, +    matched: 0, +    total: 0, +    unchecked: 0, +    uncheckedKeysByFile: [], +    unmatched: 0, +    updated: 0 +  }, +  startTime: 0, +  success: true, +  testResults: [], +  wasInterrupted: false +}); + +exports.makeEmptyAggregatedTestResult = makeEmptyAggregatedTestResult; + +const buildFailureTestResult = (testPath, err) => ({ +  console: undefined, +  displayName: undefined, +  failureMessage: null, +  leaks: false, +  numFailingTests: 0, +  numPassingTests: 0, +  numPendingTests: 0, +  numTodoTests: 0, +  openHandles: [], +  perfStats: { +    end: 0, +    runtime: 0, +    slow: false, +    start: 0 +  }, +  skipped: false, +  snapshot: { +    added: 0, +    fileDeleted: false, +    matched: 0, +    unchecked: 0, +    uncheckedKeys: [], +    unmatched: 0, +    updated: 0 +  }, +  testExecError: err, +  testFilePath: testPath, +  testResults: [] +}); // Add individual test result to an aggregated test result + +exports.buildFailureTestResult = buildFailureTestResult; + +const addResult = (aggregatedResults, testResult) => { +  // `todos` are new as of Jest 24, and not all runners return it. +  // Set it to `0` to avoid `NaN` +  if (!testResult.numTodoTests) { +    testResult.numTodoTests = 0; +  } + +  aggregatedResults.testResults.push(testResult); +  aggregatedResults.numTotalTests += +    testResult.numPassingTests + +    testResult.numFailingTests + +    testResult.numPendingTests + +    testResult.numTodoTests; +  aggregatedResults.numFailedTests += testResult.numFailingTests; +  aggregatedResults.numPassedTests += testResult.numPassingTests; +  aggregatedResults.numPendingTests += testResult.numPendingTests; +  aggregatedResults.numTodoTests += testResult.numTodoTests; + +  if (testResult.testExecError) { +    aggregatedResults.numRuntimeErrorTestSuites++; +  } + +  if (testResult.skipped) { +    aggregatedResults.numPendingTestSuites++; +  } else if (testResult.numFailingTests > 0 || testResult.testExecError) { +    aggregatedResults.numFailedTestSuites++; +  } else { +    aggregatedResults.numPassedTestSuites++; +  } // Snapshot data + +  if (testResult.snapshot.added) { +    aggregatedResults.snapshot.filesAdded++; +  } + +  if (testResult.snapshot.fileDeleted) { +    aggregatedResults.snapshot.filesRemoved++; +  } + +  if (testResult.snapshot.unmatched) { +    aggregatedResults.snapshot.filesUnmatched++; +  } + +  if (testResult.snapshot.updated) { +    aggregatedResults.snapshot.filesUpdated++; +  } + +  aggregatedResults.snapshot.added += testResult.snapshot.added; +  aggregatedResults.snapshot.matched += testResult.snapshot.matched; +  aggregatedResults.snapshot.unchecked += testResult.snapshot.unchecked; + +  if ( +    testResult.snapshot.uncheckedKeys && +    testResult.snapshot.uncheckedKeys.length > 0 +  ) { +    aggregatedResults.snapshot.uncheckedKeysByFile.push({ +      filePath: testResult.testFilePath, +      keys: testResult.snapshot.uncheckedKeys +    }); +  } + +  aggregatedResults.snapshot.unmatched += testResult.snapshot.unmatched; +  aggregatedResults.snapshot.updated += testResult.snapshot.updated; +  aggregatedResults.snapshot.total += +    testResult.snapshot.added + +    testResult.snapshot.matched + +    testResult.snapshot.unmatched + +    testResult.snapshot.updated; +}; + +exports.addResult = addResult; + +const createEmptyTestResult = () => ({ +  leaks: false, +  // That's legacy code, just adding it as needed for typing +  numFailingTests: 0, +  numPassingTests: 0, +  numPendingTests: 0, +  numTodoTests: 0, +  openHandles: [], +  perfStats: { +    end: 0, +    runtime: 0, +    slow: false, +    start: 0 +  }, +  skipped: false, +  snapshot: { +    added: 0, +    fileDeleted: false, +    matched: 0, +    unchecked: 0, +    uncheckedKeys: [], +    unmatched: 0, +    updated: 0 +  }, +  testFilePath: '', +  testResults: [] +}); + +exports.createEmptyTestResult = createEmptyTestResult; diff --git a/node_modules/@jest/test-result/build/index.d.ts b/node_modules/@jest/test-result/build/index.d.ts new file mode 100644 index 0000000..d46d37b --- /dev/null +++ b/node_modules/@jest/test-result/build/index.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 as formatTestResults } from './formatTestResults'; +export { addResult, buildFailureTestResult, createEmptyTestResult, makeEmptyAggregatedTestResult, } from './helpers'; +export type { AggregatedResult, AssertionLocation, AssertionResult, FailedAssertion, FormattedTestResults, Milliseconds, RuntimeTransformResult, SerializableError, SnapshotSummary, Status, Suite, Test, TestEvents, TestFileEvent, TestResult, TestResultsProcessor, TestCaseResult, V8CoverageResult, } from './types'; diff --git a/node_modules/@jest/test-result/build/index.js b/node_modules/@jest/test-result/build/index.js new file mode 100644 index 0000000..23920e2 --- /dev/null +++ b/node_modules/@jest/test-result/build/index.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +Object.defineProperty(exports, 'addResult', { +  enumerable: true, +  get: function () { +    return _helpers.addResult; +  } +}); +Object.defineProperty(exports, 'buildFailureTestResult', { +  enumerable: true, +  get: function () { +    return _helpers.buildFailureTestResult; +  } +}); +Object.defineProperty(exports, 'createEmptyTestResult', { +  enumerable: true, +  get: function () { +    return _helpers.createEmptyTestResult; +  } +}); +Object.defineProperty(exports, 'formatTestResults', { +  enumerable: true, +  get: function () { +    return _formatTestResults.default; +  } +}); +Object.defineProperty(exports, 'makeEmptyAggregatedTestResult', { +  enumerable: true, +  get: function () { +    return _helpers.makeEmptyAggregatedTestResult; +  } +}); + +var _formatTestResults = _interopRequireDefault(require('./formatTestResults')); + +var _helpers = require('./helpers'); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/test-result/build/types.d.ts b/node_modules/@jest/test-result/build/types.d.ts new file mode 100644 index 0000000..c06f477 --- /dev/null +++ b/node_modules/@jest/test-result/build/types.d.ts @@ -0,0 +1,171 @@ +/** + * 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 { V8Coverage } from 'collect-v8-coverage'; +import type { CoverageMap, CoverageMapData } from 'istanbul-lib-coverage'; +import type { ConsoleBuffer } from '@jest/console'; +import type { Config, TestResult, TransformTypes } from '@jest/types'; +import type { FS as HasteFS, ModuleMap } from 'jest-haste-map'; +import type Resolver from 'jest-resolve'; +export interface RuntimeTransformResult extends TransformTypes.TransformResult { +    wrapperLength: number; +} +export declare type V8CoverageResult = Array<{ +    codeTransformResult: RuntimeTransformResult | undefined; +    result: V8Coverage[number]; +}>; +export declare type SerializableError = TestResult.SerializableError; +export declare type FailedAssertion = { +    matcherName?: string; +    message?: string; +    actual?: unknown; +    pass?: boolean; +    passed?: boolean; +    expected?: unknown; +    isNot?: boolean; +    stack?: string; +    error?: unknown; +}; +export declare type AssertionLocation = { +    fullName: string; +    path: string; +}; +export declare type Status = AssertionResult['status']; +export declare type Bytes = number; +export declare type Milliseconds = TestResult.Milliseconds; +export declare type AssertionResult = TestResult.AssertionResult; +export declare type FormattedAssertionResult = Pick<AssertionResult, 'ancestorTitles' | 'fullName' | 'location' | 'status' | 'title'> & { +    failureMessages: AssertionResult['failureMessages'] | null; +}; +export declare type AggregatedResultWithoutCoverage = { +    numFailedTests: number; +    numFailedTestSuites: number; +    numPassedTests: number; +    numPassedTestSuites: number; +    numPendingTests: number; +    numTodoTests: number; +    numPendingTestSuites: number; +    numRuntimeErrorTestSuites: number; +    numTotalTests: number; +    numTotalTestSuites: number; +    openHandles: Array<Error>; +    snapshot: SnapshotSummary; +    startTime: number; +    success: boolean; +    testResults: Array<TestResult>; +    wasInterrupted: boolean; +}; +export declare type AggregatedResult = AggregatedResultWithoutCoverage & { +    coverageMap?: CoverageMap | null; +}; +export declare type TestResultsProcessor = (results: AggregatedResult) => AggregatedResult; +export declare type Suite = { +    title: string; +    suites: Array<Suite>; +    tests: Array<AssertionResult>; +}; +export declare type TestCaseResult = AssertionResult; +export declare type TestResult = { +    console?: ConsoleBuffer; +    coverage?: CoverageMapData; +    displayName?: Config.DisplayName; +    failureMessage?: string | null; +    leaks: boolean; +    memoryUsage?: Bytes; +    numFailingTests: number; +    numPassingTests: number; +    numPendingTests: number; +    numTodoTests: number; +    openHandles: Array<Error>; +    perfStats: { +        end: Milliseconds; +        runtime: Milliseconds; +        slow: boolean; +        start: Milliseconds; +    }; +    skipped: boolean; +    snapshot: { +        added: number; +        fileDeleted: boolean; +        matched: number; +        unchecked: number; +        uncheckedKeys: Array<string>; +        unmatched: number; +        updated: number; +    }; +    testExecError?: SerializableError; +    testFilePath: Config.Path; +    testResults: Array<AssertionResult>; +    v8Coverage?: V8CoverageResult; +}; +export declare type FormattedTestResult = { +    message: string; +    name: string; +    summary: string; +    status: 'failed' | 'passed'; +    startTime: number; +    endTime: number; +    coverage: unknown; +    assertionResults: Array<FormattedAssertionResult>; +}; +export declare type FormattedTestResults = { +    coverageMap?: CoverageMap | null | undefined; +    numFailedTests: number; +    numFailedTestSuites: number; +    numPassedTests: number; +    numPassedTestSuites: number; +    numPendingTests: number; +    numPendingTestSuites: number; +    numRuntimeErrorTestSuites: number; +    numTotalTests: number; +    numTotalTestSuites: number; +    snapshot: SnapshotSummary; +    startTime: number; +    success: boolean; +    testResults: Array<FormattedTestResult>; +    wasInterrupted: boolean; +}; +export declare type CodeCoverageReporter = unknown; +export declare type CodeCoverageFormatter = (coverage: CoverageMapData | null | undefined, reporter: CodeCoverageReporter) => Record<string, unknown> | null | undefined; +export declare type UncheckedSnapshot = { +    filePath: string; +    keys: Array<string>; +}; +export declare type SnapshotSummary = { +    added: number; +    didUpdate: boolean; +    failure: boolean; +    filesAdded: number; +    filesRemoved: number; +    filesRemovedList: Array<string>; +    filesUnmatched: number; +    filesUpdated: number; +    matched: number; +    total: number; +    unchecked: number; +    uncheckedKeysByFile: Array<UncheckedSnapshot>; +    unmatched: number; +    updated: number; +}; +export declare type Test = { +    context: Context; +    duration?: number; +    path: Config.Path; +}; +declare type Context = { +    config: Config.ProjectConfig; +    hasteFS: HasteFS; +    moduleMap: ModuleMap; +    resolver: Resolver; +}; +export declare type TestEvents = { +    'test-file-start': [Test]; +    'test-file-success': [Test, TestResult]; +    'test-file-failure': [Test, SerializableError]; +    'test-case-result': [Config.Path, AssertionResult]; +}; +export declare type TestFileEvent<T extends keyof TestEvents = keyof TestEvents> = (eventName: T, args: TestEvents[T]) => unknown; +export {}; diff --git a/node_modules/@jest/test-result/build/types.js b/node_modules/@jest/test-result/build/types.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/test-result/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/test-result/package.json b/node_modules/@jest/test-result/package.json new file mode 100644 index 0000000..bf36bbf --- /dev/null +++ b/node_modules/@jest/test-result/package.json @@ -0,0 +1,32 @@ +{ +  "name": "@jest/test-result", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-test-result" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@jest/console": "^27.5.1", +    "@jest/types": "^27.5.1", +    "@types/istanbul-lib-coverage": "^2.0.0", +    "collect-v8-coverage": "^1.0.0" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/test-sequencer/LICENSE b/node_modules/@jest/test-sequencer/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/test-sequencer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/test-sequencer/build/index.d.ts b/node_modules/@jest/test-sequencer/build/index.d.ts new file mode 100644 index 0000000..7b48a2b --- /dev/null +++ b/node_modules/@jest/test-sequencer/build/index.d.ts @@ -0,0 +1,51 @@ +/** + * 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 { AggregatedResult, Test } from '@jest/test-result'; +import type { Context } from 'jest-runtime'; +declare type Cache = { +    [key: string]: [0 | 1, number]; +}; +/** + * The TestSequencer will ultimately decide which tests should run first. + * It is responsible for storing and reading from a local cache + * map that stores context information for a given test, such as how long it + * took to run during the last run and if it has failed or not. + * Such information is used on: + * TestSequencer.sort(tests: Array<Test>) + * to sort the order of the provided tests. + * + * After the results are collected, + * TestSequencer.cacheResults(tests: Array<Test>, results: AggregatedResult) + * is called to store/update this information on the cache map. + */ +export default class TestSequencer { +    private _cache; +    _getCachePath(context: Context): string; +    _getCache(test: Test): Cache; +    /** +     * Sorting tests is very important because it has a great impact on the +     * user-perceived responsiveness and speed of the test run. +     * +     * If such information is on cache, tests are sorted based on: +     * -> Has it failed during the last run ? +     * Since it's important to provide the most expected feedback as quickly +     * as possible. +     * -> How long it took to run ? +     * Because running long tests first is an effort to minimize worker idle +     * time at the end of a long test run. +     * And if that information is not available they are sorted based on file size +     * since big test files usually take longer to complete. +     * +     * Note that a possible improvement would be to analyse other information +     * from the file other than its size. +     * +     */ +    sort(tests: Array<Test>): Array<Test>; +    allFailedTests(tests: Array<Test>): Array<Test>; +    cacheResults(tests: Array<Test>, results: AggregatedResult): void; +} +export {}; diff --git a/node_modules/@jest/test-sequencer/build/index.js b/node_modules/@jest/test-sequencer/build/index.js new file mode 100644 index 0000000..29fd68c --- /dev/null +++ b/node_modules/@jest/test-sequencer/build/index.js @@ -0,0 +1,237 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = void 0; + +function fs() { +  const data = _interopRequireWildcard(require('graceful-fs')); + +  fs = function () { +    return data; +  }; + +  return data; +} + +function _jestHasteMap() { +  const data = _interopRequireDefault(require('jest-haste-map')); + +  _jestHasteMap = function () { +    return data; +  }; + +  return data; +} + +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; +} + +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 FAIL = 0; +const SUCCESS = 1; + +/** + * The TestSequencer will ultimately decide which tests should run first. + * It is responsible for storing and reading from a local cache + * map that stores context information for a given test, such as how long it + * took to run during the last run and if it has failed or not. + * Such information is used on: + * TestSequencer.sort(tests: Array<Test>) + * to sort the order of the provided tests. + * + * After the results are collected, + * TestSequencer.cacheResults(tests: Array<Test>, results: AggregatedResult) + * is called to store/update this information on the cache map. + */ +class TestSequencer { +  constructor() { +    _defineProperty(this, '_cache', new Map()); +  } + +  _getCachePath(context) { +    const {config} = context; + +    const HasteMapClass = _jestHasteMap().default.getStatic(config); + +    return HasteMapClass.getCacheFilePath( +      config.cacheDirectory, +      'perf-cache-' + config.name +    ); +  } + +  _getCache(test) { +    const {context} = test; + +    if (!this._cache.has(context) && context.config.cache) { +      const cachePath = this._getCachePath(context); + +      if (fs().existsSync(cachePath)) { +        try { +          this._cache.set( +            context, +            JSON.parse(fs().readFileSync(cachePath, 'utf8')) +          ); +        } catch {} +      } +    } + +    let cache = this._cache.get(context); + +    if (!cache) { +      cache = {}; + +      this._cache.set(context, cache); +    } + +    return cache; +  } +  /** +   * Sorting tests is very important because it has a great impact on the +   * user-perceived responsiveness and speed of the test run. +   * +   * If such information is on cache, tests are sorted based on: +   * -> Has it failed during the last run ? +   * Since it's important to provide the most expected feedback as quickly +   * as possible. +   * -> How long it took to run ? +   * Because running long tests first is an effort to minimize worker idle +   * time at the end of a long test run. +   * And if that information is not available they are sorted based on file size +   * since big test files usually take longer to complete. +   * +   * Note that a possible improvement would be to analyse other information +   * from the file other than its size. +   * +   */ + +  sort(tests) { +    const stats = {}; + +    const fileSize = ({path, context: {hasteFS}}) => +      stats[path] || (stats[path] = hasteFS.getSize(path) || 0); + +    const hasFailed = (cache, test) => +      cache[test.path] && cache[test.path][0] === FAIL; + +    const time = (cache, test) => cache[test.path] && cache[test.path][1]; + +    tests.forEach(test => (test.duration = time(this._getCache(test), test))); +    return tests.sort((testA, testB) => { +      const cacheA = this._getCache(testA); + +      const cacheB = this._getCache(testB); + +      const failedA = hasFailed(cacheA, testA); +      const failedB = hasFailed(cacheB, testB); +      const hasTimeA = testA.duration != null; + +      if (failedA !== failedB) { +        return failedA ? -1 : 1; +      } else if (hasTimeA != (testB.duration != null)) { +        // If only one of two tests has timing information, run it last +        return hasTimeA ? 1 : -1; +      } else if (testA.duration != null && testB.duration != null) { +        return testA.duration < testB.duration ? 1 : -1; +      } else { +        return fileSize(testA) < fileSize(testB) ? 1 : -1; +      } +    }); +  } + +  allFailedTests(tests) { +    const hasFailed = (cache, test) => { +      var _cache$test$path; + +      return ( +        ((_cache$test$path = cache[test.path]) === null || +        _cache$test$path === void 0 +          ? void 0 +          : _cache$test$path[0]) === FAIL +      ); +    }; + +    return this.sort( +      tests.filter(test => hasFailed(this._getCache(test), test)) +    ); +  } + +  cacheResults(tests, results) { +    const map = Object.create(null); +    tests.forEach(test => (map[test.path] = test)); +    results.testResults.forEach(testResult => { +      if (testResult && map[testResult.testFilePath] && !testResult.skipped) { +        const cache = this._getCache(map[testResult.testFilePath]); + +        const perf = testResult.perfStats; +        cache[testResult.testFilePath] = [ +          testResult.numFailingTests ? FAIL : SUCCESS, +          perf.runtime || 0 +        ]; +      } +    }); + +    this._cache.forEach((cache, context) => +      fs().writeFileSync(this._getCachePath(context), JSON.stringify(cache)) +    ); +  } +} + +exports.default = TestSequencer; diff --git a/node_modules/@jest/test-sequencer/package.json b/node_modules/@jest/test-sequencer/package.json new file mode 100644 index 0000000..f4eb2c3 --- /dev/null +++ b/node_modules/@jest/test-sequencer/package.json @@ -0,0 +1,35 @@ +{ +  "name": "@jest/test-sequencer", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-test-sequencer" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@jest/test-result": "^27.5.1", +    "graceful-fs": "^4.2.9", +    "jest-haste-map": "^27.5.1", +    "jest-runtime": "^27.5.1" +  }, +  "devDependencies": { +    "@types/graceful-fs": "^4.1.3" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/transform/LICENSE b/node_modules/@jest/transform/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/transform/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/transform/build/ScriptTransformer.d.ts b/node_modules/@jest/transform/build/ScriptTransformer.d.ts new file mode 100644 index 0000000..a36c7c7 --- /dev/null +++ b/node_modules/@jest/transform/build/ScriptTransformer.d.ts @@ -0,0 +1,40 @@ +/** + * 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 type { Options, ReducedTransformOptions, RequireAndTranspileModuleOptions, StringMap, TransformResult } from './types'; +declare class ScriptTransformer { +    private readonly _config; +    private readonly _cacheFS; +    private readonly _cache; +    private readonly _transformCache; +    private _transformsAreLoaded; +    constructor(_config: Config.ProjectConfig, _cacheFS: StringMap); +    private _buildCacheKeyFromFileInfo; +    private _getCacheKey; +    private _getCacheKeyAsync; +    private _createFolderFromCacheKey; +    private _getFileCachePath; +    private _getFileCachePathAsync; +    private _getTransformPath; +    loadTransformers(): Promise<void>; +    private _getTransformer; +    private _instrumentFile; +    private _buildTransformResult; +    transformSource(filepath: Config.Path, content: string, options: ReducedTransformOptions): TransformResult; +    transformSourceAsync(filepath: Config.Path, content: string, options: ReducedTransformOptions): Promise<TransformResult>; +    private _transformAndBuildScriptAsync; +    private _transformAndBuildScript; +    transformAsync(filename: Config.Path, options: Options, fileSource?: string): Promise<TransformResult>; +    transform(filename: Config.Path, options: Options, fileSource?: string): TransformResult; +    transformJson(filename: Config.Path, options: Options, fileSource: string): string; +    requireAndTranspileModule<ModuleType = unknown>(moduleName: string, callback?: (module: ModuleType) => void | Promise<void>, options?: RequireAndTranspileModuleOptions): Promise<ModuleType>; +    shouldTransform(filename: Config.Path): boolean; +} +export declare function createTranspilingRequire(config: Config.ProjectConfig): Promise<(<TModuleType = unknown>(resolverPath: string, applyInteropRequireDefault?: boolean) => Promise<TModuleType>)>; +export declare type TransformerType = ScriptTransformer; +export declare function createScriptTransformer(config: Config.ProjectConfig, cacheFS?: StringMap): Promise<TransformerType>; +export {}; diff --git a/node_modules/@jest/transform/build/ScriptTransformer.js b/node_modules/@jest/transform/build/ScriptTransformer.js new file mode 100644 index 0000000..edc7f2c --- /dev/null +++ b/node_modules/@jest/transform/build/ScriptTransformer.js @@ -0,0 +1,1115 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.createScriptTransformer = createScriptTransformer; +exports.createTranspilingRequire = createTranspilingRequire; + +function _crypto() { +  const data = require('crypto'); + +  _crypto = function () { +    return data; +  }; + +  return data; +} + +function path() { +  const data = _interopRequireWildcard(require('path')); + +  path = function () { +    return data; +  }; + +  return data; +} + +function _core() { +  const data = require('@babel/core'); + +  _core = function () { +    return data; +  }; + +  return data; +} + +function _babelPluginIstanbul() { +  const data = _interopRequireDefault(require('babel-plugin-istanbul')); + +  _babelPluginIstanbul = function () { +    return data; +  }; + +  return data; +} + +function _convertSourceMap() { +  const data = require('convert-source-map'); + +  _convertSourceMap = function () { +    return data; +  }; + +  return data; +} + +function _fastJsonStableStringify() { +  const data = _interopRequireDefault(require('fast-json-stable-stringify')); + +  _fastJsonStableStringify = function () { +    return data; +  }; + +  return data; +} + +function fs() { +  const data = _interopRequireWildcard(require('graceful-fs')); + +  fs = function () { +    return data; +  }; + +  return data; +} + +function _pirates() { +  const data = require('pirates'); + +  _pirates = function () { +    return data; +  }; + +  return data; +} + +function _slash() { +  const data = _interopRequireDefault(require('slash')); + +  _slash = function () { +    return data; +  }; + +  return data; +} + +function _writeFileAtomic() { +  const data = require('write-file-atomic'); + +  _writeFileAtomic = function () { +    return data; +  }; + +  return data; +} + +function _jestHasteMap() { +  const data = _interopRequireDefault(require('jest-haste-map')); + +  _jestHasteMap = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +var _enhanceUnexpectedTokenMessage = _interopRequireDefault( +  require('./enhanceUnexpectedTokenMessage') +); + +var _runtimeErrorsAndWarnings = require('./runtimeErrorsAndWarnings'); + +var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument')); + +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; +} + +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; +} + +// Use `require` to avoid TS rootDir +const {version: VERSION} = require('../package.json'); + +// This data structure is used to avoid recalculating some data every time that +// we need to transform a file. Since ScriptTransformer is instantiated for each +// file we need to keep this object in the local scope of this module. +const projectCaches = new Map(); // To reset the cache for specific changesets (rather than package version). + +const CACHE_VERSION = '1'; + +async function waitForPromiseWithCleanup(promise, cleanup) { +  try { +    await promise; +  } finally { +    cleanup(); +  } +} + +class ScriptTransformer { +  constructor(_config, _cacheFS) { +    _defineProperty(this, '_cache', void 0); + +    _defineProperty(this, '_transformCache', new Map()); + +    _defineProperty(this, '_transformsAreLoaded', false); + +    this._config = _config; +    this._cacheFS = _cacheFS; +    const configString = (0, _fastJsonStableStringify().default)(this._config); +    let projectCache = projectCaches.get(configString); + +    if (!projectCache) { +      projectCache = { +        configString, +        ignorePatternsRegExp: calcIgnorePatternRegExp(this._config), +        transformRegExp: calcTransformRegExp(this._config), +        transformedFiles: new Map() +      }; +      projectCaches.set(configString, projectCache); +    } + +    this._cache = projectCache; +  } + +  _buildCacheKeyFromFileInfo( +    fileData, +    filename, +    transformOptions, +    transformerCacheKey +  ) { +    if (transformerCacheKey) { +      return (0, _crypto().createHash)('md5') +        .update(transformerCacheKey) +        .update(CACHE_VERSION) +        .digest('hex'); +    } + +    return (0, _crypto().createHash)('md5') +      .update(fileData) +      .update(transformOptions.configString) +      .update(transformOptions.instrument ? 'instrument' : '') +      .update(filename) +      .update(CACHE_VERSION) +      .digest('hex'); +  } + +  _getCacheKey(fileData, filename, options) { +    const configString = this._cache.configString; +    const {transformer, transformerConfig = {}} = +      this._getTransformer(filename) || {}; +    let transformerCacheKey = undefined; +    const transformOptions = { +      ...options, +      cacheFS: this._cacheFS, +      config: this._config, +      configString, +      transformerConfig +    }; + +    if ( +      typeof (transformer === null || transformer === void 0 +        ? void 0 +        : transformer.getCacheKey) === 'function' +    ) { +      transformerCacheKey = transformer.getCacheKey( +        fileData, +        filename, +        transformOptions +      ); +    } + +    return this._buildCacheKeyFromFileInfo( +      fileData, +      filename, +      transformOptions, +      transformerCacheKey +    ); +  } + +  async _getCacheKeyAsync(fileData, filename, options) { +    const configString = this._cache.configString; +    const {transformer, transformerConfig = {}} = +      this._getTransformer(filename) || {}; +    let transformerCacheKey = undefined; +    const transformOptions = { +      ...options, +      cacheFS: this._cacheFS, +      config: this._config, +      configString, +      transformerConfig +    }; + +    if (transformer) { +      const getCacheKey = +        transformer.getCacheKeyAsync || transformer.getCacheKey; + +      if (typeof getCacheKey === 'function') { +        transformerCacheKey = await getCacheKey( +          fileData, +          filename, +          transformOptions +        ); +      } +    } + +    return this._buildCacheKeyFromFileInfo( +      fileData, +      filename, +      transformOptions, +      transformerCacheKey +    ); +  } + +  _createFolderFromCacheKey(filename, cacheKey) { +    const HasteMapClass = _jestHasteMap().default.getStatic(this._config); + +    const baseCacheDir = HasteMapClass.getCacheFilePath( +      this._config.cacheDirectory, +      'jest-transform-cache-' + this._config.name, +      VERSION +    ); // Create sub folders based on the cacheKey to avoid creating one +    // directory with many files. + +    const cacheDir = path().join(baseCacheDir, cacheKey[0] + cacheKey[1]); +    const cacheFilenamePrefix = path() +      .basename(filename, path().extname(filename)) +      .replace(/\W/g, ''); +    const cachePath = (0, _slash().default)( +      path().join(cacheDir, cacheFilenamePrefix + '_' + cacheKey) +    ); +    (0, _jestUtil().createDirectory)(cacheDir); +    return cachePath; +  } + +  _getFileCachePath(filename, content, options) { +    const cacheKey = this._getCacheKey(content, filename, options); + +    return this._createFolderFromCacheKey(filename, cacheKey); +  } + +  async _getFileCachePathAsync(filename, content, options) { +    const cacheKey = await this._getCacheKeyAsync(content, filename, options); +    return this._createFolderFromCacheKey(filename, cacheKey); +  } + +  _getTransformPath(filename) { +    const transformRegExp = this._cache.transformRegExp; + +    if (!transformRegExp) { +      return undefined; +    } + +    for (let i = 0; i < transformRegExp.length; i++) { +      if (transformRegExp[i][0].test(filename)) { +        return transformRegExp[i][1]; +      } +    } + +    return undefined; +  } + +  async loadTransformers() { +    await Promise.all( +      this._config.transform.map( +        async ([, transformPath, transformerConfig]) => { +          let transformer = await (0, _jestUtil().requireOrImportModule)( +            transformPath +          ); + +          if (!transformer) { +            throw new Error( +              (0, _runtimeErrorsAndWarnings.makeInvalidTransformerError)( +                transformPath +              ) +            ); +          } + +          if (typeof transformer.createTransformer === 'function') { +            transformer = transformer.createTransformer(transformerConfig); +          } + +          if ( +            typeof transformer.process !== 'function' && +            typeof transformer.processAsync !== 'function' +          ) { +            throw new Error( +              (0, _runtimeErrorsAndWarnings.makeInvalidTransformerError)( +                transformPath +              ) +            ); +          } + +          const res = { +            transformer, +            transformerConfig +          }; + +          this._transformCache.set(transformPath, res); +        } +      ) +    ); +    this._transformsAreLoaded = true; +  } + +  _getTransformer(filename) { +    if (!this._transformsAreLoaded) { +      throw new Error( +        'Jest: Transformers have not been loaded yet - make sure to run `loadTransformers` and wait for it to complete before starting to transform files' +      ); +    } + +    if (this._config.transform.length === 0) { +      return null; +    } + +    const transformPath = this._getTransformPath(filename); + +    if (!transformPath) { +      return null; +    } + +    const cached = this._transformCache.get(transformPath); + +    if (cached) { +      return cached; +    } + +    throw new Error( +      `Jest was unable to load the transformer defined for ${filename}. This is a bug in Jest, please open up an issue` +    ); +  } + +  _instrumentFile(filename, input, canMapToInput, options) { +    const inputCode = typeof input === 'string' ? input : input.code; +    const inputMap = typeof input === 'string' ? null : input.map; +    const result = (0, _core().transformSync)(inputCode, { +      auxiliaryCommentBefore: ' istanbul ignore next ', +      babelrc: false, +      caller: { +        name: '@jest/transform', +        supportsDynamicImport: options.supportsDynamicImport, +        supportsExportNamespaceFrom: options.supportsExportNamespaceFrom, +        supportsStaticESM: options.supportsStaticESM, +        supportsTopLevelAwait: options.supportsTopLevelAwait +      }, +      configFile: false, +      filename, +      plugins: [ +        [ +          _babelPluginIstanbul().default, +          { +            compact: false, +            // files outside `cwd` will not be instrumented +            cwd: this._config.rootDir, +            exclude: [], +            extension: false, +            inputSourceMap: inputMap, +            useInlineSourceMaps: false +          } +        ] +      ], +      sourceMaps: canMapToInput ? 'both' : false +    }); + +    if (result && result.code) { +      return result; +    } + +    return input; +  } + +  _buildTransformResult( +    filename, +    cacheFilePath, +    content, +    transformer, +    shouldCallTransform, +    options, +    processed, +    sourceMapPath +  ) { +    let transformed = { +      code: content, +      map: null +    }; + +    if (transformer && shouldCallTransform) { +      if (typeof processed === 'string') { +        transformed.code = processed; +      } else if (processed != null && typeof processed.code === 'string') { +        transformed = processed; +      } else { +        throw new Error( +          (0, _runtimeErrorsAndWarnings.makeInvalidReturnValueError)() +        ); +      } +    } + +    if (!transformed.map) { +      try { +        //Could be a potential freeze here. +        //See: https://github.com/facebook/jest/pull/5177#discussion_r158883570 +        const inlineSourceMap = (0, _convertSourceMap().fromSource)( +          transformed.code +        ); + +        if (inlineSourceMap) { +          transformed.map = inlineSourceMap.toObject(); +        } +      } catch { +        const transformPath = this._getTransformPath(filename); + +        invariant(transformPath); +        console.warn( +          (0, _runtimeErrorsAndWarnings.makeInvalidSourceMapWarning)( +            filename, +            transformPath +          ) +        ); +      } +    } // That means that the transform has a custom instrumentation +    // logic and will handle it based on `config.collectCoverage` option + +    const transformWillInstrument = +      shouldCallTransform && transformer && transformer.canInstrument; // Apply instrumentation to the code if necessary, keeping the instrumented code and new map + +    let map = transformed.map; +    let code; + +    if (!transformWillInstrument && options.instrument) { +      /** +       * We can map the original source code to the instrumented code ONLY if +       * - the process of transforming the code produced a source map e.g. ts-jest +       * - we did not transform the source code +       * +       * Otherwise we cannot make any statements about how the instrumented code corresponds to the original code, +       * and we should NOT emit any source maps +       * +       */ +      const shouldEmitSourceMaps = +        (transformer != null && map != null) || transformer == null; + +      const instrumented = this._instrumentFile( +        filename, +        transformed, +        shouldEmitSourceMaps, +        options +      ); + +      code = +        typeof instrumented === 'string' ? instrumented : instrumented.code; +      map = typeof instrumented === 'string' ? null : instrumented.map; +    } else { +      code = transformed.code; +    } + +    if (map) { +      const sourceMapContent = +        typeof map === 'string' ? map : JSON.stringify(map); +      invariant(sourceMapPath, 'We should always have default sourceMapPath'); +      writeCacheFile(sourceMapPath, sourceMapContent); +    } else { +      sourceMapPath = null; +    } + +    writeCodeCacheFile(cacheFilePath, code); +    return { +      code, +      originalCode: content, +      sourceMapPath +    }; +  } + +  transformSource(filepath, content, options) { +    const filename = (0, _jestUtil().tryRealpath)(filepath); +    const {transformer, transformerConfig = {}} = +      this._getTransformer(filename) || {}; + +    const cacheFilePath = this._getFileCachePath(filename, content, options); + +    const sourceMapPath = cacheFilePath + '.map'; // Ignore cache if `config.cache` is set (--no-cache) + +    const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null; + +    if (code) { +      // This is broken: we return the code, and a path for the source map +      // directly from the cache. But, nothing ensures the source map actually +      // matches that source code. They could have gotten out-of-sync in case +      // two separate processes write concurrently to the same cache files. +      return { +        code, +        originalCode: content, +        sourceMapPath +      }; +    } + +    let processed = null; +    let shouldCallTransform = false; + +    if (transformer && this.shouldTransform(filename)) { +      shouldCallTransform = true; +      assertSyncTransformer(transformer, this._getTransformPath(filename)); +      processed = transformer.process(content, filename, { +        ...options, +        cacheFS: this._cacheFS, +        config: this._config, +        configString: this._cache.configString, +        transformerConfig +      }); +    } + +    return this._buildTransformResult( +      filename, +      cacheFilePath, +      content, +      transformer, +      shouldCallTransform, +      options, +      processed, +      sourceMapPath +    ); +  } + +  async transformSourceAsync(filepath, content, options) { +    const filename = (0, _jestUtil().tryRealpath)(filepath); +    const {transformer, transformerConfig = {}} = +      this._getTransformer(filename) || {}; +    const cacheFilePath = await this._getFileCachePathAsync( +      filename, +      content, +      options +    ); +    const sourceMapPath = cacheFilePath + '.map'; // Ignore cache if `config.cache` is set (--no-cache) + +    const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null; + +    if (code) { +      // This is broken: we return the code, and a path for the source map +      // directly from the cache. But, nothing ensures the source map actually +      // matches that source code. They could have gotten out-of-sync in case +      // two separate processes write concurrently to the same cache files. +      return { +        code, +        originalCode: content, +        sourceMapPath +      }; +    } + +    let processed = null; +    let shouldCallTransform = false; + +    if (transformer && this.shouldTransform(filename)) { +      shouldCallTransform = true; +      const process = transformer.processAsync || transformer.process; // This is probably dead code since `_getTransformerAsync` already asserts this + +      invariant( +        typeof process === 'function', +        'A transformer must always export either a `process` or `processAsync`' +      ); +      processed = await process(content, filename, { +        ...options, +        cacheFS: this._cacheFS, +        config: this._config, +        configString: this._cache.configString, +        transformerConfig +      }); +    } + +    return this._buildTransformResult( +      filename, +      cacheFilePath, +      content, +      transformer, +      shouldCallTransform, +      options, +      processed, +      sourceMapPath +    ); +  } + +  async _transformAndBuildScriptAsync( +    filename, +    options, +    transformOptions, +    fileSource +  ) { +    const {isInternalModule} = options; +    let fileContent = +      fileSource !== null && fileSource !== void 0 +        ? fileSource +        : this._cacheFS.get(filename); + +    if (!fileContent) { +      fileContent = fs().readFileSync(filename, 'utf8'); + +      this._cacheFS.set(filename, fileContent); +    } + +    const content = stripShebang(fileContent); +    let code = content; +    let sourceMapPath = null; +    const willTransform = +      !isInternalModule && +      (transformOptions.instrument || this.shouldTransform(filename)); + +    try { +      if (willTransform) { +        const transformedSource = await this.transformSourceAsync( +          filename, +          content, +          transformOptions +        ); +        code = transformedSource.code; +        sourceMapPath = transformedSource.sourceMapPath; +      } + +      return { +        code, +        originalCode: content, +        sourceMapPath +      }; +    } catch (e) { +      throw (0, _enhanceUnexpectedTokenMessage.default)(e); +    } +  } + +  _transformAndBuildScript(filename, options, transformOptions, fileSource) { +    const {isInternalModule} = options; +    let fileContent = +      fileSource !== null && fileSource !== void 0 +        ? fileSource +        : this._cacheFS.get(filename); + +    if (!fileContent) { +      fileContent = fs().readFileSync(filename, 'utf8'); + +      this._cacheFS.set(filename, fileContent); +    } + +    const content = stripShebang(fileContent); +    let code = content; +    let sourceMapPath = null; +    const willTransform = +      !isInternalModule && +      (transformOptions.instrument || this.shouldTransform(filename)); + +    try { +      if (willTransform) { +        const transformedSource = this.transformSource( +          filename, +          content, +          transformOptions +        ); +        code = transformedSource.code; +        sourceMapPath = transformedSource.sourceMapPath; +      } + +      return { +        code, +        originalCode: content, +        sourceMapPath +      }; +    } catch (e) { +      throw (0, _enhanceUnexpectedTokenMessage.default)(e); +    } +  } + +  async transformAsync(filename, options, fileSource) { +    const instrument = +      options.coverageProvider === 'babel' && +      (0, _shouldInstrument.default)(filename, options, this._config); +    const scriptCacheKey = getScriptCacheKey(filename, instrument); + +    let result = this._cache.transformedFiles.get(scriptCacheKey); + +    if (result) { +      return result; +    } + +    result = await this._transformAndBuildScriptAsync( +      filename, +      options, +      {...options, instrument}, +      fileSource +    ); + +    if (scriptCacheKey) { +      this._cache.transformedFiles.set(scriptCacheKey, result); +    } + +    return result; +  } + +  transform(filename, options, fileSource) { +    const instrument = +      options.coverageProvider === 'babel' && +      (0, _shouldInstrument.default)(filename, options, this._config); +    const scriptCacheKey = getScriptCacheKey(filename, instrument); + +    let result = this._cache.transformedFiles.get(scriptCacheKey); + +    if (result) { +      return result; +    } + +    result = this._transformAndBuildScript( +      filename, +      options, +      {...options, instrument}, +      fileSource +    ); + +    if (scriptCacheKey) { +      this._cache.transformedFiles.set(scriptCacheKey, result); +    } + +    return result; +  } + +  transformJson(filename, options, fileSource) { +    const {isInternalModule} = options; +    const willTransform = !isInternalModule && this.shouldTransform(filename); + +    if (willTransform) { +      const {code: transformedJsonSource} = this.transformSource( +        filename, +        fileSource, +        {...options, instrument: false} +      ); +      return transformedJsonSource; +    } + +    return fileSource; +  } + +  async requireAndTranspileModule( +    moduleName, +    callback, +    options = { +      applyInteropRequireDefault: true, +      instrument: false, +      supportsDynamicImport: false, +      supportsExportNamespaceFrom: false, +      supportsStaticESM: false, +      supportsTopLevelAwait: false +    } +  ) { +    let transforming = false; +    const {applyInteropRequireDefault, ...transformOptions} = options; +    const revertHook = (0, _pirates().addHook)( +      (code, filename) => { +        try { +          transforming = true; +          return ( +            this.transformSource(filename, code, transformOptions).code || code +          ); +        } finally { +          transforming = false; +        } +      }, +      { +        exts: this._config.moduleFileExtensions.map(ext => `.${ext}`), +        ignoreNodeModules: false, +        matcher: filename => { +          if (transforming) { +            // Don't transform any dependency required by the transformer itself +            return false; +          } + +          return this.shouldTransform(filename); +        } +      } +    ); + +    try { +      const module = await (0, _jestUtil().requireOrImportModule)( +        moduleName, +        applyInteropRequireDefault +      ); + +      if (!callback) { +        revertHook(); +        return module; +      } + +      const cbResult = callback(module); + +      if ((0, _jestUtil().isPromise)(cbResult)) { +        return waitForPromiseWithCleanup(cbResult, revertHook).then( +          () => module +        ); +      } + +      return module; +    } finally { +      revertHook(); +    } +  } + +  shouldTransform(filename) { +    const ignoreRegexp = this._cache.ignorePatternsRegExp; +    const isIgnored = ignoreRegexp ? ignoreRegexp.test(filename) : false; +    return this._config.transform.length !== 0 && !isIgnored; +  } +} // TODO: do we need to define the generics twice? + +async function createTranspilingRequire(config) { +  const transformer = await createScriptTransformer(config); +  return async function requireAndTranspileModule( +    resolverPath, +    applyInteropRequireDefault = false +  ) { +    const transpiledModule = await transformer.requireAndTranspileModule( +      resolverPath, +      () => {}, +      { +        applyInteropRequireDefault, +        instrument: false, +        supportsDynamicImport: false, +        // this might be true, depending on node version. +        supportsExportNamespaceFrom: false, +        supportsStaticESM: false, +        supportsTopLevelAwait: false +      } +    ); +    return transpiledModule; +  }; +} + +const removeFile = path => { +  try { +    fs().unlinkSync(path); +  } catch {} +}; + +const stripShebang = content => { +  // If the file data starts with a shebang remove it. Leaves the empty line +  // to keep stack trace line numbers correct. +  if (content.startsWith('#!')) { +    return content.replace(/^#!.*/, ''); +  } else { +    return content; +  } +}; +/** + * This is like `writeCacheFile` but with an additional sanity checksum. We + * cannot use the same technique for source maps because we expose source map + * cache file paths directly to callsites, with the expectation they can read + * it right away. This is not a great system, because source map cache file + * could get corrupted, out-of-sync, etc. + */ + +function writeCodeCacheFile(cachePath, code) { +  const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex'); +  writeCacheFile(cachePath, checksum + '\n' + code); +} +/** + * Read counterpart of `writeCodeCacheFile`. We verify that the content of the + * file matches the checksum, in case some kind of corruption happened. This + * could happen if an older version of `jest-runtime` writes non-atomically to + * the same cache, for example. + */ + +function readCodeCacheFile(cachePath) { +  const content = readCacheFile(cachePath); + +  if (content == null) { +    return null; +  } + +  const code = content.substring(33); +  const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex'); + +  if (checksum === content.substring(0, 32)) { +    return code; +  } + +  return null; +} +/** + * Writing to the cache atomically relies on 'rename' being atomic on most + * file systems. Doing atomic write reduces the risk of corruption by avoiding + * two processes to write to the same file at the same time. It also reduces + * the risk of reading a file that's being overwritten at the same time. + */ + +const writeCacheFile = (cachePath, fileData) => { +  try { +    (0, _writeFileAtomic().sync)(cachePath, fileData, { +      encoding: 'utf8', +      fsync: false +    }); +  } catch (e) { +    if (cacheWriteErrorSafeToIgnore(e, cachePath)) { +      return; +    } + +    e.message = +      'jest: failed to cache transform results in: ' + +      cachePath + +      '\nFailure message: ' + +      e.message; +    removeFile(cachePath); +    throw e; +  } +}; +/** + * On Windows, renames are not atomic, leading to EPERM exceptions when two + * processes attempt to rename to the same target file at the same time. + * If the target file exists we can be reasonably sure another process has + * legitimately won a cache write race and ignore the error. + */ + +const cacheWriteErrorSafeToIgnore = (e, cachePath) => +  process.platform === 'win32' && +  e.code === 'EPERM' && +  fs().existsSync(cachePath); + +const readCacheFile = cachePath => { +  if (!fs().existsSync(cachePath)) { +    return null; +  } + +  let fileData; + +  try { +    fileData = fs().readFileSync(cachePath, 'utf8'); +  } catch (e) { +    e.message = +      'jest: failed to read cache file: ' + +      cachePath + +      '\nFailure message: ' + +      e.message; +    removeFile(cachePath); +    throw e; +  } + +  if (fileData == null) { +    // We must have somehow created the file but failed to write to it, +    // let's delete it and retry. +    removeFile(cachePath); +  } + +  return fileData; +}; + +const getScriptCacheKey = (filename, instrument) => { +  const mtime = fs().statSync(filename).mtime; +  return filename + '_' + mtime.getTime() + (instrument ? '_instrumented' : ''); +}; + +const calcIgnorePatternRegExp = config => { +  if ( +    !config.transformIgnorePatterns || +    config.transformIgnorePatterns.length === 0 +  ) { +    return undefined; +  } + +  return new RegExp(config.transformIgnorePatterns.join('|')); +}; + +const calcTransformRegExp = config => { +  if (!config.transform.length) { +    return undefined; +  } + +  const transformRegexp = []; + +  for (let i = 0; i < config.transform.length; i++) { +    transformRegexp.push([ +      new RegExp(config.transform[i][0]), +      config.transform[i][1], +      config.transform[i][2] +    ]); +  } + +  return transformRegexp; +}; + +function invariant(condition, message) { +  if (!condition) { +    throw new Error(message); +  } +} + +function assertSyncTransformer(transformer, name) { +  invariant(name); +  invariant( +    typeof transformer.process === 'function', +    (0, _runtimeErrorsAndWarnings.makeInvalidSyncTransformerError)(name) +  ); +} + +async function createScriptTransformer(config, cacheFS = new Map()) { +  const transformer = new ScriptTransformer(config, cacheFS); +  await transformer.loadTransformers(); +  return transformer; +} diff --git a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.d.ts b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.d.ts new file mode 100644 index 0000000..7847dc7 --- /dev/null +++ b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.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. + */ +interface ErrorWithCodeFrame extends Error { +    codeFrame?: string; +} +export default function handlePotentialSyntaxError(e: ErrorWithCodeFrame): ErrorWithCodeFrame; +export declare function enhanceUnexpectedTokenMessage(e: Error): Error; +export {}; diff --git a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js new file mode 100644 index 0000000..d2235f5 --- /dev/null +++ b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js @@ -0,0 +1,83 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = handlePotentialSyntaxError; +exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +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 DOT = ' \u2022 '; + +function handlePotentialSyntaxError(e) { +  if (e.codeFrame) { +    e.stack = e.message + '\n' + e.codeFrame; +  } + +  if ( +    // `instanceof` might come from the wrong context +    e.name === 'SyntaxError' && +    !e.message.includes(' expected') +  ) { +    throw enhanceUnexpectedTokenMessage(e); +  } + +  return e; +} + +function enhanceUnexpectedTokenMessage(e) { +  e.stack = +    `${_chalk().default.bold.red('Jest encountered an unexpected token')} + +Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. + +Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. + +By default "node_modules" folder is ignored by transformers. + +Here's what you can do: +${DOT}If you are trying to use ECMAScript Modules, see ${_chalk().default.underline( +      'https://jestjs.io/docs/ecmascript-modules' +    )} for how to enable it. +${DOT}If you are trying to use TypeScript, see ${_chalk().default.underline( +      'https://jestjs.io/docs/getting-started#using-typescript' +    )} +${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold( +      '"transformIgnorePatterns"' +    )} in your config. +${DOT}If you need a custom transformation specify a ${_chalk().default.bold( +      '"transform"' +    )} option in your config. +${DOT}If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the ${_chalk().default.bold( +      '"moduleNameMapper"' +    )} config option. + +You'll find more details and examples of these config options in the docs: +${_chalk().default.cyan('https://jestjs.io/docs/configuration')} +For information about custom transformations, see: +${_chalk().default.cyan('https://jestjs.io/docs/code-transformation')} + +${_chalk().default.bold.red('Details:')} + +` + e.stack; +  return e; +} diff --git a/node_modules/@jest/transform/build/index.d.ts b/node_modules/@jest/transform/build/index.d.ts new file mode 100644 index 0000000..09a5081 --- /dev/null +++ b/node_modules/@jest/transform/build/index.d.ts @@ -0,0 +1,11 @@ +/** + * 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 { createScriptTransformer, createTranspilingRequire, } from './ScriptTransformer'; +export type { TransformerType as ScriptTransformer } from './ScriptTransformer'; +export { default as shouldInstrument } from './shouldInstrument'; +export type { CallerTransformOptions, Transformer, SyncTransformer, AsyncTransformer, ShouldInstrumentOptions, Options as TransformationOptions, TransformOptions, TransformResult, TransformedSource, } from './types'; +export { default as handlePotentialSyntaxError } from './enhanceUnexpectedTokenMessage'; diff --git a/node_modules/@jest/transform/build/index.js b/node_modules/@jest/transform/build/index.js new file mode 100644 index 0000000..ab4d31a --- /dev/null +++ b/node_modules/@jest/transform/build/index.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +Object.defineProperty(exports, 'createScriptTransformer', { +  enumerable: true, +  get: function () { +    return _ScriptTransformer.createScriptTransformer; +  } +}); +Object.defineProperty(exports, 'createTranspilingRequire', { +  enumerable: true, +  get: function () { +    return _ScriptTransformer.createTranspilingRequire; +  } +}); +Object.defineProperty(exports, 'handlePotentialSyntaxError', { +  enumerable: true, +  get: function () { +    return _enhanceUnexpectedTokenMessage.default; +  } +}); +Object.defineProperty(exports, 'shouldInstrument', { +  enumerable: true, +  get: function () { +    return _shouldInstrument.default; +  } +}); + +var _ScriptTransformer = require('./ScriptTransformer'); + +var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument')); + +var _enhanceUnexpectedTokenMessage = _interopRequireDefault( +  require('./enhanceUnexpectedTokenMessage') +); + +function _interopRequireDefault(obj) { +  return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.d.ts b/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.d.ts new file mode 100644 index 0000000..88c8f85 --- /dev/null +++ b/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.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 declare const makeInvalidReturnValueError: () => string; +export declare const makeInvalidSourceMapWarning: (filename: string, transformPath: string) => string; +export declare const makeInvalidSyncTransformerError: (transformPath: string) => string; +export declare const makeInvalidTransformerError: (transformPath: string) => string; diff --git a/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js b/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js new file mode 100644 index 0000000..a88290d --- /dev/null +++ b/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js @@ -0,0 +1,101 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.makeInvalidTransformerError = +  exports.makeInvalidSyncTransformerError = +  exports.makeInvalidSourceMapWarning = +  exports.makeInvalidReturnValueError = +    void 0; + +function _chalk() { +  const data = _interopRequireDefault(require('chalk')); + +  _chalk = function () { +    return data; +  }; + +  return data; +} + +function _slash() { +  const data = _interopRequireDefault(require('slash')); + +  _slash = function () { +    return data; +  }; + +  return data; +} + +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 BULLET = '\u25cf '; +const DOCUMENTATION_NOTE = `  ${_chalk().default.bold( +  'Code Transformation Documentation:' +)} +  https://jestjs.io/docs/code-transformation +`; + +const makeInvalidReturnValueError = () => +  _chalk().default.red( +    [ +      _chalk().default.bold(BULLET + 'Invalid return value:'), +      "  Code transformer's `process` function must return a string or an object", +      '  with `code` key containing a string. If `processAsync` function is implemented,', +      '  it must return a Promise resolving to one of these values.', +      '' +    ].join('\n') + DOCUMENTATION_NOTE +  ); + +exports.makeInvalidReturnValueError = makeInvalidReturnValueError; + +const makeInvalidSourceMapWarning = (filename, transformPath) => +  _chalk().default.yellow( +    [ +      _chalk().default.bold(BULLET + 'Invalid source map:'), +      `  The source map for "${(0, _slash().default)( +        filename +      )}" returned by "${(0, _slash().default)(transformPath)}" is invalid.`, +      '  Proceeding without source mapping for that file.' +    ].join('\n') +  ); + +exports.makeInvalidSourceMapWarning = makeInvalidSourceMapWarning; + +const makeInvalidSyncTransformerError = transformPath => +  _chalk().default.red( +    [ +      _chalk().default.bold(BULLET + 'Invalid synchronous transformer module:'), +      `  "${(0, _slash().default)( +        transformPath +      )}" specified in the "transform" object of Jest configuration`, +      '  must export a `process` function.', +      '' +    ].join('\n') + DOCUMENTATION_NOTE +  ); + +exports.makeInvalidSyncTransformerError = makeInvalidSyncTransformerError; + +const makeInvalidTransformerError = transformPath => +  _chalk().default.red( +    [ +      _chalk().default.bold(BULLET + 'Invalid transformer module:'), +      `  "${(0, _slash().default)( +        transformPath +      )}" specified in the "transform" object of Jest configuration`, +      '  must export a `process` or `processAsync` or `createTransformer` function.', +      '' +    ].join('\n') + DOCUMENTATION_NOTE +  ); + +exports.makeInvalidTransformerError = makeInvalidTransformerError; diff --git a/node_modules/@jest/transform/build/shouldInstrument.d.ts b/node_modules/@jest/transform/build/shouldInstrument.d.ts new file mode 100644 index 0000000..2b7b617 --- /dev/null +++ b/node_modules/@jest/transform/build/shouldInstrument.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. + */ +import type { Config } from '@jest/types'; +import type { ShouldInstrumentOptions } from './types'; +export default function shouldInstrument(filename: Config.Path, options: ShouldInstrumentOptions, config: Config.ProjectConfig): boolean; diff --git a/node_modules/@jest/transform/build/shouldInstrument.js b/node_modules/@jest/transform/build/shouldInstrument.js new file mode 100644 index 0000000..292af31 --- /dev/null +++ b/node_modules/@jest/transform/build/shouldInstrument.js @@ -0,0 +1,207 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { +  value: true +}); +exports.default = shouldInstrument; + +function path() { +  const data = _interopRequireWildcard(require('path')); + +  path = function () { +    return data; +  }; + +  return data; +} + +function _micromatch() { +  const data = _interopRequireDefault(require('micromatch')); + +  _micromatch = function () { +    return data; +  }; + +  return data; +} + +function _jestRegexUtil() { +  const data = require('jest-regex-util'); + +  _jestRegexUtil = function () { +    return data; +  }; + +  return data; +} + +function _jestUtil() { +  const data = require('jest-util'); + +  _jestUtil = function () { +    return data; +  }; + +  return data; +} + +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 MOCKS_PATTERN = new RegExp( +  (0, _jestRegexUtil().escapePathForRegex)( +    path().sep + '__mocks__' + path().sep +  ) +); +const cachedRegexes = new Map(); + +const getRegex = regexStr => { +  if (!cachedRegexes.has(regexStr)) { +    cachedRegexes.set(regexStr, new RegExp(regexStr)); +  } + +  const regex = cachedRegexes.get(regexStr); // prevent stateful regexes from breaking, just in case + +  regex.lastIndex = 0; +  return regex; +}; + +function shouldInstrument(filename, options, config) { +  if (!options.collectCoverage) { +    return false; +  } + +  if ( +    config.forceCoverageMatch.length && +    _micromatch().default.any(filename, config.forceCoverageMatch) +  ) { +    return true; +  } + +  if ( +    !config.testPathIgnorePatterns.some(pattern => +      getRegex(pattern).test(filename) +    ) +  ) { +    if (config.testRegex.some(regex => new RegExp(regex).test(filename))) { +      return false; +    } + +    if ( +      (0, _jestUtil().globsToMatcher)(config.testMatch)( +        (0, _jestUtil().replacePathSepForGlob)(filename) +      ) +    ) { +      return false; +    } +  } + +  if ( +    // This configuration field contains an object in the form of: +    // {'path/to/file.js': true} +    options.collectCoverageOnlyFrom && +    !options.collectCoverageOnlyFrom[filename] +  ) { +    return false; +  } + +  if ( +    // still cover if `only` is specified +    !options.collectCoverageOnlyFrom && +    options.collectCoverageFrom.length && +    !(0, _jestUtil().globsToMatcher)(options.collectCoverageFrom)( +      (0, _jestUtil().replacePathSepForGlob)( +        path().relative(config.rootDir, filename) +      ) +    ) +  ) { +    return false; +  } + +  if ( +    config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern)) +  ) { +    return false; +  } + +  if (config.globalSetup === filename) { +    return false; +  } + +  if (config.globalTeardown === filename) { +    return false; +  } + +  if (config.setupFiles.includes(filename)) { +    return false; +  } + +  if (config.setupFilesAfterEnv.includes(filename)) { +    return false; +  } + +  if (MOCKS_PATTERN.test(filename)) { +    return false; +  } + +  if (options.changedFiles && !options.changedFiles.has(filename)) { +    if (!options.sourcesRelatedToTestsInChangedFiles) { +      return false; +    } + +    if (!options.sourcesRelatedToTestsInChangedFiles.has(filename)) { +      return false; +    } +  } + +  return true; +} diff --git a/node_modules/@jest/transform/build/types.d.ts b/node_modules/@jest/transform/build/types.d.ts new file mode 100644 index 0000000..038bf9d --- /dev/null +++ b/node_modules/@jest/transform/build/types.d.ts @@ -0,0 +1,75 @@ +/** + * 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 { RawSourceMap } from 'source-map'; +import type { Config, TransformTypes } from '@jest/types'; +export interface ShouldInstrumentOptions extends Pick<Config.GlobalConfig, 'collectCoverage' | 'collectCoverageFrom' | 'collectCoverageOnlyFrom' | 'coverageProvider'> { +    changedFiles?: Set<Config.Path>; +    sourcesRelatedToTestsInChangedFiles?: Set<Config.Path>; +} +export interface Options extends ShouldInstrumentOptions, CallerTransformOptions { +    isInternalModule?: boolean; +} +interface FixedRawSourceMap extends Omit<RawSourceMap, 'version'> { +    version: number; +} +export declare type TransformedSource = { +    code: string; +    map?: FixedRawSourceMap | string | null; +} | string; +export declare type TransformResult = TransformTypes.TransformResult; +export interface CallerTransformOptions { +    supportsDynamicImport: boolean; +    supportsExportNamespaceFrom: boolean; +    supportsStaticESM: boolean; +    supportsTopLevelAwait: boolean; +} +export interface ReducedTransformOptions extends CallerTransformOptions { +    instrument: boolean; +} +export interface RequireAndTranspileModuleOptions extends ReducedTransformOptions { +    applyInteropRequireDefault: boolean; +} +export declare type StringMap = Map<string, string>; +export interface TransformOptions<OptionType = unknown> extends ReducedTransformOptions { +    /** a cached file system which is used in jest-runtime - useful to improve performance */ +    cacheFS: StringMap; +    config: Config.ProjectConfig; +    /** A stringified version of the configuration - useful in cache busting */ +    configString: string; +    /** the options passed through Jest's config by the user */ +    transformerConfig: OptionType; +} +export interface SyncTransformer<OptionType = unknown> { +    /** +     * Indicates if the transformer is capable of instrumenting the code for code coverage. +     * +     * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented. +     * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel. +     */ +    canInstrument?: boolean; +    createTransformer?: (options?: OptionType) => SyncTransformer<OptionType>; +    getCacheKey?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions<OptionType>) => string; +    getCacheKeyAsync?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions<OptionType>) => Promise<string>; +    process: (sourceText: string, sourcePath: Config.Path, options: TransformOptions<OptionType>) => TransformedSource; +    processAsync?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions<OptionType>) => Promise<TransformedSource>; +} +export interface AsyncTransformer<OptionType = unknown> { +    /** +     * Indicates if the transformer is capable of instrumenting the code for code coverage. +     * +     * If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented. +     * If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel. +     */ +    canInstrument?: boolean; +    createTransformer?: (options?: OptionType) => AsyncTransformer<OptionType>; +    getCacheKey?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions<OptionType>) => string; +    getCacheKeyAsync?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions<OptionType>) => Promise<string>; +    process?: (sourceText: string, sourcePath: Config.Path, options: TransformOptions<OptionType>) => TransformedSource; +    processAsync: (sourceText: string, sourcePath: Config.Path, options: TransformOptions<OptionType>) => Promise<TransformedSource>; +} +export declare type Transformer<OptionType = unknown> = SyncTransformer<OptionType> | AsyncTransformer<OptionType>; +export {}; diff --git a/node_modules/@jest/transform/build/types.js b/node_modules/@jest/transform/build/types.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/transform/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/transform/package.json b/node_modules/@jest/transform/package.json new file mode 100644 index 0000000..961021e --- /dev/null +++ b/node_modules/@jest/transform/package.json @@ -0,0 +1,53 @@ +{ +  "name": "@jest/transform", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-transform" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@babel/core": "^7.1.0", +    "@jest/types": "^27.5.1", +    "babel-plugin-istanbul": "^6.1.1", +    "chalk": "^4.0.0", +    "convert-source-map": "^1.4.0", +    "fast-json-stable-stringify": "^2.0.0", +    "graceful-fs": "^4.2.9", +    "jest-haste-map": "^27.5.1", +    "jest-regex-util": "^27.5.1", +    "jest-util": "^27.5.1", +    "micromatch": "^4.0.4", +    "pirates": "^4.0.4", +    "slash": "^3.0.0", +    "source-map": "^0.6.1", +    "write-file-atomic": "^3.0.0" +  }, +  "devDependencies": { +    "@jest/test-utils": "^27.5.1", +    "@types/babel__core": "^7.1.0", +    "@types/convert-source-map": "^1.5.1", +    "@types/fast-json-stable-stringify": "^2.0.0", +    "@types/graceful-fs": "^4.1.2", +    "@types/micromatch": "^4.0.1", +    "@types/write-file-atomic": "^3.0.0", +    "dedent": "^0.7.0" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} diff --git a/node_modules/@jest/types/LICENSE b/node_modules/@jest/types/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/@jest/types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. diff --git a/node_modules/@jest/types/build/Circus.d.ts b/node_modules/@jest/types/build/Circus.d.ts new file mode 100644 index 0000000..683832e --- /dev/null +++ b/node_modules/@jest/types/build/Circus.d.ts @@ -0,0 +1,193 @@ +/** + * 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 * as Global from './Global'; +declare type Process = NodeJS.Process; +export declare type DoneFn = Global.DoneFn; +export declare type BlockFn = Global.BlockFn; +export declare type BlockName = Global.BlockName; +export declare type BlockMode = void | 'skip' | 'only' | 'todo'; +export declare type TestMode = BlockMode; +export declare type TestName = Global.TestName; +export declare type TestFn = Global.TestFn; +export declare type HookFn = Global.HookFn; +export declare type AsyncFn = TestFn | HookFn; +export declare type SharedHookType = 'afterAll' | 'beforeAll'; +export declare type HookType = SharedHookType | 'afterEach' | 'beforeEach'; +export declare type TestContext = Global.TestContext; +export declare type Exception = any; +export declare type FormattedError = string; +export declare type Hook = { +    asyncError: Error; +    fn: HookFn; +    type: HookType; +    parent: DescribeBlock; +    seenDone: boolean; +    timeout: number | undefined | null; +}; +export interface EventHandler { +    (event: AsyncEvent, state: State): void | Promise<void>; +    (event: SyncEvent, state: State): void; +} +export declare type Event = SyncEvent | AsyncEvent; +interface JestGlobals extends Global.TestFrameworkGlobals { +    expect: unknown; +} +export declare type SyncEvent = { +    asyncError: Error; +    mode: BlockMode; +    name: 'start_describe_definition'; +    blockName: BlockName; +} | { +    mode: BlockMode; +    name: 'finish_describe_definition'; +    blockName: BlockName; +} | { +    asyncError: Error; +    name: 'add_hook'; +    hookType: HookType; +    fn: HookFn; +    timeout: number | undefined; +} | { +    asyncError: Error; +    name: 'add_test'; +    testName: TestName; +    fn: TestFn; +    mode?: TestMode; +    timeout: number | undefined; +} | { +    name: 'error'; +    error: Exception; +}; +export declare type AsyncEvent = { +    name: 'setup'; +    testNamePattern?: string; +    runtimeGlobals: JestGlobals; +    parentProcess: Process; +} | { +    name: 'include_test_location_in_result'; +} | { +    name: 'hook_start'; +    hook: Hook; +} | { +    name: 'hook_success'; +    describeBlock?: DescribeBlock; +    test?: TestEntry; +    hook: Hook; +} | { +    name: 'hook_failure'; +    error: string | Exception; +    describeBlock?: DescribeBlock; +    test?: TestEntry; +    hook: Hook; +} | { +    name: 'test_fn_start'; +    test: TestEntry; +} | { +    name: 'test_fn_success'; +    test: TestEntry; +} | { +    name: 'test_fn_failure'; +    error: Exception; +    test: TestEntry; +} | { +    name: 'test_retry'; +    test: TestEntry; +} | { +    name: 'test_start'; +    test: TestEntry; +} | { +    name: 'test_skip'; +    test: TestEntry; +} | { +    name: 'test_todo'; +    test: TestEntry; +} | { +    name: 'test_done'; +    test: TestEntry; +} | { +    name: 'run_describe_start'; +    describeBlock: DescribeBlock; +} | { +    name: 'run_describe_finish'; +    describeBlock: DescribeBlock; +} | { +    name: 'run_start'; +} | { +    name: 'run_finish'; +} | { +    name: 'teardown'; +}; +export declare type MatcherResults = { +    actual: unknown; +    expected: unknown; +    name: string; +    pass: boolean; +}; +export declare type TestStatus = 'skip' | 'done' | 'todo'; +export declare type TestResult = { +    duration?: number | null; +    errors: Array<FormattedError>; +    errorsDetailed: Array<MatcherResults | unknown>; +    invocations: number; +    status: TestStatus; +    location?: { +        column: number; +        line: number; +    } | null; +    testPath: Array<TestName | BlockName>; +}; +export declare type RunResult = { +    unhandledErrors: Array<FormattedError>; +    testResults: TestResults; +}; +export declare type TestResults = Array<TestResult>; +export declare type GlobalErrorHandlers = { +    uncaughtException: Array<(exception: Exception) => void>; +    unhandledRejection: Array<(exception: Exception, promise: Promise<unknown>) => void>; +}; +export declare type State = { +    currentDescribeBlock: DescribeBlock; +    currentlyRunningTest?: TestEntry | null; +    expand?: boolean; +    hasFocusedTests: boolean; +    hasStarted: boolean; +    originalGlobalErrorHandlers?: GlobalErrorHandlers; +    parentProcess: Process | null; +    rootDescribeBlock: DescribeBlock; +    testNamePattern?: RegExp | null; +    testTimeout: number; +    unhandledErrors: Array<Exception>; +    includeTestLocationInResult: boolean; +}; +export declare type DescribeBlock = { +    type: 'describeBlock'; +    children: Array<DescribeBlock | TestEntry>; +    hooks: Array<Hook>; +    mode: BlockMode; +    name: BlockName; +    parent?: DescribeBlock; +    /** @deprecated Please get from `children` array instead */ +    tests: Array<TestEntry>; +}; +export declare type TestError = Exception | [Exception | undefined, Exception]; +export declare type TestEntry = { +    type: 'test'; +    asyncError: Exception; +    errors: Array<TestError>; +    fn: TestFn; +    invocations: number; +    mode: TestMode; +    name: TestName; +    parent: DescribeBlock; +    startedAt?: number | null; +    duration?: number | null; +    seenDone: boolean; +    status?: TestStatus | null; +    timeout?: number; +}; +export {}; diff --git a/node_modules/@jest/types/build/Circus.js b/node_modules/@jest/types/build/Circus.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/types/build/Circus.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/types/build/Config.d.ts b/node_modules/@jest/types/build/Config.d.ts new file mode 100644 index 0000000..6290147 --- /dev/null +++ b/node_modules/@jest/types/build/Config.d.ts @@ -0,0 +1,462 @@ +/** + * 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 { ForegroundColor } from 'chalk'; +import type { ReportOptions } from 'istanbul-reports'; +import type { Arguments } from 'yargs'; +declare type CoverageProvider = 'babel' | 'v8'; +declare type Timers = 'real' | 'fake' | 'modern' | 'legacy'; +export declare type Path = string; +export declare type Glob = string; +export declare type HasteConfig = { +    /** Whether to hash files using SHA-1. */ +    computeSha1?: boolean; +    /** The platform to use as the default, e.g. 'ios'. */ +    defaultPlatform?: string | null; +    /** Force use of Node's `fs` APIs rather than shelling out to `find` */ +    forceNodeFilesystemAPI?: boolean; +    /** +     * Whether to follow symlinks when crawling for files. +     *   This options cannot be used in projects which use watchman. +     *   Projects with `watchman` set to true will error if this option is set to true. +     */ +    enableSymlinks?: boolean; +    /** Path to a custom implementation of Haste. */ +    hasteImplModulePath?: string; +    /** All platforms to target, e.g ['ios', 'android']. */ +    platforms?: Array<string>; +    /** Whether to throw on error on module collision. */ +    throwOnModuleCollision?: boolean; +    /** Custom HasteMap module */ +    hasteMapModulePath?: string; +}; +export declare type CoverageReporterName = keyof ReportOptions; +export declare type CoverageReporterWithOptions<K = CoverageReporterName> = K extends CoverageReporterName ? ReportOptions[K] extends never ? never : [K, Partial<ReportOptions[K]>] : never; +export declare type CoverageReporters = Array<CoverageReporterName | CoverageReporterWithOptions>; +export declare type ReporterConfig = [string, Record<string, unknown>]; +export declare type TransformerConfig = [string, Record<string, unknown>]; +export interface ConfigGlobals { +    [K: string]: unknown; +} +export interface PrettyFormatOptions { +} +export declare type DefaultOptions = { +    automock: boolean; +    bail: number; +    cache: boolean; +    cacheDirectory: Path; +    changedFilesWithAncestor: boolean; +    ci: boolean; +    clearMocks: boolean; +    collectCoverage: boolean; +    coveragePathIgnorePatterns: Array<string>; +    coverageReporters: Array<CoverageReporterName>; +    coverageProvider: CoverageProvider; +    detectLeaks: boolean; +    detectOpenHandles: boolean; +    errorOnDeprecated: boolean; +    expand: boolean; +    extensionsToTreatAsEsm: Array<Path>; +    forceCoverageMatch: Array<Glob>; +    globals: ConfigGlobals; +    haste: HasteConfig; +    injectGlobals: boolean; +    listTests: boolean; +    maxConcurrency: number; +    maxWorkers: number | string; +    moduleDirectories: Array<string>; +    moduleFileExtensions: Array<string>; +    moduleNameMapper: Record<string, string | Array<string>>; +    modulePathIgnorePatterns: Array<string>; +    noStackTrace: boolean; +    notify: boolean; +    notifyMode: NotifyMode; +    passWithNoTests: boolean; +    prettierPath: string; +    resetMocks: boolean; +    resetModules: boolean; +    restoreMocks: boolean; +    roots: Array<Path>; +    runTestsByPath: boolean; +    runner: string; +    setupFiles: Array<Path>; +    setupFilesAfterEnv: Array<Path>; +    skipFilter: boolean; +    slowTestThreshold: number; +    snapshotSerializers: Array<Path>; +    testEnvironment: string; +    testEnvironmentOptions: Record<string, unknown>; +    testFailureExitCode: string | number; +    testLocationInResults: boolean; +    testMatch: Array<Glob>; +    testPathIgnorePatterns: Array<string>; +    testRegex: Array<string>; +    testRunner: string; +    testSequencer: string; +    testURL: string; +    timers: Timers; +    transformIgnorePatterns: Array<Glob>; +    useStderr: boolean; +    watch: boolean; +    watchPathIgnorePatterns: Array<string>; +    watchman: boolean; +}; +export declare type DisplayName = { +    name: string; +    color: typeof ForegroundColor; +}; +export declare type InitialOptionsWithRootDir = InitialOptions & Required<Pick<InitialOptions, 'rootDir'>>; +export declare type InitialProjectOptions = Pick<InitialOptions & { +    cwd?: string; +}, keyof ProjectConfig>; +export declare type InitialOptions = Partial<{ +    automock: boolean; +    bail: boolean | number; +    cache: boolean; +    cacheDirectory: Path; +    ci: boolean; +    clearMocks: boolean; +    changedFilesWithAncestor: boolean; +    changedSince: string; +    collectCoverage: boolean; +    collectCoverageFrom: Array<Glob>; +    collectCoverageOnlyFrom: { +        [key: string]: boolean; +    }; +    coverageDirectory: string; +    coveragePathIgnorePatterns: Array<string>; +    coverageProvider: CoverageProvider; +    coverageReporters: CoverageReporters; +    coverageThreshold: CoverageThreshold; +    dependencyExtractor: string; +    detectLeaks: boolean; +    detectOpenHandles: boolean; +    displayName: string | DisplayName; +    expand: boolean; +    extensionsToTreatAsEsm: Array<Path>; +    extraGlobals: Array<string>; +    filter: Path; +    findRelatedTests: boolean; +    forceCoverageMatch: Array<Glob>; +    forceExit: boolean; +    json: boolean; +    globals: ConfigGlobals; +    globalSetup: string | null | undefined; +    globalTeardown: string | null | undefined; +    haste: HasteConfig; +    injectGlobals: boolean; +    reporters: Array<string | ReporterConfig>; +    logHeapUsage: boolean; +    lastCommit: boolean; +    listTests: boolean; +    maxConcurrency: number; +    maxWorkers: number | string; +    moduleDirectories: Array<string>; +    moduleFileExtensions: Array<string>; +    moduleLoader: Path; +    moduleNameMapper: { +        [key: string]: string | Array<string>; +    }; +    modulePathIgnorePatterns: Array<string>; +    modulePaths: Array<string>; +    name: string; +    noStackTrace: boolean; +    notify: boolean; +    notifyMode: string; +    onlyChanged: boolean; +    onlyFailures: boolean; +    outputFile: Path; +    passWithNoTests: boolean; +    /** +     * @deprecated Use `transformIgnorePatterns` options instead. +     */ +    preprocessorIgnorePatterns: Array<Glob>; +    preset: string | null | undefined; +    prettierPath: string | null | undefined; +    projects: Array<Glob | InitialProjectOptions>; +    replname: string | null | undefined; +    resetMocks: boolean; +    resetModules: boolean; +    resolver: Path | null | undefined; +    restoreMocks: boolean; +    rootDir: Path; +    roots: Array<Path>; +    runner: string; +    runTestsByPath: boolean; +    /** +     * @deprecated Use `transform` options instead. +     */ +    scriptPreprocessor: string; +    setupFiles: Array<Path>; +    /** +     * @deprecated Use `setupFilesAfterEnv` options instead. +     */ +    setupTestFrameworkScriptFile: Path; +    setupFilesAfterEnv: Array<Path>; +    silent: boolean; +    skipFilter: boolean; +    skipNodeResolution: boolean; +    slowTestThreshold: number; +    snapshotResolver: Path; +    snapshotSerializers: Array<Path>; +    snapshotFormat: PrettyFormatOptions; +    errorOnDeprecated: boolean; +    testEnvironment: string; +    testEnvironmentOptions: Record<string, unknown>; +    testFailureExitCode: string | number; +    testLocationInResults: boolean; +    testMatch: Array<Glob>; +    testNamePattern: string; +    /** +     * @deprecated Use `roots` options instead. +     */ +    testPathDirs: Array<Path>; +    testPathIgnorePatterns: Array<string>; +    testRegex: string | Array<string>; +    testResultsProcessor: string; +    testRunner: string; +    testSequencer: string; +    testURL: string; +    testTimeout: number; +    timers: Timers; +    transform: { +        [regex: string]: Path | TransformerConfig; +    }; +    transformIgnorePatterns: Array<Glob>; +    watchPathIgnorePatterns: Array<string>; +    unmockedModulePathPatterns: Array<string>; +    updateSnapshot: boolean; +    useStderr: boolean; +    verbose?: boolean; +    watch: boolean; +    watchAll: boolean; +    watchman: boolean; +    watchPlugins: Array<string | [string, Record<string, unknown>]>; +}>; +export declare type SnapshotUpdateState = 'all' | 'new' | 'none'; +declare type NotifyMode = 'always' | 'failure' | 'success' | 'change' | 'success-change' | 'failure-change'; +export declare type CoverageThresholdValue = { +    branches?: number; +    functions?: number; +    lines?: number; +    statements?: number; +}; +declare type CoverageThreshold = { +    [path: string]: CoverageThresholdValue; +    global: CoverageThresholdValue; +}; +export declare type GlobalConfig = { +    bail: number; +    changedSince?: string; +    changedFilesWithAncestor: boolean; +    collectCoverage: boolean; +    collectCoverageFrom: Array<Glob>; +    collectCoverageOnlyFrom?: { +        [key: string]: boolean; +    }; +    coverageDirectory: string; +    coveragePathIgnorePatterns?: Array<string>; +    coverageProvider: CoverageProvider; +    coverageReporters: CoverageReporters; +    coverageThreshold?: CoverageThreshold; +    detectLeaks: boolean; +    detectOpenHandles: boolean; +    expand: boolean; +    filter?: Path; +    findRelatedTests: boolean; +    forceExit: boolean; +    json: boolean; +    globalSetup?: string; +    globalTeardown?: string; +    lastCommit: boolean; +    logHeapUsage: boolean; +    listTests: boolean; +    maxConcurrency: number; +    maxWorkers: number; +    noStackTrace: boolean; +    nonFlagArgs: Array<string>; +    noSCM?: boolean; +    notify: boolean; +    notifyMode: NotifyMode; +    outputFile?: Path; +    onlyChanged: boolean; +    onlyFailures: boolean; +    passWithNoTests: boolean; +    projects: Array<Glob>; +    replname?: string; +    reporters?: Array<string | ReporterConfig>; +    runTestsByPath: boolean; +    rootDir: Path; +    silent?: boolean; +    skipFilter: boolean; +    snapshotFormat: PrettyFormatOptions; +    errorOnDeprecated: boolean; +    testFailureExitCode: number; +    testNamePattern?: string; +    testPathPattern: string; +    testResultsProcessor?: string; +    testSequencer: string; +    testTimeout?: number; +    updateSnapshot: SnapshotUpdateState; +    useStderr: boolean; +    verbose?: boolean; +    watch: boolean; +    watchAll: boolean; +    watchman: boolean; +    watchPlugins?: Array<{ +        path: string; +        config: Record<string, unknown>; +    }> | null; +}; +export declare type ProjectConfig = { +    automock: boolean; +    cache: boolean; +    cacheDirectory: Path; +    clearMocks: boolean; +    coveragePathIgnorePatterns: Array<string>; +    cwd: Path; +    dependencyExtractor?: string; +    detectLeaks: boolean; +    detectOpenHandles: boolean; +    displayName?: DisplayName; +    errorOnDeprecated: boolean; +    extensionsToTreatAsEsm: Array<Path>; +    extraGlobals: Array<keyof typeof globalThis>; +    filter?: Path; +    forceCoverageMatch: Array<Glob>; +    globalSetup?: string; +    globalTeardown?: string; +    globals: ConfigGlobals; +    haste: HasteConfig; +    injectGlobals: boolean; +    moduleDirectories: Array<string>; +    moduleFileExtensions: Array<string>; +    moduleLoader?: Path; +    moduleNameMapper: Array<[string, string]>; +    modulePathIgnorePatterns: Array<string>; +    modulePaths?: Array<string>; +    name: string; +    prettierPath: string; +    resetMocks: boolean; +    resetModules: boolean; +    resolver?: Path; +    restoreMocks: boolean; +    rootDir: Path; +    roots: Array<Path>; +    runner: string; +    setupFiles: Array<Path>; +    setupFilesAfterEnv: Array<Path>; +    skipFilter: boolean; +    skipNodeResolution?: boolean; +    slowTestThreshold: number; +    snapshotResolver?: Path; +    snapshotSerializers: Array<Path>; +    snapshotFormat: PrettyFormatOptions; +    testEnvironment: string; +    testEnvironmentOptions: Record<string, unknown>; +    testMatch: Array<Glob>; +    testLocationInResults: boolean; +    testPathIgnorePatterns: Array<string>; +    testRegex: Array<string | RegExp>; +    testRunner: string; +    testURL: string; +    timers: Timers; +    transform: Array<[string, Path, Record<string, unknown>]>; +    transformIgnorePatterns: Array<Glob>; +    watchPathIgnorePatterns: Array<string>; +    unmockedModulePathPatterns?: Array<string>; +}; +export declare type Argv = Arguments<Partial<{ +    all: boolean; +    automock: boolean; +    bail: boolean | number; +    cache: boolean; +    cacheDirectory: string; +    changedFilesWithAncestor: boolean; +    changedSince: string; +    ci: boolean; +    clearCache: boolean; +    clearMocks: boolean; +    collectCoverage: boolean; +    collectCoverageFrom: string; +    collectCoverageOnlyFrom: Array<string>; +    color: boolean; +    colors: boolean; +    config: string; +    coverage: boolean; +    coverageDirectory: string; +    coveragePathIgnorePatterns: Array<string>; +    coverageReporters: Array<string>; +    coverageThreshold: string; +    debug: boolean; +    env: string; +    expand: boolean; +    findRelatedTests: boolean; +    forceExit: boolean; +    globals: string; +    globalSetup: string | null | undefined; +    globalTeardown: string | null | undefined; +    haste: string; +    init: boolean; +    injectGlobals: boolean; +    json: boolean; +    lastCommit: boolean; +    logHeapUsage: boolean; +    maxWorkers: number | string; +    moduleDirectories: Array<string>; +    moduleFileExtensions: Array<string>; +    moduleNameMapper: string; +    modulePathIgnorePatterns: Array<string>; +    modulePaths: Array<string>; +    noStackTrace: boolean; +    notify: boolean; +    notifyMode: string; +    onlyChanged: boolean; +    onlyFailures: boolean; +    outputFile: string; +    preset: string | null | undefined; +    projects: Array<string>; +    prettierPath: string | null | undefined; +    resetMocks: boolean; +    resetModules: boolean; +    resolver: string | null | undefined; +    restoreMocks: boolean; +    rootDir: string; +    roots: Array<string>; +    runInBand: boolean; +    selectProjects: Array<string>; +    setupFiles: Array<string>; +    setupFilesAfterEnv: Array<string>; +    showConfig: boolean; +    silent: boolean; +    snapshotSerializers: Array<string>; +    testEnvironment: string; +    testEnvironmentOptions: string; +    testFailureExitCode: string | null | undefined; +    testMatch: Array<string>; +    testNamePattern: string; +    testPathIgnorePatterns: Array<string>; +    testPathPattern: Array<string>; +    testRegex: string | Array<string>; +    testResultsProcessor: string; +    testRunner: string; +    testSequencer: string; +    testURL: string; +    testTimeout: number | null | undefined; +    timers: string; +    transform: string; +    transformIgnorePatterns: Array<string>; +    unmockedModulePathPatterns: Array<string> | null | undefined; +    updateSnapshot: boolean; +    useStderr: boolean; +    verbose: boolean; +    version: boolean; +    watch: boolean; +    watchAll: boolean; +    watchman: boolean; +    watchPathIgnorePatterns: Array<string>; +}>>; +export {}; diff --git a/node_modules/@jest/types/build/Config.js b/node_modules/@jest/types/build/Config.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/types/build/Config.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/types/build/Global.d.ts b/node_modules/@jest/types/build/Global.d.ts new file mode 100644 index 0000000..ed498e5 --- /dev/null +++ b/node_modules/@jest/types/build/Global.d.ts @@ -0,0 +1,95 @@ +/** + * 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 { CoverageMapData } from 'istanbul-lib-coverage'; +export declare type ValidTestReturnValues = void | undefined; +declare type TestReturnValuePromise = Promise<unknown>; +declare type TestReturnValueGenerator = Generator<void, unknown, void>; +export declare type TestReturnValue = ValidTestReturnValues | TestReturnValuePromise; +export declare type TestContext = Record<string, unknown>; +export declare type DoneFn = (reason?: string | Error) => void; +export declare type DoneTakingTestFn = (this: TestContext | undefined, done: DoneFn) => ValidTestReturnValues; +export declare type PromiseReturningTestFn = (this: TestContext | undefined) => TestReturnValue; +export declare type GeneratorReturningTestFn = (this: TestContext | undefined) => TestReturnValueGenerator; +export declare type TestName = string; +export declare type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn; +export declare type ConcurrentTestFn = () => TestReturnValuePromise; +export declare type BlockFn = () => void; +export declare type BlockName = string; +export declare type HookFn = TestFn; +export declare type Col = unknown; +export declare type Row = ReadonlyArray<Col>; +export declare type Table = ReadonlyArray<Row>; +export declare type ArrayTable = Table | Row; +export declare type TemplateTable = TemplateStringsArray; +export declare type TemplateData = ReadonlyArray<unknown>; +export declare type EachTable = ArrayTable | TemplateTable; +export declare type TestCallback = BlockFn | TestFn | ConcurrentTestFn; +export declare type EachTestFn<EachCallback extends TestCallback> = (...args: ReadonlyArray<any>) => ReturnType<EachCallback>; +declare type Jasmine = { +    _DEFAULT_TIMEOUT_INTERVAL?: number; +    addMatchers: (matchers: Record<string, unknown>) => void; +}; +declare type Each<EachCallback extends TestCallback> = ((table: EachTable, ...taggedTemplateData: TemplateData) => (name: BlockName | TestName, test: EachTestFn<EachCallback>, timeout?: number) => void) | (() => () => void); +export interface HookBase { +    (fn: HookFn, timeout?: number): void; +} +export interface ItBase { +    (testName: TestName, fn: TestFn, timeout?: number): void; +    each: Each<TestFn>; +} +export interface It extends ItBase { +    only: ItBase; +    skip: ItBase; +    todo: (testName: TestName) => void; +} +export interface ItConcurrentBase { +    (testName: TestName, testFn: ConcurrentTestFn, timeout?: number): void; +    each: Each<ConcurrentTestFn>; +} +export interface ItConcurrentExtended extends ItConcurrentBase { +    only: ItConcurrentBase; +    skip: ItConcurrentBase; +} +export interface ItConcurrent extends It { +    concurrent: ItConcurrentExtended; +} +export interface DescribeBase { +    (blockName: BlockName, blockFn: BlockFn): void; +    each: Each<BlockFn>; +} +export interface Describe extends DescribeBase { +    only: DescribeBase; +    skip: DescribeBase; +} +export interface TestFrameworkGlobals { +    it: ItConcurrent; +    test: ItConcurrent; +    fit: ItBase & { +        concurrent?: ItConcurrentBase; +    }; +    xit: ItBase; +    xtest: ItBase; +    describe: Describe; +    xdescribe: DescribeBase; +    fdescribe: DescribeBase; +    beforeAll: HookBase; +    beforeEach: HookBase; +    afterEach: HookBase; +    afterAll: HookBase; +} +export interface GlobalAdditions extends TestFrameworkGlobals { +    __coverage__: CoverageMapData; +    jasmine: Jasmine; +    fail: () => void; +    pending: () => void; +    spyOn: () => void; +    spyOnProperty: () => void; +} +export interface Global extends GlobalAdditions, Omit<typeof globalThis, keyof GlobalAdditions> { +    [extras: string]: unknown; +} +export {}; diff --git a/node_modules/@jest/types/build/Global.js b/node_modules/@jest/types/build/Global.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/types/build/Global.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/types/build/TestResult.d.ts b/node_modules/@jest/types/build/TestResult.d.ts new file mode 100644 index 0000000..a05dca9 --- /dev/null +++ b/node_modules/@jest/types/build/TestResult.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. + */ +export declare type Milliseconds = number; +declare type Status = 'passed' | 'failed' | 'skipped' | 'pending' | 'todo' | 'disabled'; +declare type Callsite = { +    column: number; +    line: number; +}; +export declare type AssertionResult = { +    ancestorTitles: Array<string>; +    duration?: Milliseconds | null; +    failureDetails: Array<unknown>; +    failureMessages: Array<string>; +    fullName: string; +    invocations?: number; +    location?: Callsite | null; +    numPassingAsserts: number; +    status: Status; +    title: string; +}; +export declare type SerializableError = { +    code?: unknown; +    message: string; +    stack: string | null | undefined; +    type?: string; +}; +export {}; diff --git a/node_modules/@jest/types/build/TestResult.js b/node_modules/@jest/types/build/TestResult.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/types/build/TestResult.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/types/build/Transform.d.ts b/node_modules/@jest/types/build/Transform.d.ts new file mode 100644 index 0000000..69abd92 --- /dev/null +++ b/node_modules/@jest/types/build/Transform.d.ts @@ -0,0 +1,11 @@ +/** + * 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 TransformResult = { +    code: string; +    originalCode: string; +    sourceMapPath: string | null; +}; diff --git a/node_modules/@jest/types/build/Transform.js b/node_modules/@jest/types/build/Transform.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/types/build/Transform.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/types/build/index.d.ts b/node_modules/@jest/types/build/index.d.ts new file mode 100644 index 0000000..be82158 --- /dev/null +++ b/node_modules/@jest/types/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 * as Circus from './Circus'; +import type * as Config from './Config'; +import type * as Global from './Global'; +import type * as TestResult from './TestResult'; +import type * as TransformTypes from './Transform'; +export type { Circus, Config, Global, TestResult, TransformTypes }; diff --git a/node_modules/@jest/types/build/index.js b/node_modules/@jest/types/build/index.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/@jest/types/build/index.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/@jest/types/package.json b/node_modules/@jest/types/package.json new file mode 100644 index 0000000..9f7100a --- /dev/null +++ b/node_modules/@jest/types/package.json @@ -0,0 +1,37 @@ +{ +  "name": "@jest/types", +  "version": "27.5.1", +  "repository": { +    "type": "git", +    "url": "https://github.com/facebook/jest.git", +    "directory": "packages/jest-types" +  }, +  "engines": { +    "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" +  }, +  "license": "MIT", +  "main": "./build/index.js", +  "types": "./build/index.d.ts", +  "exports": { +    ".": { +      "types": "./build/index.d.ts", +      "default": "./build/index.js" +    }, +    "./package.json": "./package.json" +  }, +  "dependencies": { +    "@types/istanbul-lib-coverage": "^2.0.0", +    "@types/istanbul-reports": "^3.0.0", +    "@types/node": "*", +    "@types/yargs": "^16.0.0", +    "chalk": "^4.0.0" +  }, +  "devDependencies": { +    "@tsd/typescript": "~4.1.5", +    "tsd-lite": "^0.5.1" +  }, +  "publishConfig": { +    "access": "public" +  }, +  "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +}  | 
