Skip to content
Myr

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 file

Take it

Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4

lines 1–22why, one step back
1const commander = require('../');
23// Running alias commands is tested in command.executableSubcommand.lookup.test.js4// Test various other behaviours for .alias56test('when command has alias then appears in help', () => {7 const program = new commander.Command();8 program9 .command('info [thing]')10 .alias('i');11 const helpInformation = program.helpInformation();12 expect(helpInformation).toMatch('info|i');13});1415test('when command = alias then error', () => {16 const program = new commander.Command();17 expect(() => {18 program19 .command('fail')20 .alias('fail');21 }).toThrow("Command alias can't be the same as its name");22});