Skip to content
Myr

Include tests for supplying optional param to .hideHelp (#1372)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by John Gee · committed by GitHub · parent b4fbe67 · Browse files · 2 files+21 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+21 added−4 removed

  • tests:+17 added−1 removed
  • other:+4 added−3 removed

2 files+21 added−4 removed

modified:tests/command.help.test.js+17 added-1 removed
161 unmodified lines
162 const helpInformation = program.helpInformation();163 expect(helpInformation).not.toMatch('Options');164});165166test('when option hidden then option not included in helpInformation', () => {166test('when option.hideHelp() then option not included in helpInformation', () => {167 const program = new commander.Command();168 program169 .addOption(new commander.Option('-s,--secret', 'secret option').hideHelp());170 const helpInformation = program.helpInformation();171 expect(helpInformation).not.toMatch('secret');172});173174test('when option.hideHelp(true) then option not included in helpInformation', () => {175 const program = new commander.Command();176 program177 .addOption(new commander.Option('-s,--secret', 'secret option').hideHelp(true));178 const helpInformation = program.helpInformation();179 expect(helpInformation).not.toMatch('secret');180});181182test('when option.hideHelp(false) then option included in helpInformation', () => {183 const program = new commander.Command();184 program185 .addOption(new commander.Option('-s,--secret', 'secret option').hideHelp(false));186 const helpInformation = program.helpInformation();187 expect(helpInformation).toMatch('secret');188});189190test('when option has default value then default included in helpInformation', () => {191 const program = new commander.Command();192 program193 .option('-p, --port <portNumber>', 'port number', 80);
46 unmodified lines
modified:typings/commander-tests.ts+4 added-3 removed
262 unmodified lines
263const myOptionThis5: commander.Option = baseOption.makeOptionMandatory();264const myOptionThis6: commander.Option = baseOption.makeOptionMandatory(true);265266// hideHelp267const myOptionThis7: commander.Option = baseOption.hideHelp();268const myOptionThis8: commander.Option = baseOption.hideHelp(true);267const hideHelpThis1: commander.Option = baseOption.hideHelp();268const hideHelpThis2: commander.Option = baseOption.hideHelp(true);269const hideHelpThis3: commander.Option = baseOption.hideHelp(false);270271// argumentRejected272function goodbye(): never {273 return baseOption.argumentRejected('failed');274};275276// choices276const myOptionThis9: commander.Option = baseOption.choices(['a', 'b']);277const choicesThis: commander.Option = baseOption.choices(['a', 'b']);278279// name280const optionName: string = baseOption.name();