command.commandHelp.test.js
This file
Path
tests/command.commandHelp.test.js
17 lines · 590 bytes · JavaScript
Last changed by
Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
History of this fileTake it
123456789101112131415161718const commander = require('../');
// This is a ported legacy test.
test('when program has command then appears in help', () => { const program = new commander.Command(); program.command('bare'); const commandHelp = program.helpInformation(); expect(commandHelp).toMatch(/Commands:\n +bare\n/);});
test('when program has command with optional arg then appears in help', () => { const program = new commander.Command(); program.command('bare [bare-arg]'); const commandHelp = program.helpInformation(); expect(commandHelp).toMatch(/Commands:\n +bare \[bare-arg\]\n/);});