Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-03-24 23:23:02 +0300
committerGitHub <noreply@github.com>2022-03-24 23:23:02 +0300
commit716a07fde7905bb69e4c6f1991bb7289589a6669 (patch)
treea415c2acb0c4a08cc4338dcf17a0cdc6fda18680 /scripts
parent6dd1139c9f302ac71f47a75e70bbe9cdf2e64960 (diff)
fix: 100% coverage in tests (#4607)
* fix: 100% coverage in tests * Removed dead code in `lib/utils/usage.js`. * Removed dead code in `lib/base-command.js`. * Removed "load-all" test, we currently have 100% coverage and new PRs without tests will be rejected if they don't add coverage for new files. * Removed `check-coverage` script as a separate command. * Removed separate coverage test in ci.yml. * Removed `coverage` flag from tap config, the default is already to enforce 100% coverage. Removed a tiny bit of dead code resulting from this * fix: clean up usage output Removed usage lib, rolled logic into base-command.js Cleaned up usage output to be less redundant
Diffstat (limited to 'scripts')
-rw-r--r--scripts/config-doc-command.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/config-doc-command.js b/scripts/config-doc-command.js
index af008b7e1..efc831561 100644
--- a/scripts/config-doc-command.js
+++ b/scripts/config-doc-command.js
@@ -1,5 +1,5 @@
const { definitions } = require('../lib/utils/config/index.js')
-const usageFn = require('../lib/utils/usage.js')
+const cmdAliases = require('../lib/utils/cmd-list').aliases
const { writeFileSync, readFileSync } = require('fs')
const { resolve } = require('path')
@@ -52,9 +52,19 @@ const describeUsage = ({ usage }) => {
synopsis.push(usage.map(usageInfo => `${baseCommand} ${usageInfo}`).join('\n'))
}
- const aliases = usageFn(commandName, '').trim()
- if (aliases) {
- synopsis.push(`\n${aliases}`)
+ const aliases = Object.keys(cmdAliases).reduce((p, c) => {
+ if (cmdAliases[c] === commandName) {
+ p.push(c)
+ }
+ return p
+ }, [])
+
+ if (aliases.length === 1) {
+ synopsis.push('')
+ synopsis.push(`alias: ${aliases[0]}`)
+ } else if (aliases.length > 1) {
+ synopsis.push('')
+ synopsis.push(`aliases: ${aliases.join(', ')}`)
}
}
} else {