(task, name)
| 608 | * @returns {Promise<[number, number] | void>} start and end time |
| 609 | */ |
| 610 | const iterationAsync = async (task, name) => { |
| 611 | const { fn, options } = |
| 612 | /** @type {TaskMeta} */ |
| 613 | (uriMap.get(name)); |
| 614 | |
| 615 | try { |
| 616 | await options?.beforeEach?.call(task, "run"); |
| 617 | const start = bench.now(); |
| 618 | await fn(); |
| 619 | const end = bench.now() - start || 0; |
| 620 | await options?.afterEach?.call(task, "run"); |
| 621 | return [start, end]; |
| 622 | } catch (err) { |
| 623 | if (bench.throws) { |
| 624 | throw err; |
| 625 | } |
| 626 | } |
| 627 | }; |
| 628 | |
| 629 | /** |
| 630 | * @param {Fn} fn function |
no test coverage detected