Callback function for teardown each execute.
Count of done tests in this benchmark.
Duration of this execution.
Benchmark will await if returns Promise.
Callback function for setup before each execute.
Count of done tests in this benchmark.
Benchmark will await if returns Promise.
The options for this benchmark or benchmarking function.
Maximum number of executing test. This value will be ignore if set Benchmark.number.
Minimal number of executing test. This value will be ignore if set Benchmark.number.
Name of this benchmark.
The number of executing the test. Will decide automatically in between Benchmark.minNumber to Benchmark.maxNumber if set null.
Wanted maximum error rate. This value will be ignore if set Benchmark.number.
Teardown after execute benchmark.
At the time executing this method, this
is the unique object for the benchmark.
So you can use this
for storing testing data like a database.
Data of this
that set in this method will discard after call this method.
In default, shows test result.
Teardown after each tests.
At the time executing this method, this
is the unique object for the test.
So you can use this
for storing testing data.
Data of this
that set in this method will discard after call this method.
In default, do nothing.
Setup before execute benchmark.
At the time executing this method, this
is the unique object for the benchmark.
So you can use this
for storing testing data like a database.
Data of this
that set in this method will discard after call Benchmark.after
In default, do nothing.
Setup before each tests.
At the time executing this method, this
is the unique object for the test.
So you can use this
for storing testing data.
Data of this
that set in this method will discard after call Benchmark.afterEach
In default, do nothing.
The target function for benchmarking.
At the time executing this method, this
is the unique object for the test.
So you can use this
for storing testing data.
Data of this
that set in this method will discard after call Benchmark.afterEach
In default, couses error that Error('target function is not defined')
.
Execute benchmark.
The this
for each benchmarking functions.
__proto__
will override with this instance.
A result of benchmark.
Generated using TypeDoc
Class for benchmarking.
Benchmark will execute by flow like this.
Each function can override with options of the constructor.
import Benchmark from 'asyncmark'; new Benchmark({ name: 'timeout', fun() { return new Promise((resolve, reject) => { setTimeout(resolve, 100); }); }, }).run().catch(console.error);