Skip to content

Commit

Permalink
test: add test demonstrating how to set custom description and aliase…
Browse files Browse the repository at this point in the history
…s for help/version
  • Loading branch information
OsmanAltun authored Apr 11, 2021
1 parent b71254f commit ecbc037
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/usage.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4503,4 +4503,23 @@ describe('usage tests', () => {
}
});
});

// Refs: https://github.com/yargs/yargs/issues/1820
it('allows setting help and version with aliases and custom description', () => {
const r = checkUsage(() =>
yargs('--help')
.describe('help', 'Custom help description')
.describe('version', 'Custom version description')
.alias('help', 'h')
.alias('v', 'version')
.parse()
);
r.logs[0]
.split('\n')
.should.deep.equal([
'Options:',
' -h, --help Custom help description [boolean]',
' -v, --version Custom version description [boolean]',
]);
});
});

0 comments on commit ecbc037

Please sign in to comment.