import * as Benchmark from 'benchmark'; import { Executor } from '../executors/Executor'; import Reporter, { ReporterProperties } from './Reporter'; import Test from '../Test'; import Suite from '../Suite'; export default class BenchmarkReporter extends Reporter implements BenchmarkReporterProperties { baseline: BenchmarkBaseline; filename: string; mode: BenchmarkMode; sessions: { [sessionId: string]: SessionInfo; }; thresholds: BenchmarkThresholds; constructor(executor: Executor, options?: BenchmarkReporterOptions); _getSession(testOrSuite: Test | Suite): SessionInfo; runEnd(): void; suiteEnd(suite: Suite): void; suiteStart(suite: Suite): void; testEnd(test: Test): void; } export interface BenchmarkData { times: Benchmark.Times; hz: number; stats: { rme: number; moe: number; mean: number; }; } export interface BenchmarkThresholds { warn?: { rme?: number; hz?: number; mean?: number; }; fail?: { rme?: number; hz?: number; mean?: number; }; } export interface BaselineEnvironment { client: string; version: string; platform: string; tests: { [testId: string]: BenchmarkData; }; } export interface BenchmarkBaseline { [key: string]: BaselineEnvironment; } export interface SesssionEnvironment { client: string; version: string; platform: string; id: string; } export interface SessionInfo { suites: { [suiteId: string]: { numBenchmarks: number; numFailedBenchmarks: number; }; }; environment: SesssionEnvironment; } export declare type BenchmarkMode = 'baseline' | 'test'; export interface BenchmarkReporterProperties extends ReporterProperties { filename: string; mode: BenchmarkMode; thresholds: BenchmarkThresholds; } export declare type BenchmarkReporterOptions = Partial;