1 | import * as Benchmark from 'benchmark';
|
2 | import { Executor } from '../executors/Executor';
|
3 | import Reporter, { ReporterProperties } from './Reporter';
|
4 | import Test from '../Test';
|
5 | import Suite from '../Suite';
|
6 | export default class BenchmarkReporter extends Reporter implements BenchmarkReporterProperties {
|
7 | baseline: BenchmarkBaseline;
|
8 | filename: string;
|
9 | mode: BenchmarkMode;
|
10 | sessions: {
|
11 | [sessionId: string]: SessionInfo;
|
12 | };
|
13 | thresholds: BenchmarkThresholds;
|
14 | constructor(executor: Executor, options?: BenchmarkReporterOptions);
|
15 | _getSession(testOrSuite: Test | Suite): SessionInfo;
|
16 | runEnd(): void;
|
17 | suiteEnd(suite: Suite): void;
|
18 | suiteStart(suite: Suite): void;
|
19 | testEnd(test: Test): void;
|
20 | }
|
21 | export interface BenchmarkData {
|
22 | times: Benchmark.Times;
|
23 | hz: number;
|
24 | stats: {
|
25 | rme: number;
|
26 | moe: number;
|
27 | mean: number;
|
28 | };
|
29 | }
|
30 | export interface BenchmarkThresholds {
|
31 | warn?: {
|
32 | rme?: number;
|
33 | hz?: number;
|
34 | mean?: number;
|
35 | };
|
36 | fail?: {
|
37 | rme?: number;
|
38 | hz?: number;
|
39 | mean?: number;
|
40 | };
|
41 | }
|
42 | export interface BaselineEnvironment {
|
43 | client: string;
|
44 | version: string;
|
45 | platform: string;
|
46 | tests: {
|
47 | [testId: string]: BenchmarkData;
|
48 | };
|
49 | }
|
50 | export interface BenchmarkBaseline {
|
51 | [key: string]: BaselineEnvironment;
|
52 | }
|
53 | export interface SesssionEnvironment {
|
54 | client: string;
|
55 | version: string;
|
56 | platform: string;
|
57 | id: string;
|
58 | }
|
59 | export interface SessionInfo {
|
60 | suites: {
|
61 | [suiteId: string]: {
|
62 | numBenchmarks: number;
|
63 | numFailedBenchmarks: number;
|
64 | };
|
65 | };
|
66 | environment: SesssionEnvironment;
|
67 | }
|
68 | export declare type BenchmarkMode = 'baseline' | 'test';
|
69 | export interface BenchmarkReporterProperties extends ReporterProperties {
|
70 | filename: string;
|
71 | mode: BenchmarkMode;
|
72 | thresholds: BenchmarkThresholds;
|
73 | }
|
74 | export declare type BenchmarkReporterOptions = Partial<BenchmarkReporterProperties>;
|