diff options
author | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
---|---|---|
committer | Joel Kronqvist <joel.h.kronqvist@gmail.com> | 2022-03-05 19:02:27 +0200 |
commit | 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 (patch) | |
tree | 360f7eb50f956e2367ef38fa1fc6ac7ac5258042 /node_modules/jest-watcher | |
parent | b500a50f1b97d93c98b36ed9a980f8188d648147 (diff) | |
download | LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.tar.gz LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.zip |
Added node_modules for the updating to work properly.
Diffstat (limited to 'node_modules/jest-watcher')
24 files changed, 1006 insertions, 0 deletions
diff --git a/node_modules/jest-watcher/LICENSE b/node_modules/jest-watcher/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/jest-watcher/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-watcher/build/BaseWatchPlugin.d.ts b/node_modules/jest-watcher/build/BaseWatchPlugin.d.ts new file mode 100644 index 0000000..20aec7c --- /dev/null +++ b/node_modules/jest-watcher/build/BaseWatchPlugin.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. + */ +/// <reference types="node" /> +import type { Config } from '@jest/types'; +import type { JestHookSubscriber, UpdateConfigCallback, UsageData, WatchPlugin } from './types'; +declare abstract class BaseWatchPlugin implements WatchPlugin { + protected _stdin: NodeJS.ReadStream; + protected _stdout: NodeJS.WriteStream; + constructor({ stdin, stdout, }: { + stdin: NodeJS.ReadStream; + stdout: NodeJS.WriteStream; + }); + apply(_hooks: JestHookSubscriber): void; + getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null; + onKey(_key: string): void; + run(_globalConfig: Config.GlobalConfig, _updateConfigAndRun: UpdateConfigCallback): Promise<void | boolean>; +} +export default BaseWatchPlugin; diff --git a/node_modules/jest-watcher/build/BaseWatchPlugin.js b/node_modules/jest-watcher/build/BaseWatchPlugin.js new file mode 100644 index 0000000..40b368c --- /dev/null +++ b/node_modules/jest-watcher/build/BaseWatchPlugin.js @@ -0,0 +1,52 @@ +'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 BaseWatchPlugin { + constructor({stdin, stdout}) { + _defineProperty(this, '_stdin', void 0); + + _defineProperty(this, '_stdout', void 0); + + this._stdin = stdin; + this._stdout = stdout; + } + + apply(_hooks) {} + + getUsageInfo(_globalConfig) { + return null; + } + + onKey(_key) {} + + run(_globalConfig, _updateConfigAndRun) { + return Promise.resolve(); + } +} + +var _default = BaseWatchPlugin; +exports.default = _default; diff --git a/node_modules/jest-watcher/build/JestHooks.d.ts b/node_modules/jest-watcher/build/JestHooks.d.ts new file mode 100644 index 0000000..047d6a7 --- /dev/null +++ b/node_modules/jest-watcher/build/JestHooks.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 { JestHookEmitter, JestHookSubscriber } from './types'; +declare type AvailableHooks = 'onFileChange' | 'onTestRunComplete' | 'shouldRunTestSuite'; +declare class JestHooks { + private _listeners; + private _subscriber; + private _emitter; + constructor(); + isUsed(hook: AvailableHooks): boolean; + getSubscriber(): Readonly<JestHookSubscriber>; + getEmitter(): Readonly<JestHookEmitter>; +} +export default JestHooks; diff --git a/node_modules/jest-watcher/build/JestHooks.js b/node_modules/jest-watcher/build/JestHooks.js new file mode 100644 index 0000000..d2fd5b9 --- /dev/null +++ b/node_modules/jest-watcher/build/JestHooks.js @@ -0,0 +1,91 @@ +'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 JestHooks { + constructor() { + _defineProperty(this, '_listeners', void 0); + + _defineProperty(this, '_subscriber', void 0); + + _defineProperty(this, '_emitter', void 0); + + this._listeners = { + onFileChange: [], + onTestRunComplete: [], + shouldRunTestSuite: [] + }; + this._subscriber = { + onFileChange: fn => { + this._listeners.onFileChange.push(fn); + }, + onTestRunComplete: fn => { + this._listeners.onTestRunComplete.push(fn); + }, + shouldRunTestSuite: fn => { + this._listeners.shouldRunTestSuite.push(fn); + } + }; + this._emitter = { + onFileChange: fs => + this._listeners.onFileChange.forEach(listener => listener(fs)), + onTestRunComplete: results => + this._listeners.onTestRunComplete.forEach(listener => + listener(results) + ), + shouldRunTestSuite: async testSuiteInfo => { + const result = await Promise.all( + this._listeners.shouldRunTestSuite.map(listener => + listener(testSuiteInfo) + ) + ); + return result.every(Boolean); + } + }; + } + + isUsed(hook) { + var _this$_listeners$hook; + + return ( + ((_this$_listeners$hook = this._listeners[hook]) === null || + _this$_listeners$hook === void 0 + ? void 0 + : _this$_listeners$hook.length) > 0 + ); + } + + getSubscriber() { + return this._subscriber; + } + + getEmitter() { + return this._emitter; + } +} + +var _default = JestHooks; +exports.default = _default; diff --git a/node_modules/jest-watcher/build/PatternPrompt.d.ts b/node_modules/jest-watcher/build/PatternPrompt.d.ts new file mode 100644 index 0000000..993bc9d --- /dev/null +++ b/node_modules/jest-watcher/build/PatternPrompt.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. + */ +/// <reference types="node" /> +import type Prompt from './lib/Prompt'; +import type { ScrollOptions } from './types'; +export default class PatternPrompt { + protected _pipe: NodeJS.WritableStream; + protected _prompt: Prompt; + protected _entityName: string; + protected _currentUsageRows: number; + constructor(pipe: NodeJS.WritableStream, prompt: Prompt); + run(onSuccess: (value: string) => void, onCancel: () => void, options?: { + header: string; + }): void; + protected _onChange(_pattern: string, _options: ScrollOptions): void; +} diff --git a/node_modules/jest-watcher/build/PatternPrompt.js b/node_modules/jest-watcher/build/PatternPrompt.js new file mode 100644 index 0000000..ecd640d --- /dev/null +++ b/node_modules/jest-watcher/build/PatternPrompt.js @@ -0,0 +1,113 @@ +'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 _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 {CLEAR} = _jestUtil().specialChars; + +const usage = entity => + `\n${_chalk().default.bold('Pattern Mode Usage')}\n` + + ` ${_chalk().default.dim('\u203A Press')} Esc ${_chalk().default.dim( + 'to exit pattern mode.' + )}\n` + + ` ${_chalk().default.dim('\u203A Press')} Enter ` + + `${_chalk().default.dim(`to filter by a ${entity} regex pattern.`)}\n` + + '\n'; + +const usageRows = usage('').split('\n').length; + +class PatternPrompt { + constructor(pipe, prompt) { + _defineProperty(this, '_pipe', void 0); + + _defineProperty(this, '_prompt', void 0); + + _defineProperty(this, '_entityName', void 0); + + _defineProperty(this, '_currentUsageRows', void 0); + + // TODO: Should come in the constructor + this._entityName = ''; + this._pipe = pipe; + this._prompt = prompt; + this._currentUsageRows = usageRows; + } + + run(onSuccess, onCancel, options) { + this._pipe.write(_ansiEscapes().default.cursorHide); + + this._pipe.write(CLEAR); + + if (options && options.header) { + this._pipe.write(options.header + '\n'); + + this._currentUsageRows = usageRows + options.header.split('\n').length; + } else { + this._currentUsageRows = usageRows; + } + + this._pipe.write(usage(this._entityName)); + + this._pipe.write(_ansiEscapes().default.cursorShow); + + this._prompt.enter(this._onChange.bind(this), onSuccess, onCancel); + } + + _onChange(_pattern, _options) { + this._pipe.write(_ansiEscapes().default.eraseLine); + + this._pipe.write(_ansiEscapes().default.cursorLeft); + } +} + +exports.default = PatternPrompt; diff --git a/node_modules/jest-watcher/build/constants.d.ts b/node_modules/jest-watcher/build/constants.d.ts new file mode 100644 index 0000000..1756e32 --- /dev/null +++ b/node_modules/jest-watcher/build/constants.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. + */ +export declare const KEYS: { + ARROW_DOWN: string; + ARROW_LEFT: string; + ARROW_RIGHT: string; + ARROW_UP: string; + BACKSPACE: string; + CONTROL_C: string; + CONTROL_D: string; + CONTROL_U: string; + ENTER: string; + ESCAPE: string; +}; diff --git a/node_modules/jest-watcher/build/constants.js b/node_modules/jest-watcher/build/constants.js new file mode 100644 index 0000000..78cc215 --- /dev/null +++ b/node_modules/jest-watcher/build/constants.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.KEYS = 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 isWindows = process.platform === 'win32'; +const KEYS = { + ARROW_DOWN: '\u001b[B', + ARROW_LEFT: '\u001b[D', + ARROW_RIGHT: '\u001b[C', + ARROW_UP: '\u001b[A', + BACKSPACE: Buffer.from(isWindows ? '08' : '7f', 'hex').toString(), + CONTROL_C: '\u0003', + CONTROL_D: '\u0004', + CONTROL_U: '\u0015', + ENTER: '\r', + ESCAPE: '\u001b' +}; +exports.KEYS = KEYS; diff --git a/node_modules/jest-watcher/build/index.d.ts b/node_modules/jest-watcher/build/index.d.ts new file mode 100644 index 0000000..433a369 --- /dev/null +++ b/node_modules/jest-watcher/build/index.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. + */ +export { default as BaseWatchPlugin } from './BaseWatchPlugin'; +export { default as JestHook } from './JestHooks'; +export { default as PatternPrompt } from './PatternPrompt'; +export * from './constants'; +export type { AllowedConfigOptions, JestHookEmitter, JestHookSubscriber, ScrollOptions, UpdateConfigCallback, UsageData, WatchPlugin, WatchPluginClass, } from './types'; +export { default as Prompt } from './lib/Prompt'; +export * from './lib/patternModeHelpers'; diff --git a/node_modules/jest-watcher/build/index.js b/node_modules/jest-watcher/build/index.js new file mode 100644 index 0000000..d79b526 --- /dev/null +++ b/node_modules/jest-watcher/build/index.js @@ -0,0 +1,75 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +var _exportNames = { + BaseWatchPlugin: true, + JestHook: true, + PatternPrompt: true, + Prompt: true +}; +Object.defineProperty(exports, 'BaseWatchPlugin', { + enumerable: true, + get: function () { + return _BaseWatchPlugin.default; + } +}); +Object.defineProperty(exports, 'JestHook', { + enumerable: true, + get: function () { + return _JestHooks.default; + } +}); +Object.defineProperty(exports, 'PatternPrompt', { + enumerable: true, + get: function () { + return _PatternPrompt.default; + } +}); +Object.defineProperty(exports, 'Prompt', { + enumerable: true, + get: function () { + return _Prompt.default; + } +}); + +var _BaseWatchPlugin = _interopRequireDefault(require('./BaseWatchPlugin')); + +var _JestHooks = _interopRequireDefault(require('./JestHooks')); + +var _PatternPrompt = _interopRequireDefault(require('./PatternPrompt')); + +var _constants = require('./constants'); + +Object.keys(_constants).forEach(function (key) { + if (key === 'default' || key === '__esModule') return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _constants[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _constants[key]; + } + }); +}); + +var _Prompt = _interopRequireDefault(require('./lib/Prompt')); + +var _patternModeHelpers = require('./lib/patternModeHelpers'); + +Object.keys(_patternModeHelpers).forEach(function (key) { + if (key === 'default' || key === '__esModule') return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + if (key in exports && exports[key] === _patternModeHelpers[key]) return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function () { + return _patternModeHelpers[key]; + } + }); +}); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/jest-watcher/build/lib/Prompt.d.ts b/node_modules/jest-watcher/build/lib/Prompt.d.ts new file mode 100644 index 0000000..563b9f1 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/Prompt.d.ts @@ -0,0 +1,25 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import type { ScrollOptions } from '../types'; +export default class Prompt { + private _entering; + private _value; + private _onChange; + private _onSuccess; + private _onCancel; + private _offset; + private _promptLength; + private _selection; + constructor(); + private _onResize; + enter(onChange: (pattern: string, options: ScrollOptions) => void, onSuccess: (pattern: string) => void, onCancel: () => void): void; + setPromptLength(length: number): void; + setPromptSelection(selected: string): void; + put(key: string): void; + abort(): void; + isEntering(): boolean; +} diff --git a/node_modules/jest-watcher/build/lib/Prompt.js b/node_modules/jest-watcher/build/lib/Prompt.js new file mode 100644 index 0000000..1adf550 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/Prompt.js @@ -0,0 +1,158 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +var _constants = require('../constants'); + +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 Prompt { + constructor() { + _defineProperty(this, '_entering', void 0); + + _defineProperty(this, '_value', void 0); + + _defineProperty(this, '_onChange', void 0); + + _defineProperty(this, '_onSuccess', void 0); + + _defineProperty(this, '_onCancel', void 0); + + _defineProperty(this, '_offset', void 0); + + _defineProperty(this, '_promptLength', void 0); + + _defineProperty(this, '_selection', void 0); + + _defineProperty(this, '_onResize', () => { + this._onChange(); + }); + + // Copied from `enter` to satisfy TS + this._entering = true; + this._value = ''; + this._selection = null; + this._offset = -1; + this._promptLength = 0; + + this._onChange = () => {}; + + this._onSuccess = () => {}; + + this._onCancel = () => {}; + } + + enter(onChange, onSuccess, onCancel) { + this._entering = true; + this._value = ''; + this._onSuccess = onSuccess; + this._onCancel = onCancel; + this._selection = null; + this._offset = -1; + this._promptLength = 0; + + this._onChange = () => + onChange(this._value, { + max: 10, + offset: this._offset + }); + + this._onChange(); + + process.stdout.on('resize', this._onResize); + } + + setPromptLength(length) { + this._promptLength = length; + } + + setPromptSelection(selected) { + this._selection = selected; + } + + put(key) { + switch (key) { + case _constants.KEYS.ENTER: + this._entering = false; + + this._onSuccess(this._selection || this._value); + + this.abort(); + break; + + case _constants.KEYS.ESCAPE: + this._entering = false; + + this._onCancel(this._value); + + this.abort(); + break; + + case _constants.KEYS.ARROW_DOWN: + this._offset = Math.min(this._offset + 1, this._promptLength - 1); + + this._onChange(); + + break; + + case _constants.KEYS.ARROW_UP: + this._offset = Math.max(this._offset - 1, -1); + + this._onChange(); + + break; + + case _constants.KEYS.ARROW_LEFT: + case _constants.KEYS.ARROW_RIGHT: + break; + + case _constants.KEYS.CONTROL_U: + this._value = ''; + this._offset = -1; + this._selection = null; + + this._onChange(); + + break; + + default: + this._value = + key === _constants.KEYS.BACKSPACE + ? this._value.slice(0, -1) + : this._value + key; + this._offset = -1; + this._selection = null; + + this._onChange(); + + break; + } + } + + abort() { + this._entering = false; + this._value = ''; + process.stdout.removeListener('resize', this._onResize); + } + + isEntering() { + return this._entering; + } +} + +exports.default = Prompt; diff --git a/node_modules/jest-watcher/build/lib/colorize.d.ts b/node_modules/jest-watcher/build/lib/colorize.d.ts new file mode 100644 index 0000000..9825297 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/colorize.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 colorize(str: string, start: number, end: number): string; diff --git a/node_modules/jest-watcher/build/lib/colorize.js b/node_modules/jest-watcher/build/lib/colorize.js new file mode 100644 index 0000000..456f220 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/colorize.js @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = colorize; + +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 colorize(str, start, end) { + return ( + _chalk().default.dim(str.slice(0, start)) + + _chalk().default.reset(str.slice(start, end)) + + _chalk().default.dim(str.slice(end)) + ); +} diff --git a/node_modules/jest-watcher/build/lib/formatTestNameByPattern.d.ts b/node_modules/jest-watcher/build/lib/formatTestNameByPattern.d.ts new file mode 100644 index 0000000..7ccb579 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/formatTestNameByPattern.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 formatTestNameByPattern(testName: string, pattern: string, width: number): string; diff --git a/node_modules/jest-watcher/build/lib/formatTestNameByPattern.js b/node_modules/jest-watcher/build/lib/formatTestNameByPattern.js new file mode 100644 index 0000000..7137225 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/formatTestNameByPattern.js @@ -0,0 +1,81 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = formatTestNameByPattern; + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +var _colorize = _interopRequireDefault(require('./colorize')); + +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 DOTS = '...'; +const ENTER = '⏎'; + +function formatTestNameByPattern(testName, pattern, width) { + const inlineTestName = testName.replace(/(\r\n|\n|\r)/gm, ENTER); + let regexp; + + try { + regexp = new RegExp(pattern, 'i'); + } catch { + return _chalk().default.dim(inlineTestName); + } + + const match = inlineTestName.match(regexp); + + if (!match) { + return _chalk().default.dim(inlineTestName); + } + + const startPatternIndex = Math.max(match.index || 0, 0); + const endPatternIndex = startPatternIndex + match[0].length; + + if (inlineTestName.length <= width) { + return (0, _colorize.default)( + inlineTestName, + startPatternIndex, + endPatternIndex + ); + } + + const slicedTestName = inlineTestName.slice(0, width - DOTS.length); + + if (startPatternIndex < slicedTestName.length) { + if (endPatternIndex > slicedTestName.length) { + return (0, _colorize.default)( + slicedTestName + DOTS, + startPatternIndex, + slicedTestName.length + DOTS.length + ); + } else { + return (0, _colorize.default)( + slicedTestName + DOTS, + Math.min(startPatternIndex, slicedTestName.length), + endPatternIndex + ); + } + } + + return `${_chalk().default.dim(slicedTestName)}${_chalk().default.reset( + DOTS + )}`; +} diff --git a/node_modules/jest-watcher/build/lib/patternModeHelpers.d.ts b/node_modules/jest-watcher/build/lib/patternModeHelpers.d.ts new file mode 100644 index 0000000..99487c2 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/patternModeHelpers.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" /> +export declare const printPatternCaret: (pattern: string, pipe: NodeJS.WritableStream) => void; +export declare const printRestoredPatternCaret: (pattern: string, currentUsageRows: number, pipe: NodeJS.WritableStream) => void; diff --git a/node_modules/jest-watcher/build/lib/patternModeHelpers.js b/node_modules/jest-watcher/build/lib/patternModeHelpers.js new file mode 100644 index 0000000..6e652e6 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/patternModeHelpers.js @@ -0,0 +1,68 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.printRestoredPatternCaret = exports.printPatternCaret = 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 _stringLength() { + const data = _interopRequireDefault(require('string-length')); + + _stringLength = 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 printPatternCaret = (pattern, pipe) => { + const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`; + pipe.write(_ansiEscapes().default.eraseDown); + pipe.write(inputText); + pipe.write(_ansiEscapes().default.cursorSavePosition); +}; + +exports.printPatternCaret = printPatternCaret; + +const printRestoredPatternCaret = (pattern, currentUsageRows, pipe) => { + const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`; + pipe.write( + _ansiEscapes().default.cursorTo( + (0, _stringLength().default)(inputText), + currentUsageRows - 1 + ) + ); + pipe.write(_ansiEscapes().default.cursorRestorePosition); +}; + +exports.printRestoredPatternCaret = printRestoredPatternCaret; diff --git a/node_modules/jest-watcher/build/lib/scroll.d.ts b/node_modules/jest-watcher/build/lib/scroll.d.ts new file mode 100644 index 0000000..536c3b7 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/scroll.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 { ScrollOptions } from '../types'; +export default function scroll(size: number, { offset, max }: ScrollOptions): { + end: number; + index: number; + start: number; +}; diff --git a/node_modules/jest-watcher/build/lib/scroll.js b/node_modules/jest-watcher/build/lib/scroll.js new file mode 100644 index 0000000..4a54504 --- /dev/null +++ b/node_modules/jest-watcher/build/lib/scroll.js @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = scroll; + +/** + * 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 scroll(size, {offset, max}) { + let start = 0; + let index = Math.min(offset, size); + const halfScreen = max / 2; + + if (index <= halfScreen) { + start = 0; + } else { + if (size >= max) { + start = Math.min(index - halfScreen - 1, size - max); + } + + index = Math.min(index - start, size); + } + + return { + end: Math.min(size, start + max), + index, + start + }; +} diff --git a/node_modules/jest-watcher/build/types.d.ts b/node_modules/jest-watcher/build/types.d.ts new file mode 100644 index 0000000..310b112 --- /dev/null +++ b/node_modules/jest-watcher/build/types.d.ts @@ -0,0 +1,60 @@ +/** + * 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 } from '@jest/test-result'; +import type { Config } from '@jest/types'; +declare type TestSuiteInfo = { + config: Config.ProjectConfig; + duration?: number; + testPath: string; +}; +export declare type JestHookExposedFS = { + projects: Array<{ + config: Config.ProjectConfig; + testPaths: Array<Config.Path>; + }>; +}; +export declare type FileChange = (fs: JestHookExposedFS) => void; +export declare type ShouldRunTestSuite = (testSuiteInfo: TestSuiteInfo) => Promise<boolean>; +export declare type TestRunComplete = (results: AggregatedResult) => void; +export declare type JestHookSubscriber = { + onFileChange: (fn: FileChange) => void; + onTestRunComplete: (fn: TestRunComplete) => void; + shouldRunTestSuite: (fn: ShouldRunTestSuite) => void; +}; +export declare type JestHookEmitter = { + onFileChange: (fs: JestHookExposedFS) => void; + onTestRunComplete: (results: AggregatedResult) => void; + shouldRunTestSuite: (testSuiteInfo: TestSuiteInfo) => Promise<boolean> | boolean; +}; +export declare type UsageData = { + key: string; + prompt: string; +}; +export declare type AllowedConfigOptions = Partial<Pick<Config.GlobalConfig, 'bail' | 'changedSince' | 'collectCoverage' | 'collectCoverageFrom' | 'collectCoverageOnlyFrom' | 'coverageDirectory' | 'coverageReporters' | 'findRelatedTests' | 'nonFlagArgs' | 'notify' | 'notifyMode' | 'onlyFailures' | 'reporters' | 'testNamePattern' | 'testPathPattern' | 'updateSnapshot' | 'verbose'> & { + mode: 'watch' | 'watchAll'; +}>; +export declare type UpdateConfigCallback = (config?: AllowedConfigOptions) => void; +export interface WatchPlugin { + isInternal?: boolean; + apply?: (hooks: JestHookSubscriber) => void; + getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null; + onKey?: (value: string) => void; + run?: (globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback) => Promise<void | boolean>; +} +export interface WatchPluginClass { + new (options: { + config: Record<string, unknown>; + stdin: NodeJS.ReadStream; + stdout: NodeJS.WriteStream; + }): WatchPlugin; +} +export declare type ScrollOptions = { + offset: number; + max: number; +}; +export {}; diff --git a/node_modules/jest-watcher/build/types.js b/node_modules/jest-watcher/build/types.js new file mode 100644 index 0000000..ad9a93a --- /dev/null +++ b/node_modules/jest-watcher/build/types.js @@ -0,0 +1 @@ +'use strict'; diff --git a/node_modules/jest-watcher/package.json b/node_modules/jest-watcher/package.json new file mode 100644 index 0000000..520c493 --- /dev/null +++ b/node_modules/jest-watcher/package.json @@ -0,0 +1,40 @@ +{ + "name": "jest-watcher", + "description": "Delightful JavaScript Testing.", + "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": { + "@jest/test-result": "^27.5.1", + "@jest/types": "^27.5.1", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "jest-util": "^27.5.1", + "string-length": "^4.0.1" + }, + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest", + "directory": "packages/jest-watcher" + }, + "bugs": { + "url": "https://github.com/facebook/jest/issues" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "homepage": "https://jestjs.io/", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} |