import { RunOutcome, ComparisonConfig, ViewportMap, TestResult } from '@visnap/protocol'; /** * @fileoverview Type definitions for Visnap reporter package * * Provides type definitions for reporter options, report data structures, * and serialized report formats used across different reporter implementations. */ /** * Base options interface for all reporters * @property outputPath - Path where the report file should be written * @property screenshotDir - Directory containing screenshot files */ interface ReporterOptions { outputPath?: string; screenshotDir: string; } interface JsonReporterOptions extends ReporterOptions { pretty?: boolean; } interface HtmlReporterOptions extends ReporterOptions { title?: string; } interface ReportData { success: boolean; outcome: RunOutcome; failures: Array<{ id: string; reason: string; diffPercentage?: number; }>; captureFailures: Array<{ id: string; error: string; }>; timestamp: string; config?: { screenshotDir?: string; comparison?: ComparisonConfig; adapters?: Record; runtime?: Record; viewport?: ViewportMap; }; } /** * @fileoverview JSON reporter implementation for Visnap visual testing framework * * Generates JSON reports from test results with comprehensive test case details * and outcome statistics. */ /** * JSON reporter for generating test result reports in JSON format * * @example * ```typescript * const reporter = new JsonReporter(); * const reportPath = await reporter.generate(testResult, { * outputPath: "./reports/test-results.json", * screenshotDir: "./screenshots" * }); * ``` */ declare class JsonReporter { /** * Generates a JSON report from test results * @param result - Test result data to include in the report * @param options - Reporter options including output path and screenshot directory * @returns Promise resolving to the absolute path of the generated report * @throws {Error} If file writing fails */ generate(result: TestResult, options: JsonReporterOptions): Promise; } /** * @fileoverview HTML reporter implementation for Visnap visual testing framework * * Generates interactive HTML reports from test results with visual diff comparison, * test case filtering, and comprehensive statistics. */ /** * HTML reporter for generating interactive test result reports * * @example * ```typescript * const reporter = new HtmlReporter(); * const reportPath = await reporter.generate(testResult, { * outputPath: "./reports/test-results.html", * screenshotDir: "./screenshots" * }); * ``` */ declare class HtmlReporter { /** * Generates an HTML report from test results * @param result - Test result data to include in the report * @param options - Reporter options including output path and screenshot directory * @returns Promise resolving to the absolute path of the generated report * @throws {Error} If file writing fails */ generate(result: TestResult, options: HtmlReporterOptions): Promise; } export { HtmlReporter, type HtmlReporterOptions, JsonReporter, type JsonReporterOptions, type ReportData, type ReporterOptions };