@codspeed/benchmark.js-plugin
Version:
Benchmark.js compatibility layer for CodSpeed
41 lines (38 loc) • 2.28 kB
TypeScript
import { SetupInstrumentsRequestBody, SetupInstrumentsResponse } from '@codspeed/core';
import Benchmark from 'benchmark';
interface WithCodSpeedBenchmark extends Omit<Benchmark, "run" | "abort" | "clone" | "compare" | "emit" | "off" | "on" | "reset"> {
abort(): WithCodSpeedBenchmark;
clone(options: Benchmark.Options): WithCodSpeedBenchmark;
compare(benchmark: Benchmark): number;
off(type?: string, listener?: CallableFunction): Benchmark | Promise<Benchmark>;
off(types: string[]): WithCodSpeedBenchmark;
on(type?: string, listener?: CallableFunction): WithCodSpeedBenchmark;
on(types: string[]): WithCodSpeedBenchmark;
reset(): WithCodSpeedBenchmark;
run(options?: Benchmark.Options): Benchmark | Promise<Benchmark>;
}
interface WithCodSpeedSuite extends Omit<Benchmark.Suite, "run" | "abort" | "clone" | "compare" | "emit" | "off" | "on" | "reset" | "add" | "filter" | "each" | "forEach"> {
abort(): WithCodSpeedSuite;
add(name: string, fn: CallableFunction | string, options?: Benchmark.Options): WithCodSpeedSuite;
add(fn: CallableFunction | string, options?: Benchmark.Options): WithCodSpeedSuite;
add(name: string, options?: Benchmark.Options): WithCodSpeedSuite;
add(options: Benchmark.Options): WithCodSpeedSuite;
clone(options: Benchmark.Options): WithCodSpeedSuite;
filter(callback: CallableFunction | string): WithCodSpeedSuite;
off(type?: string, callback?: CallableFunction): WithCodSpeedSuite;
off(types: string[]): WithCodSpeedSuite;
on(type?: string, callback?: CallableFunction): WithCodSpeedSuite;
on(types: string[]): WithCodSpeedSuite;
reset(): WithCodSpeedSuite;
each(callback: CallableFunction): WithCodSpeedSuite;
forEach(callback: CallableFunction): WithCodSpeedSuite;
run(options?: Benchmark.Options): Benchmark.Suite | Promise<Benchmark.Suite>;
}
declare function withCodSpeed(suite: Benchmark): WithCodSpeedBenchmark;
declare function withCodSpeed(suite: Benchmark.Suite): WithCodSpeedSuite;
/**
* Dynamically setup the CodSpeed instruments.
*/
declare function setupInstruments(body: SetupInstrumentsRequestBody): Promise<SetupInstrumentsResponse>;
export { type WithCodSpeedSuite, setupInstruments, withCodSpeed };
//# sourceMappingURL=index.d.ts.map