From 89483e888acc56386b9ebc4d70a4676e4a5a5cb1 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 1 Jul 2021 14:55:46 -0700 Subject: [PATCH] fix(usage): better audit/boolean flag usage output This adds the `audit` config item to the usage output of `npm ci`, and also tweaks how usage flags are shown for boolean options that do not default to false. Their usage is shown as the `--no-x` form of the flag to better communicate that the flag is needed to turn that normally true option OFF. The description of `audit` was also updated to reflect that it runs on many different npm commands, not just install. Because this flag is included in the usage of those commands it's best to let the assocation happen there instead of trying to be comprehensive in the description itself. A small fix to make `install-ci-test` not try to redefine its own usage, but to inherit from `ci` was also included. PR-URL: https://github.com/npm/cli/pull/3497 Credit: @wraithgar Close: #3497 Reviewed-by: @nlf --- docs/content/commands/npm-ci.md | 10 +++++ docs/content/commands/npm-dedupe.md | 7 ++-- docs/content/commands/npm-find-dupes.md | 7 ++-- docs/content/commands/npm-install-ci-test.md | 10 +++++ docs/content/commands/npm-install-test.md | 7 ++-- docs/content/commands/npm-install.md | 7 ++-- docs/content/commands/npm-link.md | 7 ++-- docs/content/commands/npm-update.md | 7 ++-- docs/content/using-npm/config.md | 7 ++-- lib/ci.js | 1 + lib/install-ci-test.js | 8 ---- lib/utils/config/definition.js | 32 ++++++++++---- lib/utils/config/definitions.js | 7 ++-- .../test/lib/load-all-commands.js.test.cjs | 42 +++++++++---------- .../lib/utils/config/definitions.js.test.cjs | 7 ++-- .../lib/utils/config/describe-all.js.test.cjs | 7 ++-- .../test/lib/utils/npm-usage.js.test.cjs | 42 +++++++++---------- test/lib/utils/config/definition.js | 7 ++++ 18 files changed, 135 insertions(+), 87 deletions(-) diff --git a/docs/content/commands/npm-ci.md b/docs/content/commands/npm-ci.md index 9645bae7e2f43..31c92b13c5cdd 100644 --- a/docs/content/commands/npm-ci.md +++ b/docs/content/commands/npm-ci.md @@ -69,6 +69,16 @@ cache: +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + #### `ignore-scripts` * Default: false diff --git a/docs/content/commands/npm-dedupe.md b/docs/content/commands/npm-dedupe.md index fbccc41053292..324e6a71b7a3e 100644 --- a/docs/content/commands/npm-dedupe.md +++ b/docs/content/commands/npm-dedupe.md @@ -164,9 +164,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-find-dupes.md b/docs/content/commands/npm-find-dupes.md index 28281d5678ab7..3b28f6443decd 100644 --- a/docs/content/commands/npm-find-dupes.md +++ b/docs/content/commands/npm-find-dupes.md @@ -107,9 +107,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-install-ci-test.md b/docs/content/commands/npm-install-ci-test.md index c337905a0566e..2640311cf94be 100644 --- a/docs/content/commands/npm-install-ci-test.md +++ b/docs/content/commands/npm-install-ci-test.md @@ -20,6 +20,16 @@ This command runs `npm ci` followed immediately by `npm test`. +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + #### `ignore-scripts` * Default: false diff --git a/docs/content/commands/npm-install-test.md b/docs/content/commands/npm-install-test.md index deefbd96b52fd..c8533cafedd7a 100644 --- a/docs/content/commands/npm-install-test.md +++ b/docs/content/commands/npm-install-test.md @@ -149,9 +149,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-install.md b/docs/content/commands/npm-install.md index e5091e6604c91..70d4c0d46ffeb 100644 --- a/docs/content/commands/npm-install.md +++ b/docs/content/commands/npm-install.md @@ -533,9 +533,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-link.md b/docs/content/commands/npm-link.md index b1c6066768a99..c7b385009519a 100644 --- a/docs/content/commands/npm-link.md +++ b/docs/content/commands/npm-link.md @@ -233,9 +233,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/commands/npm-update.md b/docs/content/commands/npm-update.md index 512d04c828b01..c4f7694e19a81 100644 --- a/docs/content/commands/npm-update.md +++ b/docs/content/commands/npm-update.md @@ -255,9 +255,10 @@ will *not* run any pre- or post-scripts. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `bin-links` diff --git a/docs/content/using-npm/config.md b/docs/content/using-npm/config.md index 1feae3d64ac5a..476db69f2a2e3 100644 --- a/docs/content/using-npm/config.md +++ b/docs/content/using-npm/config.md @@ -170,9 +170,10 @@ to the same value as the current version. * Default: true * Type: Boolean -When "true" submit audit reports alongside `npm install` runs to the default -registry and all registries configured for scopes. See the documentation for -[`npm audit`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. #### `audit-level` diff --git a/lib/ci.js b/lib/ci.js index 3ff4b65badb49..6634ffcdc19bc 100644 --- a/lib/ci.js +++ b/lib/ci.js @@ -33,6 +33,7 @@ class CI extends ArboristWorkspaceCmd { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { return [ + 'audit', 'ignore-scripts', 'script-shell', ] diff --git a/lib/install-ci-test.js b/lib/install-ci-test.js index 0d408178b33f2..871f24b2f32d6 100644 --- a/lib/install-ci-test.js +++ b/lib/install-ci-test.js @@ -13,14 +13,6 @@ class InstallCITest extends CI { return 'install-ci-test' } - /* istanbul ignore next - see test/lib/load-all-commands.js */ - static get params () { - return [ - 'ignore-scripts', - 'script-shell', - ] - } - exec (args, cb) { this.npm.commands.ci(args, (er) => { if (er) diff --git a/lib/utils/config/definition.js b/lib/utils/config/definition.js index 507be6a644042..1354851326adf 100644 --- a/lib/utils/config/definition.js +++ b/lib/utils/config/definition.js @@ -91,13 +91,27 @@ ${noEnvExport}`) } const describeUsage = (def) => { - let key = `--${def.key}` - if (def.short && typeof def.short === 'string') - key = `-${def.short}|${key}` + let key = '' // Single type - if (!Array.isArray(def.type)) - return `${key}${def.type === Boolean ? '' : ' ' + def.hint}` + if (!Array.isArray(def.type)) { + if (def.short) + key = `-${def.short}|` + + if (def.type === Boolean && def.default !== false) + key = `${key}--no-${def.key}` + else + key = `${key}--${def.key}` + + if (def.type !== Boolean) + key = `${key} ${def.hint}` + + return key + } + + key = `--${def.key}` + if (def.short) + key = `-${def.short}|--${def.key}` // Multiple types let types = def.type @@ -120,8 +134,12 @@ const describeUsage = (def) => { description = def.hint } - if (bool) - key = `${key}|${key}` + if (bool) { + // Currently none of our multi-type configs with boolean values default to + // false so all their hints should show `--no-`, if we ever add ones that + // default to false we can branch the logic here + key = `--no-${def.key}|${key}` + } const usage = `${key} ${description}` if (multiple) diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index 9e560fb715f85..a82e9b4c17c31 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -203,10 +203,10 @@ define('audit', { default: true, type: Boolean, description: ` - When "true" submit audit reports alongside \`npm install\` runs to the + When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the - documentation for [\`npm audit\`](/commands/npm-audit) for details on - what is submitted. + documentation for [\`npm audit\`](/commands/npm-audit) for details on what + is submitted. `, flatten, }) @@ -440,6 +440,7 @@ define('cidr', { define('color', { default: !process.env.NO_COLOR || process.env.NO_COLOR === '0', + usage: '--color|--no-color|--color always', defaultDescription: ` true unless the NO_COLOR environ is set to something other than '0' `, diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index 3b0754c5227b5..2c5e80db223b9 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -84,7 +84,7 @@ Usage: npm bugs [] Options: -[--browser|--browser ] [--registry ] +[--no-browser|--browser ] [--registry ] alias: issues @@ -120,7 +120,7 @@ Usage: npm ci Options: -[--ignore-scripts] [--script-shell ] +[--no-audit] [--ignore-scripts] [--script-shell ] aliases: clean-install, ic, install-clean, isntall-clean @@ -167,9 +167,9 @@ Usage: npm dedupe Options: -[--global-style] [--legacy-bundling] [--strict-peer-deps] [--package-lock] +[--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] [--dry-run] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -239,7 +239,7 @@ Usage: npm docs [ [ ...]] Options: -[--browser|--browser ] [--registry ] +[--no-browser|--browser ] [--registry ] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -337,9 +337,9 @@ Usage: npm find-dupes Options: -[--global-style] [--legacy-bundling] [--strict-peer-deps] [--package-lock] +[--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] +[--no-audit] [--no-bin-links] [--no-fund] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -355,7 +355,7 @@ Usage: npm fund [[<@scope>/]] Options: -[--json] [--browser|--browser ] [--unicode] +[--json] [--no-browser|--browser ] [--unicode] [-w|--workspace [-w|--workspace ...]] [--which ] @@ -446,9 +446,9 @@ npm install / Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] -[--strict-peer-deps] [--package-lock] +[--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] [--dry-run] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -466,7 +466,7 @@ Usage: npm install-ci-test Options: -[--ignore-scripts] [--script-shell ] +[--no-audit] [--ignore-scripts] [--script-shell ] alias: cit @@ -493,9 +493,9 @@ npm install-test / Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] -[--strict-peer-deps] [--package-lock] +[--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] [--dry-run] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -516,9 +516,9 @@ npm link [<@scope>/][@] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] -[--strict-peer-deps] [--package-lock] +[--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] -[--audit] [--bin-links] [--fund] [--dry-run] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -768,7 +768,7 @@ Usage: npm rebuild [[<@scope>/][@] ...] Options: -[-g|--global] [--bin-links] [--ignore-scripts] +[-g|--global] [--no-bin-links] [--ignore-scripts] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -786,7 +786,7 @@ Usage: npm repo [ [ ...]] Options: -[--browser|--browser ] +[--no-browser|--browser ] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -848,7 +848,7 @@ Usage: npm search [search terms ...] Options: -[-l|--long] [--json] [--color|--color ] [-p|--parseable] +[-l|--long] [--json] [--color|--no-color|--color always] [-p|--parseable] [--no-description] [--searchopts ] [--searchexclude ] [--registry ] [--prefer-online] [--prefer-offline] [--offline] @@ -1059,8 +1059,8 @@ npm update [...] Options: [-g|--global] [--global-style] [--legacy-bundling] [--strict-peer-deps] -[--package-lock] [--omit [--omit ...]] -[--ignore-scripts] [--audit] [--bin-links] [--fund] [--dry-run] +[--no-package-lock] [--omit [--omit ...]] +[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -1078,7 +1078,7 @@ Usage: npm version [ | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] Options: -[--allow-same-version] [--commit-hooks] [--git-tag-version] [--json] +[--allow-same-version] [--no-commit-hooks] [--no-git-tag-version] [--json] [--preid prerelease-id] [--sign-git-tag] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] diff --git a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index 7b2ffbd8de9b9..27e65bc700a4d 100644 --- a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -218,9 +218,10 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for audit * Default: true * Type: Boolean -When "true" submit audit reports alongside \`npm install\` runs to the default -registry and all registries configured for scopes. See the documentation for -[\`npm audit\`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [\`npm audit\`](/commands/npm-audit) for details on what is +submitted. ` exports[`test/lib/utils/config/definitions.js TAP > config description for audit-level 1`] = ` diff --git a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index babed32535fcd..d48a6239ff7d6 100644 --- a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -49,9 +49,10 @@ to the same value as the current version. * Default: true * Type: Boolean -When "true" submit audit reports alongside \`npm install\` runs to the default -registry and all registries configured for scopes. See the documentation for -[\`npm audit\`](/commands/npm-audit) for details on what is submitted. +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [\`npm audit\`](/commands/npm-audit) for details on what is +submitted. #### \`audit-level\` diff --git a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index f417d41b6e50e..5836e60f36664 100644 --- a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -235,7 +235,7 @@ All commands: npm bugs [] Options: - [--browser|--browser ] [--registry ] + [--no-browser|--browser ] [--registry ] alias: issues @@ -267,7 +267,7 @@ All commands: npm ci Options: - [--ignore-scripts] [--script-shell ] + [--no-audit] [--ignore-scripts] [--script-shell ] aliases: clean-install, ic, install-clean, isntall-clean @@ -308,9 +308,9 @@ All commands: npm dedupe Options: - [--global-style] [--legacy-bundling] [--strict-peer-deps] [--package-lock] + [--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] [--dry-run] + [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -372,7 +372,7 @@ All commands: npm docs [ [ ...]] Options: - [--browser|--browser ] [--registry ] + [--no-browser|--browser ] [--registry ] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -458,9 +458,9 @@ All commands: npm find-dupes Options: - [--global-style] [--legacy-bundling] [--strict-peer-deps] [--package-lock] + [--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] + [--no-audit] [--no-bin-links] [--no-fund] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -474,7 +474,7 @@ All commands: npm fund [[<@scope>/]] Options: - [--json] [--browser|--browser ] [--unicode] + [--json] [--no-browser|--browser ] [--unicode] [-w|--workspace [-w|--workspace ...]] [--which ] @@ -555,9 +555,9 @@ All commands: Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] - [--strict-peer-deps] [--package-lock] + [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] [--dry-run] + [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -573,7 +573,7 @@ All commands: npm install-ci-test Options: - [--ignore-scripts] [--script-shell ] + [--no-audit] [--ignore-scripts] [--script-shell ] alias: cit @@ -598,9 +598,9 @@ All commands: Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] - [--strict-peer-deps] [--package-lock] + [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] [--dry-run] + [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -619,9 +619,9 @@ All commands: Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] - [--strict-peer-deps] [--package-lock] + [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] - [--audit] [--bin-links] [--fund] [--dry-run] + [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -841,7 +841,7 @@ All commands: npm rebuild [[<@scope>/][@] ...] Options: - [-g|--global] [--bin-links] [--ignore-scripts] + [-g|--global] [--no-bin-links] [--ignore-scripts] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -857,7 +857,7 @@ All commands: npm repo [ [ ...]] Options: - [--browser|--browser ] + [--no-browser|--browser ] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -911,7 +911,7 @@ All commands: npm search [search terms ...] Options: - [-l|--long] [--json] [--color|--color ] [-p|--parseable] + [-l|--long] [--json] [--color|--no-color|--color always] [-p|--parseable] [--no-description] [--searchopts ] [--searchexclude ] [--registry ] [--prefer-online] [--prefer-offline] [--offline] @@ -1094,8 +1094,8 @@ All commands: Options: [-g|--global] [--global-style] [--legacy-bundling] [--strict-peer-deps] - [--package-lock] [--omit [--omit ...]] - [--ignore-scripts] [--audit] [--bin-links] [--fund] [--dry-run] + [--no-package-lock] [--omit [--omit ...]] + [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] @@ -1111,7 +1111,7 @@ All commands: npm version [ | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] Options: - [--allow-same-version] [--commit-hooks] [--git-tag-version] [--json] + [--allow-same-version] [--no-commit-hooks] [--no-git-tag-version] [--json] [--preid prerelease-id] [--sign-git-tag] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] diff --git a/test/lib/utils/config/definition.js b/test/lib/utils/config/definition.js index 45f4c977a77a0..a17a1a09a2240 100644 --- a/test/lib/utils/config/definition.js +++ b/test/lib/utils/config/definition.js @@ -95,6 +95,13 @@ t.test('basic definition', async t => { description: 'test description', }) t.equal(hasShort.usage, '-t|--key ') + const multiHasShort = new Definition('key', { + default: 'test default', + short: 't', + type: [null, String], + description: 'test description', + }) + t.equal(multiHasShort.usage, '-t|--key ') const hardCodedTypes = new Definition('key', { default: 'test default', type: ['string1', 'string2'],