command.alias.test.js
This file
Path
tests/command.alias.test.js
22 lines · 655 bytes · JavaScript
Last changed by
Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4
History of this fileTake it
1234567891011121314151617181920212223const commander = require('../');
// Running alias commands is tested in command.executableSubcommand.lookup.test.js// Test various other behaviours for .alias
test('when command has alias then appears in help', () => { const program = new commander.Command(); program .command('info [thing]') .alias('i'); const helpInformation = program.helpInformation(); expect(helpInformation).toMatch('info|i');});
test('when command = alias then error', () => { const program = new commander.Command(); expect(() => { program .command('fail') .alias('fail'); }).toThrow("Command alias can't be the same as its name");});