Skip to content

Commit

Permalink
Add noDimensions to report
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent 79d5e3a commit e2c8ea9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/history/since/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getNoDimensions } from '../../combination/filter.js'
import { findByDelta } from '../delta/main.js'

import { getMergedResult, getSinceResult, mergeCombinations } from './merge.js'
Expand Down Expand Up @@ -65,6 +66,18 @@ export const applySince = async function (result, previous, { since, cwd }) {
return { mergedResult, history }
}

// Add `historyInfo.noDimensions`, used to filter out redundant dimensions
export const addNoDimensions = function (historyInfo) {
const { combinations } = getMergedCombinations(historyInfo)
const noDimensions = getNoDimensions(combinations)
return { ...historyInfo, noDimensions }
}

// Retrieve list of combinations with all dimensions of the result after merging
const getMergedCombinations = function ({ history, mergedResult }) {
return mergedResult === undefined ? history[history.length - 1] : mergedResult
}

// In principle, we should do both `applySince()` and `mergeHistory()` at
// the same time, before reporting. However, `applySince()` is slow.
// - To avoid repeating it before each preview, we compute it only once before
Expand Down
7 changes: 4 additions & 3 deletions src/report/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { applySince } from '../history/since/main.js'
import { applySince, addNoDimensions } from '../history/since/main.js'

import { getContents } from './contents.js'
import { finalizeContents } from './finalize.js'
Expand Down Expand Up @@ -41,12 +41,13 @@ export const reportStart = async function (result, previous, config) {
applySince(result, previous, config),
startReporters(config),
])
const historyInfoA = addNoDimensions(historyInfo)
const { result: resultA, config: configB } = normalizeEarlyResult(
result,
historyInfo,
historyInfoA,
configA,
)
return { result: resultA, historyInfo, config: configB }
return { result: resultA, historyInfo: historyInfoA, config: configB }
}

// Report preview results in `run` command.
Expand Down

0 comments on commit e2c8ea9

Please sign in to comment.