Name: karma-benchmarkjs-reporter
Owner: Formidable
Description: A configurable Karma reporter for the karma-benchmark plugin.
Created: 2016-09-08 22:20:31.0
Updated: 2017-05-19 13:16:24.0
Pushed: 2016-09-20 21:57:18.0
Size: 29
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A configurable Karma reporter for the karma-benchmark plugin.
install karma-benchmark karma-benchmarkjs-reporter --save-dev
Add benchmark
to your frameworks
and reporters
arrays. Optionally, specify a benchmarkReporter
config object:
le.exports = function(config) {
nfig.set({
// ...
frameworks: ["benchmark"],
reporters: ["benchmark"],
// optional configuration object :
benchmarkReporter: {
colors: config.colors,
style: style,
decorator: "-",
terminalWidth: 60,
hzWidth: 4,
hzUnits: "ops/sec",
browserWidth: 40,
showBrowser: false,
showSuiteSummary: false,
formatBenchmark: formatBenchmark,
formatSuiteHeading: formatSuiteHeading,
formatSuiteSummary: formatSuiteSummary
}
;
colors
default: true
This value is inherited from Karma, but you can override it by specifying a boolean.
style
default:
nchmark: chalk.stripColor,
mmaryBenchmark: chalk.underline,
mmaryEmphasis: chalk.bold.underline,
owser: chalk.blue,
corator: chalk.cyan,
: chalk.green,
Units: chalk.italic.dim,
ite: chalk.bold.magenta
The style object contains the styling functions for each 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.
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 {Object} benchmark the benchmark to be formatted
param {Object} browser the browser associated with the benchmark
param {Object} benchConfig the benchmarkReporter config obj
return {string} the formatted benchmark
formatBenchmark = function (benchmark, browser, benchConfig) {...};
param {string} suiteName name of performance suite
param {Object} browser browser object
param {Object} benchConfig benchmarkReporter config object
return {string} formatted suite heading
formatSuiteHeading = function (suiteName, browser, benchConfig) {...};
param {Object[]} suite array of browserBenchmarks: `{browser: {Obj}, benchmark: {Obj}`
param {Object} benchConfig benchmarkReporter config obj
return {string} the formatted suite summary
formatSuiteSummary = function (suite, benchConfig) {