Skip to content

Commit

Permalink
Move debugStats
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 3, 2021
1 parent e9879ae commit 9424e5c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/report/config/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ const shouldUseReporter = function ({ tty }, command) {
const addDefaultReporterConfig = function ({
tty,
config: { quiet = !tty, showDiff = tty, colors = tty, ...config },
debugStats = false,
capabilities: { debugStats = false } = {},
...reporter
}) {
return {
...reporter,
tty,
config: { ...config, quiet, showDiff, colors },
debugStats,
capabilities: { debugStats },
}
}
4 changes: 3 additions & 1 deletion src/report/config/programmatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const PROGRAMMATIC_REPORTER = {
id: 'programmatic',
moduleId: 'programmatic',
format: 'programmatic',
debugStats: false,
capabilities: {
debugStats: false,
},
tty: false,
config: {
quiet: true,
Expand Down
5 changes: 4 additions & 1 deletion src/report/normalize/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export const mergeResultProps = function (result, resultProps) {
// reporter-specific
export const normalizeCombEach = function (
result,
{ debugStats, config: { showPrecision, showDiff, showTitles } },
{
capabilities: { debugStats },
config: { showPrecision, showDiff, showTitles },
},
{ titles },
) {
const resultA = addDimensionsTitles(result, titles, showTitles)
Expand Down
5 changes: 4 additions & 1 deletion src/report/reporters/debug/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ const reportTerminal = function ({ combinations, screenWidth, history }) {
return [statsTables, timeSeries, histograms].join('\n\n')
}

export const debug = { reportTerminal, debugStats: true }
export const debug = {
reportTerminal,
capabilities: { debugStats: true },
}
2 changes: 1 addition & 1 deletion src/report/utils/stats/prettify.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const addStatsPretty = function ({

// Some `stats` might be `undefined` for:
// - all combinations when:
// - `debugStats` is `false` (for many stats)
// - `capabilities.debugStats` is `false` (for many stats)
// - `showPrecision` is `false` or `true` (for `median[Min|Max]`)
// - `showDiff` is `false` or there is nothing to diff (for `diff`)
// - some combinations when:
Expand Down
2 changes: 1 addition & 1 deletion src/stats/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getInitialStats = function () {
// Some stats can be `undefined`:
// - all: in combinations not measured yet, nor saved
// - mean, rstdev, moe, rmoe, samples, loops, times, repeat, minLoopDuration:
// when `reporter.debugStats` is false
// when `reporter.capabilities.debugStats` is false
// - median: when `showPrecision` is true
// - moe, rmoe, medianMin, medianMax: when `showPrecision` is false
// - stdev, rstdev, moe, rmoe, medianMin, medianMax: when loops < 5
Expand Down

0 comments on commit 9424e5c

Please sign in to comment.