Skip to content

Commit

Permalink
fix: really load all commands in tests, add description to birthday
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored and lukekarrys committed Mar 28, 2022
1 parent 45dd8b8 commit a64acc0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/commands/birthday.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 21 additions & 0 deletions tap-snapshots/test/lib/load-all-commands.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <text>
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
Expand Down
7 changes: 4 additions & 3 deletions test/lib/load-all-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit a64acc0

Please sign in to comment.