From 98efadeb4b2ae9289f14ed6f42a169230faf7239 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 23 Mar 2021 10:28:37 -0700 Subject: [PATCH] fix(audit-level): add `info` audit level This is a valid level but wasn't configured to be allowed. Also added this param to the usage output for `npm audit` PR-URL: https://github.com/npm/cli/pull/2923 Credit: @wraithgar Close: #2923 Reviewed-by: @ruyadorno --- lib/audit.js | 1 + lib/utils/config/definitions.js | 2 +- tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js | 2 +- tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/audit.js b/lib/audit.js index f990e1fa5efaa..9df2698589278 100644 --- a/lib/audit.js +++ b/lib/audit.js @@ -18,6 +18,7 @@ class Audit extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { return [ + 'audit-level', 'dry-run', 'force', 'json', diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index b8e021c5212bf..e8cdbec3e1d52 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -220,7 +220,7 @@ define('audit', { define('audit-level', { default: null, - type: ['low', 'moderate', 'high', 'critical', 'none', null], + type: ['info', 'low', 'moderate', 'high', 'critical', 'none', null], description: ` The minimum level of vulnerability for \`npm audit\` to exit with a non-zero exit code. diff --git a/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js b/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js index 8af8c1edd3e52..cfb34dfadb697 100644 --- a/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js @@ -64,7 +64,7 @@ registry and all registries configured for scopes. See the documentation for #### \`audit-level\` * Default: null -* Type: "low", "moderate", "high", "critical", "none", or null +* Type: "info", "low", "moderate", "high", "critical", "none", or null The minimum level of vulnerability for \`npm audit\` to exit with a non-zero exit code. diff --git a/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js b/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js index 260e2ab8f8d50..5a860bd2ee554 100644 --- a/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js @@ -204,7 +204,7 @@ All commands: npm audit [fix] Options: - [--dry-run] [-f|--force] [--json] [--package-lock-only] [--production] + [--audit-level ] [--dry-run] [-f|--force] [--json] [--package-lock-only] [--production] Run "npm help audit" for more info