Skip to content

Commit 581c223

Browse files
fix: avoid duplicate call to benchmark related callbacks (#134)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> Co-authored-by: Jérôme Benoit <jerome.benoit@sap.com>
1 parent 50d00d8 commit 581c223

File tree

10 files changed

+120
-173
lines changed

10 files changed

+120
-173
lines changed

.eslintrc.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,10 @@
2121
"no-await-in-loop": "off",
2222
"no-plusplus": "off",
2323
"no-promise-executor-return": "off",
24-
"@typescript-eslint/no-non-null-assertion": "off",
25-
"@typescript-eslint/interface-name-prefix": "off",
26-
"@typescript-eslint/explicit-function-return-type": "off",
27-
"@typescript-eslint/no-explicit-any": "off",
28-
"@typescript-eslint/explicit-module-boundary-types": "off",
29-
"@typescript-eslint/no-unused-vars": "off",
30-
"@typescript-eslint/ban-types": "off",
3124
"import/no-unresolved": "off",
3225
"import/extensions": "off",
3326
"no-underscore-dangle": "off",
3427
"indent": ["error", 2],
35-
"max-len": 0
28+
"max-len": "off"
3629
}
3730
}

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,22 +333,20 @@ For instance:
333333

334334
```js
335335
// runs on each benchmark task's cycle
336-
bench.addEventListener('cycle', (e) => {
337-
const task = e.task!;
336+
bench.addEventListener('cycle', (evt) => {
337+
const task = evt.task!;
338338
});
339339

340340
// runs only on this benchmark task's cycle
341-
task.addEventListener('cycle', (e) => {
342-
const task = e.task!;
341+
task.addEventListener('cycle', (evt) => {
342+
const task = evt.task!;
343343
});
344344
```
345345

346346
### `BenchEvent`
347347

348348
```ts
349-
export type BenchEvent = Event & {
350-
task: Task | null;
351-
};
349+
export type BenchEvent = Event & { task?: Task };
352350
```
353351

354352
### `process.hrtime`

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "tinybench",
33
"version": "2.9.0",
44
"type": "module",
5-
"packageManager": "pnpm@9.12.1",
5+
"packageManager": "pnpm@9.12.2",
66
"volta": {
77
"node": "20.18.0",
8-
"pnpm": "9.12.1"
8+
"pnpm": "9.12.2"
99
},
1010
"engines": {
1111
"node": ">=18.0.0"
@@ -42,7 +42,7 @@
4242
"devDependencies": {
4343
"@size-limit/preset-small-lib": "^11.1.6",
4444
"@size-limit/time": "^11.1.6",
45-
"@types/node": "^22.7.5",
45+
"@types/node": "^22.7.6",
4646
"@typescript-eslint/eslint-plugin": "^8.9.0",
4747
"@typescript-eslint/parser": "^8.9.0",
4848
"bumpp": "^9.7.1",

0 commit comments

Comments
 (0)