Set up comprehensive frontend testing infrastructure

- Install Jest for unit testing with React Testing Library
- Install Playwright for end-to-end testing
- Configure Jest with proper TypeScript support and module mapping
- Create test setup files and utilities for both unit and e2e tests

Components:
* Jest configuration with coverage thresholds
* Playwright configuration with browser automation
* Unit tests for LoginForm, AuthContext, and useSocketIO hook
* E2E tests for authentication, dashboard, and agents workflows
* GitHub Actions workflow for automated testing
* Mock data and API utilities for consistent testing
* Test documentation with best practices

Testing features:
- Unit tests with 70% coverage threshold
- E2E tests with API mocking and user journey testing
- CI/CD integration for automated test runs
- Cross-browser testing support with Playwright
- Authentication system testing end-to-end

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-07-11 14:06:34 +10:00
parent c6d69695a8
commit aacb45156b
6109 changed files with 777927 additions and 1 deletions

22
frontend/node_modules/jest-watcher/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
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.

169
frontend/node_modules/jest-watcher/build/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,169 @@
import Emittery from "emittery";
import { ReadStream, WriteStream } from "tty";
import { Config } from "@jest/types";
import { AggregatedResult } from "@jest/test-result";
//#region src/types.d.ts
type TestSuiteInfo = {
config: Config.ProjectConfig;
duration?: number;
testPath: string;
};
type JestHookExposedFS = {
projects: Array<{
config: Config.ProjectConfig;
testPaths: Array<string>;
}>;
};
type FileChange = (fs: JestHookExposedFS) => void;
type ShouldRunTestSuite = (testSuiteInfo: TestSuiteInfo) => Promise<boolean>;
type TestRunComplete = (results: AggregatedResult) => void;
type JestHookSubscriber = {
onFileChange: (fn: FileChange) => void;
onTestRunComplete: (fn: TestRunComplete) => void;
shouldRunTestSuite: (fn: ShouldRunTestSuite) => void;
};
type JestHookEmitter = {
onFileChange: (fs: JestHookExposedFS) => void;
onTestRunComplete: (results: AggregatedResult) => void;
shouldRunTestSuite: (testSuiteInfo: TestSuiteInfo) => Promise<boolean> | boolean;
};
type UsageData = {
key: string;
prompt: string;
};
type AllowedConfigOptions = Partial<Pick<Config.GlobalConfig, 'bail' | 'changedSince' | 'collectCoverage' | 'collectCoverageFrom' | 'coverageDirectory' | 'coverageReporters' | 'findRelatedTests' | 'nonFlagArgs' | 'notify' | 'notifyMode' | 'onlyFailures' | 'reporters' | 'testNamePattern' | 'updateSnapshot' | 'verbose'> & {
mode: 'watch' | 'watchAll';
testPathPatterns: Array<string>;
}>;
type UpdateConfigCallback = (config?: AllowedConfigOptions) => void;
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>;
}
type WatchPluginClass = new (options: {
config: Record<string, unknown>;
stdin: ReadStream;
stdout: WriteStream;
}) => WatchPlugin;
type ScrollOptions = {
offset: number;
max: number;
};
//#endregion
//#region src/BaseWatchPlugin.d.ts
declare abstract class BaseWatchPlugin implements WatchPlugin {
protected _stdin: ReadStream;
protected _stdout: WriteStream;
constructor({
stdin,
stdout
}: {
stdin: ReadStream;
stdout: WriteStream;
});
apply(_hooks: JestHookSubscriber): void;
getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null;
onKey(_key: string): void;
run(_globalConfig: Config.GlobalConfig, _updateConfigAndRun: UpdateConfigCallback): Promise<void | boolean>;
}
//#endregion
//#region src/JestHooks.d.ts
type AvailableHooks = 'onFileChange' | 'onTestRunComplete' | 'shouldRunTestSuite';
declare class JestHooks {
private readonly _listeners;
private readonly _subscriber;
private readonly _emitter;
constructor();
isUsed(hook: AvailableHooks): boolean;
getSubscriber(): Readonly<JestHookSubscriber>;
getEmitter(): Readonly<JestHookEmitter>;
}
//#endregion
//#region src/lib/Prompt.d.ts
declare class Prompt {
private _entering;
private _value;
private _onChange;
private _onSuccess;
private _onCancel;
private _offset;
private _promptLength;
private _selection;
constructor();
private readonly _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;
}
//#endregion
//#region src/PatternPrompt.d.ts
declare abstract class PatternPrompt {
protected _pipe: NodeJS.WritableStream;
protected _prompt: Prompt;
protected _entityName: string;
protected _currentUsageRows: number;
constructor(_pipe: NodeJS.WritableStream, _prompt: Prompt, _entityName?: string);
run(onSuccess: (value: string) => void, onCancel: () => void, options?: {
header: string;
}): void;
protected _onChange(_pattern: string, _options: ScrollOptions): void;
}
//#endregion
//#region src/TestWatcher.d.ts
type State = {
interrupted: boolean;
};
declare class TestWatcher extends Emittery<{
change: State;
}> {
state: State;
private readonly _isWatchMode;
constructor({
isWatchMode
}: {
isWatchMode: boolean;
});
setState(state: State): Promise<void>;
isInterrupted(): boolean;
isWatchMode(): boolean;
}
//#endregion
//#region src/constants.d.ts
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
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;
};
//#endregion
//#region src/lib/patternModeHelpers.d.ts
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare function printPatternCaret(pattern: string, pipe: NodeJS.WritableStream): void;
declare function printRestoredPatternCaret(pattern: string, currentUsageRows: number, pipe: NodeJS.WritableStream): void;
//#endregion
export { AllowedConfigOptions, BaseWatchPlugin, JestHooks as JestHook, JestHookEmitter, JestHookSubscriber, KEYS, PatternPrompt, Prompt, ScrollOptions, TestWatcher, UpdateConfigCallback, UsageData, WatchPlugin, WatchPluginClass, printPatternCaret, printRestoredPatternCaret };

214
frontend/node_modules/jest-watcher/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,214 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {ReadStream, WriteStream} from 'tty';
import Emittery from 'emittery';
import {AggregatedResult} from '@jest/test-result';
import {Config} from '@jest/types';
export declare type AllowedConfigOptions = Partial<
Pick<
Config.GlobalConfig,
| 'bail'
| 'changedSince'
| 'collectCoverage'
| 'collectCoverageFrom'
| 'coverageDirectory'
| 'coverageReporters'
| 'findRelatedTests'
| 'nonFlagArgs'
| 'notify'
| 'notifyMode'
| 'onlyFailures'
| 'reporters'
| 'testNamePattern'
| 'updateSnapshot'
| 'verbose'
> & {
mode: 'watch' | 'watchAll';
testPathPatterns: Array<string>;
}
>;
declare type AvailableHooks =
| 'onFileChange'
| 'onTestRunComplete'
| 'shouldRunTestSuite';
export declare abstract class BaseWatchPlugin implements WatchPlugin {
protected _stdin: ReadStream;
protected _stdout: WriteStream;
constructor({stdin, stdout}: {stdin: ReadStream; stdout: WriteStream});
apply(_hooks: JestHookSubscriber): void;
getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null;
onKey(_key: string): void;
run(
_globalConfig: Config.GlobalConfig,
_updateConfigAndRun: UpdateConfigCallback,
): Promise<void | boolean>;
}
declare type FileChange = (fs: JestHookExposedFS) => void;
export declare class JestHook {
private readonly _listeners;
private readonly _subscriber;
private readonly _emitter;
constructor();
isUsed(hook: AvailableHooks): boolean;
getSubscriber(): Readonly<JestHookSubscriber>;
getEmitter(): Readonly<JestHookEmitter>;
}
export declare type JestHookEmitter = {
onFileChange: (fs: JestHookExposedFS) => void;
onTestRunComplete: (results: AggregatedResult) => void;
shouldRunTestSuite: (
testSuiteInfo: TestSuiteInfo,
) => Promise<boolean> | boolean;
};
declare type JestHookExposedFS = {
projects: Array<{
config: Config.ProjectConfig;
testPaths: Array<string>;
}>;
};
export declare type JestHookSubscriber = {
onFileChange: (fn: FileChange) => void;
onTestRunComplete: (fn: TestRunComplete) => void;
shouldRunTestSuite: (fn: ShouldRunTestSuite) => void;
};
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;
};
export declare abstract class PatternPrompt {
protected _pipe: NodeJS.WritableStream;
protected _prompt: Prompt;
protected _entityName: string;
protected _currentUsageRows: number;
constructor(
_pipe: NodeJS.WritableStream,
_prompt: Prompt,
_entityName?: string,
);
run(
onSuccess: (value: string) => void,
onCancel: () => void,
options?: {
header: string;
},
): void;
protected _onChange(_pattern: string, _options: ScrollOptions_2): void;
}
export declare function printPatternCaret(
pattern: string,
pipe: NodeJS.WritableStream,
): void;
export declare function printRestoredPatternCaret(
pattern: string,
currentUsageRows: number,
pipe: NodeJS.WritableStream,
): void;
export declare class Prompt {
private _entering;
private _value;
private _onChange;
private _onSuccess;
private _onCancel;
private _offset;
private _promptLength;
private _selection;
constructor();
private readonly _onResize;
enter(
onChange: (pattern: string, options: ScrollOptions_2) => void,
onSuccess: (pattern: string) => void,
onCancel: () => void,
): void;
setPromptLength(length: number): void;
setPromptSelection(selected: string): void;
put(key: string): void;
abort(): void;
isEntering(): boolean;
}
declare type ScrollOptions_2 = {
offset: number;
max: number;
};
export {ScrollOptions_2 as ScrollOptions};
declare type ShouldRunTestSuite = (
testSuiteInfo: TestSuiteInfo,
) => Promise<boolean>;
declare type State = {
interrupted: boolean;
};
declare type TestRunComplete = (results: AggregatedResult) => void;
declare type TestSuiteInfo = {
config: Config.ProjectConfig;
duration?: number;
testPath: string;
};
export declare class TestWatcher extends Emittery<{
change: State;
}> {
state: State;
private readonly _isWatchMode;
constructor({isWatchMode}: {isWatchMode: boolean});
setState(state: State): Promise<void>;
isInterrupted(): boolean;
isWatchMode(): boolean;
}
export declare type UpdateConfigCallback = (
config?: AllowedConfigOptions,
) => void;
export declare type UsageData = {
key: string;
prompt: string;
};
export declare 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 declare type WatchPluginClass = new (options: {
config: Record<string, unknown>;
stdin: ReadStream;
stdout: WriteStream;
}) => WatchPlugin;
export {};

556
frontend/node_modules/jest-watcher/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,556 @@
/*!
* /**
* * Copyright (c) Meta Platforms, Inc. and affiliates.
* *
* * This source code is licensed under the MIT license found in the
* * LICENSE file in the root directory of this source tree.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/BaseWatchPlugin.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class BaseWatchPlugin {
_stdin;
_stdout;
constructor({
stdin,
stdout
}) {
this._stdin = stdin;
this._stdout = stdout;
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
apply(_hooks) {}
getUsageInfo(_globalConfig) {
return null;
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
onKey(_key) {}
run(_globalConfig, _updateConfigAndRun) {
return Promise.resolve();
}
}
var _default = exports["default"] = BaseWatchPlugin;
/***/ }),
/***/ "./src/JestHooks.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class JestHooks {
_listeners;
_subscriber;
_emitter;
constructor() {
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 => {
for (const listener of this._listeners.onFileChange) listener(fs);
},
onTestRunComplete: results => {
for (const listener of this._listeners.onTestRunComplete) listener(results);
},
shouldRunTestSuite: async testSuiteInfo => {
const result = await Promise.all(this._listeners.shouldRunTestSuite.map(listener => listener(testSuiteInfo)));
return result.every(Boolean);
}
};
}
isUsed(hook) {
return this._listeners[hook]?.length > 0;
}
getSubscriber() {
return this._subscriber;
}
getEmitter() {
return this._emitter;
}
}
var _default = exports["default"] = JestHooks;
/***/ }),
/***/ "./src/PatternPrompt.ts":
/***/ ((__unused_webpack_module, exports) => {
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(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
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 {
_currentUsageRows;
constructor(_pipe, _prompt, _entityName = '') {
this._pipe = _pipe;
this._prompt = _prompt;
this._entityName = _entityName;
this._currentUsageRows = usageRows;
}
run(onSuccess, onCancel, options) {
this._pipe.write(_ansiEscapes().default.cursorHide);
this._pipe.write(CLEAR);
if (typeof options?.header === 'string' && 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;
/***/ }),
/***/ "./src/TestWatcher.ts":
/***/ ((__unused_webpack_module, exports) => {
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(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class TestWatcher extends _emittery().default {
state;
_isWatchMode;
constructor({
isWatchMode
}) {
super();
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;
/***/ }),
/***/ "./src/constants.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.KEYS = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* 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 = exports.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'
};
/***/ }),
/***/ "./src/index.ts":
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var _exportNames = {
BaseWatchPlugin: true,
JestHook: true,
PatternPrompt: true,
TestWatcher: 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;
}
}));
Object.defineProperty(exports, "TestWatcher", ({
enumerable: true,
get: function () {
return _TestWatcher.default;
}
}));
var _BaseWatchPlugin = _interopRequireDefault(__webpack_require__("./src/BaseWatchPlugin.ts"));
var _JestHooks = _interopRequireDefault(__webpack_require__("./src/JestHooks.ts"));
var _PatternPrompt = _interopRequireDefault(__webpack_require__("./src/PatternPrompt.ts"));
var _TestWatcher = _interopRequireDefault(__webpack_require__("./src/TestWatcher.ts"));
var _constants = __webpack_require__("./src/constants.ts");
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(__webpack_require__("./src/lib/Prompt.ts"));
var _patternModeHelpers = __webpack_require__("./src/lib/patternModeHelpers.ts");
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(e) { return e && e.__esModule ? e : { default: e }; }
/***/ }),
/***/ "./src/lib/Prompt.ts":
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _constants = __webpack_require__("./src/constants.ts");
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class Prompt {
_entering;
_value;
_onChange;
_onSuccess;
_onCancel;
_offset;
_promptLength;
_selection;
constructor() {
// Copied from `enter` to satisfy TS
this._entering = true;
this._value = '';
this._selection = null;
this._offset = -1;
this._promptLength = 0;
/* eslint-disable @typescript-eslint/no-empty-function */
this._onChange = () => {};
this._onSuccess = () => {};
this._onCancel = () => {};
/* eslint-enable */
}
_onResize = () => {
this._onChange();
};
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;
/***/ }),
/***/ "./src/lib/patternModeHelpers.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.printPatternCaret = printPatternCaret;
exports.printRestoredPatternCaret = printRestoredPatternCaret;
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(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function printPatternCaret(pattern, pipe) {
const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`;
pipe.write(_ansiEscapes().default.eraseDown);
pipe.write(inputText);
pipe.write(_ansiEscapes().default.cursorSavePosition);
}
function 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);
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
/******/ module.exports = __webpack_exports__;
/******/
/******/ })()
;

10
frontend/node_modules/jest-watcher/build/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import cjsModule from './index.js';
export const BaseWatchPlugin = cjsModule.BaseWatchPlugin;
export const JestHook = cjsModule.JestHook;
export const PatternPrompt = cjsModule.PatternPrompt;
export const Prompt = cjsModule.Prompt;
export const TestWatcher = cjsModule.TestWatcher;
export const KEYS = cjsModule.KEYS;
export const printPatternCaret = cjsModule.printPatternCaret;
export const printRestoredPatternCaret = cjsModule.printRestoredPatternCaret;

43
frontend/node_modules/jest-watcher/package.json generated vendored Normal file
View File

@@ -0,0 +1,43 @@
{
"name": "jest-watcher",
"description": "Delightful JavaScript Testing.",
"version": "30.0.4",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@jest/test-result": "30.0.4",
"@jest/types": "30.0.1",
"@types/node": "*",
"ansi-escapes": "^4.3.2",
"chalk": "^4.1.2",
"emittery": "^0.13.1",
"jest-util": "30.0.2",
"string-length": "^4.0.2"
},
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-watcher"
},
"bugs": {
"url": "https://github.com/jestjs/jest/issues"
},
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"homepage": "https://jestjs.io/",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"gitHead": "f4296d2bc85c1405f84ddf613a25d0bc3766b7e5"
}