Skip to content

Commit

Permalink
fix: fix reporter type definition
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
jerome-benoit committed Oct 4, 2024
1 parent 6659808 commit 6c2979c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export function baseline(
options?: BenchmarkOptions
): void

export function ReporterType<T>(report: Report): T

export function run<T = Report>(options?: {
now?: () => number
silent?: boolean
Expand All @@ -58,7 +60,7 @@ export function run<T = Report>(options?: {
latencyPercentiles?: boolean
json?: number | boolean
file?: string
reporter?: <T>(report: Report) => T // custom reporter
reporter?: ReporterType<T> // custom reporter
units?: boolean
}): Promise<T>

Expand Down
6 changes: 6 additions & 0 deletions src/reporter/json/bmf.js
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 6c2979c

Please sign in to comment.