import type { BenchmarkReport, SuiteReport } from '../types.js'; import { Reporter, type ReporterInit } from './reporter.js'; import type { Logger, ILogObj } from 'tslog'; export interface BrowserReporterOptions { /** * The output format for the benchmark report. * - `short`: one-line summary per benchmark, suitable for suite output. * - `long`: expanded `console.table` view with all metrics. * @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; } /** * Thresholds that determine when a metric value transitions from green → yellow → red * in the browser console output. Values are compared as absolute numbers (not percentages). * * @example * // RME of 0.03 is green, 0.07 is yellow, 0.12 is red with the defaults below: * { yellow: 0.05, red: 0.1 } */ export interface ColorThresholds { /** Value at or below this is green; above this (but not above `red`) is yellow. */ yellow: number; /** Value above this is red. */ red: number; } /** * A reporter that prints benchmark results to the browser console. * Uses CSS-styled `console.log` for short output and `console.group` + `console.table` * for the long format. Has no Node.js dependencies. */ export declare class BrowserReporter extends Reporter { protected options: BrowserReporterOptions; protected decFormat0: Intl.NumberFormat; protected decFormat4: Intl.NumberFormat; protected perFormat: Intl.NumberFormat; protected rmeColorThresholds: ColorThresholds; protected stdDevAndMoeColorThresholds: ColorThresholds; protected namePadding: number; protected logger: Logger; constructor(options?: BrowserReporterOptions, logger?: Logger); initialize(init: ReporterInit): Promise; run(report: BenchmarkReport | SuiteReport): Promise; protected formatName(name: string, group?: string): string; protected cssForValue(value: number, thresholds: ColorThresholds): string; /** * Prints a single-line summary using CSS-styled browser console output. * Example: ` My Benchmark: 1,234,567 ops/sec ± 2.3% (100 run(s) sampled)` */ protected reportShort(report: BenchmarkReport): void; /** * Prints an expanded view using `console.group` and `console.table`. */ protected reportLong(report: BenchmarkReport): void; /** * Validates a benchmark report before rendering it. * Logs a `console.error` message describing each violation when the report is invalid. * * @param report - The report to validate. * @returns `true` if the report is valid, `false` otherwise. */ isValidReport(report: BenchmarkReport): boolean; } //# sourceMappingURL=browser_reporter.d.ts.map