UNPKG

intern

Version:

Intern. A next-generation code testing stack for JavaScript.

44 lines (43 loc) 1.62 kB
/// <reference types="benchmark" /> import Task from '@dojo/core/async/Task'; import * as Benchmark from 'benchmark'; import Test, { TestFunction, TestProperties } from './Test'; import Deferred from './Deferred'; export default class BenchmarkTest extends Test { test: BenchmarkTestFunction; benchmark: InternBenchmark; constructor(descriptor: BenchmarkTestOptions); timeElapsed: number; async(_timeout?: number, _numCallsUntilResolution?: number): Deferred<any>; run(): Task<void>; toJSON(): { [key: string]: any; }; static async(testFunction: BenchmarkDeferredTestFunction, numCallsUntilResolution?: number): BenchmarkTestFunction; } export interface BenchmarkTestFunction extends TestFunction { (this: BenchmarkTest): void | Promise<any>; options?: BenchmarkOptions; } export interface BenchmarkDeferredTestFunction extends BenchmarkTestFunction { (this: BenchmarkTest, deferred: Deferred<void>): void | Promise<any>; options?: BenchmarkOptions; } export interface BenchmarkTestProperties extends TestProperties { test: BenchmarkTestFunction; skip: string; numCallsUntilResolution: number; } export declare type BenchmarkTestOptions = Partial<BenchmarkTestProperties> & { name: string; test: BenchmarkTestFunction; options?: BenchmarkOptions; }; export interface BenchmarkOptions extends Benchmark.Options { skip?: string; numCallsUntilResolution?: number; } export interface InternBenchmark extends Benchmark { internTest?: BenchmarkTest; } export declare function isBenchmarkTest(value: any): value is BenchmarkTest;