From ecbc0377d8ac0310213788b374a2d5130e053cd4 Mon Sep 17 00:00:00 2001 From: Osman Altun Date: Sun, 11 Apr 2021 05:03:56 +0200 Subject: [PATCH] test: add test demonstrating how to set custom description and aliases for help/version --- test/usage.cjs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/usage.cjs b/test/usage.cjs index 2b672bbea..03221ae3e 100644 --- a/test/usage.cjs +++ b/test/usage.cjs @@ -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]', + ]); + }); });