Karma Benchmark.js Reporter
A configurable Karma reporter for the karma-benchmark plugin.
Installation
npm install karma-benchmark karma-benchmarkjs-reporter --save-dev
Karma Configuration
Add benchmark
to your frameworks
and reporters
arrays. Optionally, specify
module { config;};
Options
colors
default: true
This value is inherited from Karma, but you can override it by specifying a boolean.
style
default:
benchmark: chalkstripColor summaryBenchmark: chalkunderline summaryEmphasis: chalkboldunderline browser: chalkblue decorator: chalkcyan hz: chalkgreen hzUnits: chalkitalicdim suite: chalkboldmagenta
The style object contains the styling functions for piece of data. The default uses chalk
for styling and color.
decorator
default: "-"
The decorator for the beginning of each benchmark row.
terminalWidth
default: 60
The default formatting functions attempt to match this column width for each row. There is still possibility for overflow.
hzWidth
default: 4
The default formatting functions use this to pad the formatted hz
string.
hzUnits
default: "ops/sec"
The string placed after the hz
as units.
browserWidth
default: 40
The default formatting functions use this to pad the browser name.
showBrowser
default: false
The default formatting functions only output the browser name if set to true
. It is useful if you are benchmarking multiple browsers.
showSuiteSummary
default: false
Specify if you want to call the formatSuiteSummary
function at the end of a suite.
Formatting functions
If you override the default formatting functions, you must ensure that your functions take into account the other configuration values (if you want to use them).
View the default formatting functions
/** * @param * @param * @param * @return */var {...}; /** * @param * @param * @param * @return */var {...}; /** * @param * @param * @return */var {