Callback function for teardown after each execution target function.
Count of done benchmarks in this suite.
Count of done tests in this benchmark.
A Benchmark instance that executed.
A result of this test.
Some Promise for awaiting, or undefined.
Callback function for setup before each execution target function.
Count of done suite or benchmarks in this suite.
Count of done execution in this benchmark.
A Benchmark instance that will execute.
Some Promise for awaiting, or undefined.
Options for this suite.
Default options for benchmarks in this suite.
Name of this suite.
Flag for executing each benchmark parallelly.
Make new benchmark or suite and adding into this Suite.
Benchmark, Suite or arguments for Benchmark.constructor.
Returns this suite for method chain.
Teardown after execute all benchmarks.
At the time executing this method, this
is the unique object for the suite.
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, do nothing.
Teardown after execute each 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, do nothing.
Teardown after execute each test of benchmarks.
At the time executing this method, this
is the unique object for the test.
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, do nothing.
Setup before execute all benchmarks.
At the time executing this method, this
is the unique object for the suite.
So you can use this
for storing testing data like a database.
Data of this
that set in this method will discard after call Suite.after.
In default, do nothing.
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 Suite.afterEach.
In default, do nothing.
Setup before execute each test of benchmarks.
At the time executing this method, this
is the unique object for the test.
So you can use this
for storing testing data like a database.
Data of this
that set in this method will discard after call Suite.afterTest.
In default, do nothing.
Execute benchmarks in this suite.
All benchmarks will execute parallel if enabled Suite.parallel option. Else do execute sequentially by added order.
The this
for each benchmarking functions.
__proto__
will override with this instance.
Callback functions.
An array of Results.
Generated using TypeDoc
A set of Benchmarks for executing those sequential or parallel.
Suite will execute by flow like this.
Each function can override with options of the constructor.
Example
import {Suite} from 'asyncmark'; const suite = new Suite({ name: 'ways to find a character', beforeEach() { this.text = 'hello world'; }, parallel: true, }); suite.add(function() { /o/.test(this.text); }); suite.add({ name: 'String#indexOf', before() { console.log('starting String#indexOf...'); }, fun() { this.text.indexOf('o') > -1; }, }); suite.add(new Benchmark({ name: 'String#match', fun() { Boolean(this.text.match(/o/)); }, after(result) { console.log('String#match is done! ' + result); }, })); suite.run() .then(results => { let min = results[0]; results.forEach(x => { if (min.average > x.average) { min = x; } }); console.log(min.name + ' is best way!'); }). catch(err => console.error(err));