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