Skip to content

Commit

Permalink
Fix system default value
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Dec 26, 2021
1 parent 9c6cd87 commit 84735fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/config/default.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { cwd as getCwd } from 'process'

import isPlainObj from 'is-plain-obj'

import { isTtyInput } from '../report/tty.js'

// Add default configuration properties
Expand All @@ -8,12 +10,16 @@ export const addDefaultConfig = function (config, command) {
...DEFAULT_CONFIG,
cwd: getCwd(),
force: !isTtyInput(),
showSystem: config.system !== undefined,
showSystem: getDefaultShowSystem(config),
showMetadata: METADATA_COMMANDS.has(command),
...config,
}
}

const getDefaultShowSystem = function ({ system = {} }) {
return isPlainObj(system) && Object.keys(system).length !== 0
}

const METADATA_COMMANDS = new Set(['show', 'remove'])

// We default `runner` to `node` only instead of several ones (e.g. `cli`)
Expand All @@ -22,7 +28,7 @@ const METADATA_COMMANDS = new Set(['show', 'remove'])
// for users and provides with better error messages.
export const DEFAULT_CONFIG = {
precision: 5,
system: 'default_system',
system: {},
save: false,
outliers: false,
runnerConfig: {},
Expand Down

0 comments on commit 84735fd

Please sign in to comment.