command.commandHelp.test.js
This file
Path
tests/command.commandHelp.test.js
19 lines · 668 bytes · JavaScript
Last changed by
Parse rework for nested commands (#1149)John Geebefore adoption1345f98
History of this fileTake it
Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4
lines 1–9why, one step back1const commander = require('../');23// Note: .commandHelp is not currently documented in the README. This is a ported legacy test.45test('when program has command then appears in commandHelp', () => {6 const program = new commander.Command();7 program8 .command('bare');9 const commandHelp = program.commandHelp();Parse rework for nested commands (#1149)John Geebefore adoption1345f98
line 10why, one step back10 expect(commandHelp).toMatch(/Commands:\n +bare\n/);Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4
lines 11–17why, one step back11});1213test('when program has command with optional arg then appears in commandHelp', () => {14 const program = new commander.Command();15 program16 .command('bare [bare-arg]');17 const commandHelp = program.commandHelp();Parse rework for nested commands (#1149)John Geebefore adoption1345f98
line 18why, one step back18 expect(commandHelp).toMatch(/Commands:\n +bare \[bare-arg\]\n/);Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4
line 19why, one step back19});