Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Feb 6, 2022
1 parent 4dce4f0 commit 5201887
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions src/report/reporters/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { getReportMethods } from '../formats/list.js'
import { BUILTIN_REPORTERS, DEFAULT_REPORTERS } from './main.js'
import { sharedProps } from './shared_props.js'

const pick = amongCommands(['remove', 'run', 'show'])

export const REPORTER_PLUGIN_TYPE = {
name: 'reporter',
modulePrefix: 'spyd-reporter-',
Expand Down Expand Up @@ -48,14 +46,12 @@ export const REPORTER_PLUGIN_TYPE = {
],
builtins: BUILTIN_REPORTERS,
selectProp: {
pick,
pick: amongCommands(['remove', 'run', 'show']),
default: DEFAULT_REPORTERS,
transform(value, { config }) {
return config.force ? [] : normalizeOptionalArray(value)
},
},
configProp: {
pick,
},
configProp: {},
sharedProps,
}
8 changes: 2 additions & 6 deletions src/runners/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
import { BUILTIN_RUNNERS, DEFAULT_RUNNERS } from './main.js'
import { sharedProps } from './shared_props.js'

const pick = amongCommands(['dev', 'run'])

export const RUNNER_PLUGIN_TYPE = {
// Name used:
// - As a default value for the selection property
Expand Down Expand Up @@ -36,15 +34,13 @@ export const RUNNER_PLUGIN_TYPE = {
// Configuration property selecting the plugin
// Default: empty object
selectProp: {
pick,
pick: amongCommands(['dev', 'run']),
default: DEFAULT_RUNNERS,
validate: validateEmptyArray,
},
// Configuration property configuring the plugin
// Default: empty object
configProp: {
pick,
},
configProp: {},
// Plugin properties shared by all plugins
// Default: empty array
sharedProps,
Expand Down

0 comments on commit 5201887

Please sign in to comment.