1 | import { CancellablePromise } from '@theintern/common';
|
2 | import * as Benchmark from 'benchmark';
|
3 | import Test, { TestFunction, TestProperties } from './Test';
|
4 | import Deferred from './Deferred';
|
5 | export default class BenchmarkTest extends Test {
|
6 | test: BenchmarkTestFunction;
|
7 | benchmark: InternBenchmark;
|
8 | constructor(descriptor: BenchmarkTestOptions);
|
9 | timeElapsed: number;
|
10 | async(_timeout?: number, _numCallsUntilResolution?: number): Deferred<any>;
|
11 | run(): CancellablePromise<void>;
|
12 | toJSON(): {
|
13 | [key: string]: any;
|
14 | };
|
15 | static async(testFunction: BenchmarkDeferredTestFunction, numCallsUntilResolution?: number): BenchmarkTestFunction;
|
16 | }
|
17 | export interface BenchmarkTestFunction extends TestFunction {
|
18 | (this: BenchmarkTest): void | Promise<any>;
|
19 | options?: BenchmarkOptions;
|
20 | }
|
21 | export interface BenchmarkDeferredTestFunction extends BenchmarkTestFunction {
|
22 | (this: BenchmarkTest, deferred: Deferred<void>): void | Promise<any>;
|
23 | options?: BenchmarkOptions;
|
24 | }
|
25 | export interface BenchmarkTestProperties extends TestProperties {
|
26 | test: BenchmarkTestFunction;
|
27 | skip: string;
|
28 | numCallsUntilResolution: number;
|
29 | }
|
30 | export declare type BenchmarkTestOptions = Partial<BenchmarkTestProperties> & {
|
31 | name: string;
|
32 | test: BenchmarkTestFunction;
|
33 | options?: BenchmarkOptions;
|
34 | };
|
35 | export interface BenchmarkOptions extends Benchmark.Options {
|
36 | skip?: string;
|
37 | numCallsUntilResolution?: number;
|
38 | }
|
39 | export interface InternBenchmark extends Benchmark {
|
40 | internTest?: BenchmarkTest;
|
41 | }
|
42 | export declare function isBenchmarkTest(value: any): value is BenchmarkTest;
|