UNPKG

a11yanalyze

Version:

A command-line tool for developers and QA engineers to test web pages and websites for WCAG 2.2 AA accessibility compliance

210 lines 5.81 kB
/** * Console Reporter for Accessibility Analysis * Provides human-readable console output with progress indicators */ import { ScanResult } from '../types'; import { CrawlSession } from '../types/crawler'; import { ScoreBreakdown, SiteScore } from '../scoring/accessibility-scorer'; import { ErrorLogger } from './error-logger'; /** * Console output configuration */ export interface ConsoleConfig { /** Enable colored output */ colors: boolean; /** Show detailed progress information */ verbose: boolean; /** Show debug information */ debug: boolean; /** Quiet mode (minimal output) */ quiet: boolean; /** Show progress bars */ showProgress: boolean; /** Maximum width for output formatting */ maxWidth: number; /** Show spinner animations */ showSpinner: boolean; } /** * Progress tracking for different phases */ export interface ProgressState { /** Current phase of operation */ phase: 'initializing' | 'crawling' | 'scanning' | 'analyzing' | 'reporting' | 'complete'; /** Current step within phase */ currentStep: number; /** Total steps in current phase */ totalSteps: number; /** Overall progress percentage */ overallProgress: number; /** Current operation description */ currentOperation: string; /** Start time of current phase */ phaseStartTime: Date; } /** * Comprehensive console reporter for accessibility analysis */ export declare class ConsoleReporter { private config; private progressBars; private spinners; private progressState; private multiBar?; private startTime; constructor(config?: Partial<ConsoleConfig>); /** * Initialize the console reporter */ init(): void; /** * Show application header */ showHeader(): void; /** * Initialize multi-progress bar system */ private initializeMultiBar; /** * Update current phase and operation */ updatePhase(phase: ProgressState['phase'], operation: string, totalSteps?: number): void; /** * Show phase header with status */ private showPhaseHeader; /** * Create or update a progress bar */ createProgressBar(id: string, label: string, total: number): void; /** * Update progress bar */ updateProgress(id: string, current: number, operation?: string): void; /** * Complete a progress bar */ completeProgress(id: string, finalMessage?: string): void; /** * Create a spinner for indefinite operations */ createSpinner(id: string, text: string): void; /** * Update spinner text */ updateSpinner(id: string, text: string): void; /** * Complete spinner with success */ succeedSpinner(id: string, text?: string): void; /** * Complete spinner with failure */ failSpinner(id: string, text?: string): void; /** * Log crawling progress */ logCrawlProgress(session: CrawlSession): void; /** * Log scanning progress for a page */ logPageScanStart(url: string, pageNumber: number, totalPages: number): void; /** * Log scanning completion for a page */ logPageScanComplete(url: string, scanResult: ScanResult): void; /** * Display page scan results summary */ showPageResults(scanResult: ScanResult, scoreBreakdown?: ScoreBreakdown): void; /** * Display detailed score breakdown */ private showScoreBreakdown; /** * Display issues summary */ private showIssuesSummary; /** * Display performance metrics */ private showPerformanceMetrics; /** * Display site-wide results summary */ showSiteResults(siteScore: SiteScore, crawlSession: CrawlSession): void; /** * Display score distribution */ private showScoreDistribution; /** * Display consistency metrics */ private showConsistencyMetrics; /** * Display page scores summary */ private showPageScoresSummary; /** * Display final summary */ showFinalSummary(siteScore: SiteScore, crawlSession: CrawlSession): void; /** * Show recommendations based on results */ private showRecommendations; /** * Log errors and warnings */ logWarning(message: string): void; logError(message: string, error?: Error): void; logPass(message: string): void; logInfo(message: string): void; logSummary(summary: string[]): void; /** * Display error summary from error logger */ showErrorSummary(errorLogger: ErrorLogger): void; /** * Display detailed error entries */ showDetailedErrors(errorLogger: ErrorLogger, maxErrors?: number): void; /** * Display technical issues */ showTechnicalIssues(errorLogger: ErrorLogger): void; /** * Display system diagnostics information */ showSystemDiagnostics(errorLogger: ErrorLogger): Promise<void>; /** * Show comprehensive error report */ showErrorReport(errorLogger: ErrorLogger): void; /** * Helper methods for error display */ private getErrorLevelColor; private getErrorCategoryIcon; private getTechnicalIssueSeverityColor; private getTechnicalIssueTypeIcon; /** * Clean up resources */ cleanup(): void; /** * Helper methods */ private getScoreColor; private getSeverityIcon; private getImportanceIcon; private formatDuration; /** * Static factory methods */ static createDefault(): ConsoleReporter; static createVerbose(): ConsoleReporter; static createQuiet(): ConsoleReporter; static createDebug(): ConsoleReporter; } //# sourceMappingURL=console-reporter.d.ts.map