Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 5, 2021
1 parent 27e87bb commit 3315748
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/report/reporters/boxplot/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
/* eslint-disable max-lines */
import mapObj from 'map-obj'
import stringWidth from 'string-width'

import { goodColor } from '../../utils/colors.js'
import { getCombinationNameColor } from '../../utils/name.js'
import { NAME_SEPARATOR_COLORED } from '../../utils/separator.js'
import {
getCombinationName,
getCombinationNameColor,
} from '../../utils/name.js'
import {
NAME_SEPARATOR,
NAME_SEPARATOR_COLORED,
} from '../../utils/separator.js'

// Reporter showing boxplot of measures (min, q1, median, q3, max)
const reportTerminal = function (
Expand Down Expand Up @@ -120,7 +125,7 @@ const serializeBoxPlot = function ({
}

const getTitlesWidth = function ([combination]) {
return stringWidth(getCombinationTitles(combination))
return `${getCombinationName(combination)}${NAME_SEPARATOR}`.length
}

const getCombinationTitles = function (combination) {
Expand Down
9 changes: 7 additions & 2 deletions src/report/utils/name.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { titleColor } from './colors.js'

// Retrieve the prettified combination name to used as a first column
export const getCombinationNameColor = function ({ titles }) {
export const getCombinationNameColor = function (combination) {
const combinationName = getCombinationName(combination)
return titleColor(combinationName)
}

export const getCombinationName = function ({ titles }) {
const rowName = titles.join(NAME_MIDDLE)
return titleColor(`${NAME_START}${rowName}${NAME_END}`)
return `${NAME_START}${rowName}${NAME_END}`
}

const NAME_MIDDLE = ' '
Expand Down

0 comments on commit 3315748

Please sign in to comment.