From 6c2979ce1fd0ec14820e3cfd5d856b8752c30111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 4 Oct 2024 21:14:21 +0200 Subject: [PATCH] fix: fix reporter type definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/index.d.ts | 4 +++- src/reporter/json/bmf.js | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.d.ts b/src/index.d.ts index 8559aad..f23dc7d 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -45,6 +45,8 @@ export function baseline( options?: BenchmarkOptions ): void +export function ReporterType(report: Report): T + export function run(options?: { now?: () => number silent?: boolean @@ -58,7 +60,7 @@ export function run(options?: { latencyPercentiles?: boolean json?: number | boolean file?: string - reporter?: (report: Report) => T // custom reporter + reporter?: ReporterType // custom reporter units?: boolean }): Promise diff --git a/src/reporter/json/bmf.js b/src/reporter/json/bmf.js index bef9f74..562f2c3 100644 --- a/src/reporter/json/bmf.js +++ b/src/reporter/json/bmf.js @@ -1,3 +1,9 @@ +/** + * Bencher Metric Format (BMF). + * + * @param {Object} report tatami-ng report + * @returns {Object} BMF report + */ export const bmf = report => { return report.benchmarks .filter(benchmark => benchmark.error == null)