Skip to content

Commit ecbc037

Browse files
authored
test: add test demonstrating how to set custom description and aliases for help/version
1 parent b71254f commit ecbc037

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/usage.cjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4503,4 +4503,23 @@ describe('usage tests', () => {
45034503
}
45044504
});
45054505
});
4506+
4507+
// Refs: https://github.com/yargs/yargs/issues/1820
4508+
it('allows setting help and version with aliases and custom description', () => {
4509+
const r = checkUsage(() =>
4510+
yargs('--help')
4511+
.describe('help', 'Custom help description')
4512+
.describe('version', 'Custom version description')
4513+
.alias('help', 'h')
4514+
.alias('v', 'version')
4515+
.parse()
4516+
);
4517+
r.logs[0]
4518+
.split('\n')
4519+
.should.deep.equal([
4520+
'Options:',
4521+
' -h, --help Custom help description [boolean]',
4522+
' -v, --version Custom version description [boolean]',
4523+
]);
4524+
});
45064525
});

0 commit comments

Comments
 (0)