import type { BenchmarkReport, SuiteReport } from '../types.js'; import { Reporter, ReporterInit } from './reporter.js'; import type { Logger, ILogObj } from 'tslog'; /** * Options for configuring the CliReporter. */ export interface CliReporterOptions { /** * The output format for the benchmark report. * The `short` format is better suitable for reporting in a Suite. * The `long` format provides more detailed information. * @default 'short' */ format?: 'short' | 'long'; /** * Thresholds for color-coding the relative margin of error. * @default { yellow: 0.05, red: 0.1 } */ rmeColorThresholds?: ColorThresholds; /** * Thresholds for color-coding the sample standard deviation and margin of error. * @default { yellow: 0.01, red: 0.05 } */ stdDevAndMoeColorThresholds?: ColorThresholds; } export interface ColorThresholds { /** * The threshold for yellow color-coding. * * The default value depends on the context its used. */ yellow: number; /** * The threshold for red color-coding. * * The default value depends on the context its used. */ red: number; } /** * A reporter that prints benchmark results to the console. * It supports two output formats: 'short' and 'long'. */ export declare class CliReporter extends Reporter { protected options: CliReporterOptions; protected decFormat0: Intl.NumberFormat; protected decFormat4: Intl.NumberFormat; protected perFormat: Intl.NumberFormat; /** * Thresholds for color-coding the relative margin of error. * @default { yellow: 0.05, red: 0.1 } */ protected rmeColorThresholds: ColorThresholds; /** * Thresholds for color-coding the sample standard deviation and margin of error. * @default { yellow: 0.01, red: 0.05 } */ protected stdDevAndMoeColorThresholds: ColorThresholds; /** * Logger instance for logging messages. * This is used to log warnings and errors during the benchmark process. */ protected logger: Logger; /** * The padding for the name column in the output. * @default 25 */ protected namePadding: number; /** * A flag indicating whether the reporter has groups. */ protected hasGroups: boolean; constructor(options?: CliReporterOptions, logger?: Logger); initialize(init: ReporterInit): Promise; /** * Creates a formatted name for the benchmark. * * @param name The name of the benchmark. * @param group Optional group name for the benchmark. * @returns The formatted name of the benchmark. */ protected formatName(name: string, group?: string): string; /** * Prints the benchmark report(s) to the console. * @returns A promise that resolves when the report has been printed. * * @example * ```typescript * const cliReporter = new CliReporter({ format: 'long' }); * await cliReporter.run(reports); * ``` */ run(report: BenchmarkReport | SuiteReport): Promise; /** * Prints a short summary of the benchmark report to the console. * @param report - The benchmark report to print. */ protected reportShort(report: BenchmarkReport): void; /** * Prints a detailed table of the benchmark report to the console. * @param report - The benchmark report to print. */ protected reportLong(report: BenchmarkReport): void; /** * Color-codes a string based on a value and thresholds. * @param str - The string to color-code. * @param value - The value to compare against the thresholds. * @param thresholds - The thresholds for color-coding. * @returns The color-coded string. */ protected colorCode(str: string, value: number, thresholds: ColorThresholds): string; /** * Validates the benchmark report data. * @param report - The benchmark report to validate. * @returns True if the report is valid, false otherwise. */ isValidReport(report: BenchmarkReport): boolean; } //# sourceMappingURL=cli_reporter.d.ts.map