 aacb45156b
			
		
	
	aacb45156b
	
	
	
		
			
			- 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>
		
			
				
	
	
		
			105 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			105 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { Console } from "console";
 | |
| import { InspectOptions } from "util";
 | |
| import { StackTraceConfig } from "jest-message-util";
 | |
| import { WriteStream } from "tty";
 | |
| import { Config } from "@jest/types";
 | |
| 
 | |
| //#region src/types.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.
 | |
|  */
 | |
| type LogMessage = string;
 | |
| type LogEntry = {
 | |
|   message: LogMessage;
 | |
|   origin: string;
 | |
|   type: LogType;
 | |
| };
 | |
| type LogType = 'assert' | 'count' | 'debug' | 'dir' | 'dirxml' | 'error' | 'group' | 'groupCollapsed' | 'info' | 'log' | 'time' | 'warn';
 | |
| type ConsoleBuffer = Array<LogEntry>;
 | |
| //#endregion
 | |
| //#region src/BufferedConsole.d.ts
 | |
| declare class BufferedConsole extends Console {
 | |
|   private readonly _buffer;
 | |
|   private _counters;
 | |
|   private _timers;
 | |
|   private _groupDepth;
 | |
|   Console: typeof Console;
 | |
|   constructor();
 | |
|   static write(this: void, buffer: ConsoleBuffer, type: LogType, message: LogMessage, stackLevel?: number): 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;
 | |
| }
 | |
| //#endregion
 | |
| //#region src/CustomConsole.d.ts
 | |
| type Formatter = (type: LogType, message: LogMessage) => string;
 | |
| declare class CustomConsole extends Console {
 | |
|   private readonly _stdout;
 | |
|   private readonly _stderr;
 | |
|   private readonly _formatBuffer;
 | |
|   private _counters;
 | |
|   private _timers;
 | |
|   private _groupDepth;
 | |
|   Console: typeof Console;
 | |
|   constructor(stdout: WriteStream, stderr: 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;
 | |
| }
 | |
| //#endregion
 | |
| //#region src/NullConsole.d.ts
 | |
| declare 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;
 | |
| }
 | |
| //#endregion
 | |
| //#region src/getConsoleOutput.d.ts
 | |
| declare function getConsoleOutput(buffer: ConsoleBuffer, config: StackTraceConfig, globalConfig: Config.GlobalConfig): string;
 | |
| //#endregion
 | |
| export { BufferedConsole, ConsoleBuffer, CustomConsole, LogEntry, LogMessage, LogType, NullConsole, getConsoleOutput }; |