From a64acc0bf01e4bc68b26ead5b2d5c6db47ef16c2 Mon Sep 17 00:00:00 2001 From: Gar Date: Wed, 23 Mar 2022 15:20:51 -0700 Subject: [PATCH] fix: really load all commands in tests, add description to birthday --- lib/commands/birthday.js | 1 + .../test/lib/load-all-commands.js.test.cjs | 21 +++++++++++++++++++ test/lib/load-all-commands.js | 7 ++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/commands/birthday.js b/lib/commands/birthday.js index d8305cf8d582b..c7b5b31c54a62 100644 --- a/lib/commands/birthday.js +++ b/lib/commands/birthday.js @@ -2,6 +2,7 @@ const BaseCommand = require('../base-command.js') class Birthday extends BaseCommand { static name = 'birthday' + static description = 'Birthday' static ignoreImplicitWorkspace = true static isShellout = true 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 66c48983a0ea3..550c596139460 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -68,6 +68,15 @@ Options: Run "npm help bin" for more info ` +exports[`test/lib/load-all-commands.js TAP load each command birthday > must match snapshot 1`] = ` +Birthday + +Usage: +npm birthday + +Run "npm help birthday" for more info +` + exports[`test/lib/load-all-commands.js TAP load each command bugs > must match snapshot 1`] = ` Report bugs for a package in a web browser @@ -348,6 +357,18 @@ alias: hlep Run "npm help help" for more info ` +exports[`test/lib/load-all-commands.js TAP load each command help-search > must match snapshot 1`] = ` +Search npm help documentation + +Usage: +npm help-search + +Options: +[-l|--long] + +Run "npm help help-search" for more info +` + exports[`test/lib/load-all-commands.js TAP load each command hook > must match snapshot 1`] = ` Manage registry hooks diff --git a/test/lib/load-all-commands.js b/test/lib/load-all-commands.js index ec19575291dc1..34773bba04662 100644 --- a/test/lib/load-all-commands.js +++ b/test/lib/load-all-commands.js @@ -5,11 +5,12 @@ const t = require('tap') const util = require('util') const { load: loadMockNpm } = require('../fixtures/mock-npm.js') -const { cmdList } = require('../../lib/utils/cmd-list.js') +const { cmdList, plumbing } = require('../../lib/utils/cmd-list.js') +const allCmds = [...cmdList, ...plumbing] t.test('load each command', async t => { - t.plan(cmdList.length) - for (const cmd of cmdList.sort((a, b) => a.localeCompare(b, 'en'))) { + t.plan(allCmds.length) + for (const cmd of allCmds.sort((a, b) => a.localeCompare(b, 'en'))) { t.test(cmd, async t => { const { npm, outputs } = await loadMockNpm(t, { config: { usage: true },