/** * Hamlet - Multi-framework test converter type definitions */ export type Framework = | 'cypress' | 'playwright' | 'selenium' | 'jest' | 'vitest' | 'mocha' | 'jasmine' | 'webdriverio' | 'puppeteer' | 'testcafe' | 'junit4' | 'junit5' | 'testng' | 'pytest' | 'unittest' | 'nose2'; export interface ConversionOptions { /** Preserve original directory structure */ preserveStructure?: boolean; /** Number of files to process in batch */ batchSize?: number; /** Test type hint (e2e, component, api, etc.) */ testType?: string; /** Custom configuration */ config?: Record; } export interface ConversionResult { /** Converted content */ content: string; /** Source file path */ sourcePath?: string; /** Output file path */ outputPath?: string; /** Warnings generated during conversion */ warnings?: string[]; /** Statistics about the conversion */ stats?: ConversionStats; } export interface FileConversionResult { success: boolean; outputPath: string; metadata?: Record; dependencies?: Record | unknown[]; validationResults?: object | null; visualResults?: object | null; } export interface BatchFileResult { file: string; status: 'success' | 'error' | 'skipped'; outputPath?: string; error?: string; metadata?: Record; dependencies?: Record | unknown[]; } export interface BatchProcessResult { total: number; successful: number; failed: number; results: BatchFileResult[]; } export interface RepositoryConversionReport { summary: { totalFiles: number; convertedFiles: number; failedFiles: number; configurationFiles: number; supportFiles: number; plugins: number; }; testResults: Array>; configResults?: Array>; supportResults?: Array>; pluginResults?: Array>; metadata?: Record; dependencies?: Record; mappings?: Array>; timestamp?: string; duration?: unknown; } export interface ConversionStats { /** Number of conversions performed */ conversions: number; /** Number of patterns matched */ patternsMatched: number; /** Number of warnings generated */ warnings: number; /** Processing time in milliseconds */ processingTime?: number; } export interface ConversionReport { /** Confidence score 0-100 */ confidence: number; /** Confidence level */ level: 'high' | 'medium' | 'low'; /** Number of patterns successfully converted */ converted: number; /** Number of unconvertible patterns */ unconvertible: number; /** Number of patterns converted with warnings */ warnings: number; /** Total number of patterns */ total: number; /** Detailed breakdown of issues */ details: Array<{ type: 'unconvertible' | 'warning'; nodeType: string; line: number | null; source: string; }>; } export interface DetectionResult { /** Detected framework */ framework: Framework | null; /** Confidence score (0-1) */ confidence: number; /** Detection method used */ method: 'filename' | 'content' | 'combined' | 'path'; /** Detailed content analysis */ contentAnalysis?: { scores: Record; details: Record; }; /** Path-based analysis */ pathAnalysis?: { framework: Framework | null; confidence: number; reason: string; }; } export interface PatternDefinition { /** Regex pattern to match */ pattern: string; /** Replacement string or function */ replacement: string | ((match: string, ...groups: string[]) => string); /** Pattern category */ category?: string; /** Priority (higher = applied first) */ priority?: number; } export interface ConverterConfig { /** Source framework */ sourceFramework: Framework; /** Target framework */ targetFramework: Framework; /** Custom patterns to add */ customPatterns?: PatternDefinition[]; /** Patterns to skip */ skipPatterns?: string[]; } /** * Base converter interface */ export interface IConverter { /** Source framework */ readonly sourceFramework: string; /** Target framework */ readonly targetFramework: string; /** Conversion statistics */ readonly stats: ConversionStats; /** * Convert test content from source to target framework * @param content - Source test content * @param options - Conversion options * @returns Converted content */ convert(content: string, options?: ConversionOptions): Promise; /** * Convert configuration file * @param configPath - Path to source config * @param options - Conversion options * @returns Converted config content */ convertConfig(configPath: string, options?: ConversionOptions): Promise; /** * Detect test types from content * @param content - Test content to analyze * @returns Array of detected test types */ detectTestTypes(content: string): string[]; /** * Get required imports for target framework * @param testTypes - Detected test types * @returns Array of import statements */ getImports(testTypes: string[]): string[]; } /** * Converter factory interface */ export interface IConverterFactory { createConverter(from: Framework, to: Framework, options?: ConversionOptions): Promise; isSupported(from: Framework, to: Framework): boolean; getSupportedConversions(): string[]; getFrameworks(): Framework[]; } /** * Framework detector interface */ export interface IFrameworkDetector { detect(content: string, filePath?: string): DetectionResult; detectFromContent(content: string): DetectionResult; detectFromPath(filePath: string): DetectionResult; } /** * Pattern engine interface */ export interface IPatternEngine { registerPatterns(category: string, patterns: Record): void; applyPatterns(content: string, categories?: string[]): string; getCategories(): string[]; clear(): void; } // ── Classes exported from main entry (hamlet-converter) ── export class RepositoryConverter { constructor(); } export class BatchProcessor { constructor(); } export class ConversionReporter { constructor(options?: { format?: string }); generateReport(data?: object, outputPath?: string): Promise; } /** Convert a single file */ export function convertFile( inputPath: string, outputPath: string, options?: ConversionOptions & { from?: Framework; to?: Framework } ): Promise; /** Convert a repository */ export function convertRepository( repoUrl: string, outputPath: string, options?: ConversionOptions & { from?: Framework; to?: Framework } ): Promise; /** Process test files in batch */ export function processTestFiles( files: string[], options?: ConversionOptions & { from?: Framework; to?: Framework } ): Promise; /** Validate converted tests */ export function validateTests( testDir: string, options?: object ): Promise; /** Generate conversion report */ export function generateReport( outputPath: string, format?: string, data?: object ): Promise; /** Convert Cypress test to Playwright */ export function convertCypressToPlaywright( content: string, options?: ConversionOptions ): Promise; /** Convert framework configuration file */ export function convertConfig( configPath: string, options?: ConversionOptions & { from?: Framework; to?: Framework } ): Promise; // ── Constants ── export const VERSION: string; export const SUPPORTED_TEST_TYPES: string[]; export const DEFAULT_OPTIONS: { typescript: boolean; validate: boolean; compareVisuals: boolean; convertPlugins: boolean; preserveStructure: boolean; report: string; batchSize: number; timeout: number; };