Skip to content

Commit a4dc145

Browse files
authored
fix: optional iterations count for end(), add type tests
fix: optional iterations count for end(), add type tests lint
1 parent a584269 commit a4dc145

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export declare namespace BenchNode {
3939

4040
type BenchmarkFunction = (timer?: {
4141
start: () => void;
42+
end: (iterations?: number) => void;
4243
count: number;
4344
}) => void | Promise<void>;
4445

@@ -80,6 +81,7 @@ export declare namespace BenchNode {
8081

8182
export declare const textReport: BenchNode.ReporterFunction;
8283
export declare const chartReport: BenchNode.ReporterFunction;
84+
export declare const prettyReport: BenchNode.ReporterFunction;
8385
export declare const htmlReport: BenchNode.ReporterFunction;
8486
export declare const jsonReport: BenchNode.ReporterFunction;
8587
export declare const csvReport: BenchNode.ReporterFunction;

types/types.test-d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
csvReport,
1111
htmlReport,
1212
jsonReport,
13+
prettyReport,
1314
textReport,
1415
} from "..";
1516

@@ -72,6 +73,7 @@ expectType<BenchNode.Suite>(
7273
const managedBenchFn: BenchNode.BenchmarkFunction = (timer) => {
7374
if (timer) {
7475
expectType<() => void>(timer.start);
76+
expectType<(iterations?: number) => void>(timer.end);
7577
expectType<number>(timer.count);
7678
timer.start();
7779
for (let i = 0; i < timer.count; i++) {
@@ -121,6 +123,7 @@ expectType<void>(chartReport(sampleResults));
121123
expectType<void>(htmlReport(sampleResults));
122124
expectType<void>(jsonReport(sampleResults));
123125
expectType<void>(csvReport(sampleResults));
126+
expectType<void>(prettyReport(sampleResults));
124127

125128
// Test Plugins
126129
const plugin1 = new V8NeverOptimizePlugin();

0 commit comments

Comments
 (0)