Skip to content

Commit

Permalink
Move list definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Feb 20, 2022
1 parent 339f711 commit abdfe48
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
38 changes: 23 additions & 15 deletions src/config/normalize/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ import { normalizeConfigSelectors } from '../select/normalize.js'
import { getDummyDefinitions } from './dummy.js'
import { amongCommands } from './pick.js'
import { normalizeArray } from './transform.js'
import { validateJson, validateObject } from './validate/complex.js'
import {
validateJson,
validateObject,
validateEmptyArray,
} from './validate/complex.js'
import { validateFileExists, validateDirectory } from './validate/fs.js'
import {
validateBoolean,
Expand All @@ -47,18 +51,6 @@ import {

const configProps = getDummyDefinitions(CONFIG_DEFINITIONS)

const runner = {
name: 'runner',
pick: amongCommands(['dev', 'run']),
default: DEFAULT_RUNNERS,
}

const reporter = {
name: 'reporter',
pick: amongCommands(['remove', 'run', 'show']),
default: DEFAULT_REPORTERS,
}

const cwd = {
name: 'cwd',
pick: amongCommands(['dev', 'remove', 'run', 'show']),
Expand Down Expand Up @@ -193,10 +185,24 @@ const titlesAny = {
example: EXAMPLE_TITLE,
}

const runner = {
name: 'runner',
pick: amongCommands(['dev', 'run']),
default: DEFAULT_RUNNERS,
validate: validateEmptyArray,
}

const reporter = {
name: 'reporter',
pick: amongCommands(['remove', 'run', 'show']),
default: DEFAULT_REPORTERS,
transform(value, { config }) {
return config.force ? [] : value
},
}

export const DEFINITIONS = [
...configProps,
runner,
reporter,
cwd,
delta,
force,
Expand All @@ -214,5 +220,7 @@ export const DEFINITIONS = [
systemAny,
titles,
titlesAny,
runner,
reporter,
].flatMap(normalizeConfigSelectors)
/* eslint-enable max-lines */
5 changes: 0 additions & 5 deletions src/report/reporters/plugin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,5 @@ export const REPORTER_PLUGIN_TYPE = {
validate: validateDefinedString,
},
],
list: {
transform(value, { config }) {
return config.force ? [] : value
},
},
item,
}
10 changes: 1 addition & 9 deletions src/runners/plugin/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
validateEmptyArray,
validateFunction,
} from '../../config/normalize/validate/complex.js'
import { validateFunction } from '../../config/normalize/validate/complex.js'
import { BUILTIN_RUNNERS } from '../main.js'

import { item } from './item.js'
Expand Down Expand Up @@ -31,11 +28,6 @@ export const RUNNER_PLUGIN_TYPE = {
validate: validateFunction,
},
],
// Configuration property selecting and configuring the plugin
// Default: empty object
list: {
validate: validateEmptyArray,
},
// Properties of the `list` item shared by all plugins
// Default: empty array
item,
Expand Down

0 comments on commit abdfe48

Please sign in to comment.