MCPcopy
hub / github.com/tj/commander.js / makeProgram

Function makeProgram

tests/command.default.test.js:31–41  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

29
30describe('default action command', () => {
31 function makeProgram(t) {
32 const program = new commander.Command();
33 const actionMock = t.mock.fn();
34 program.command('other');
35 program
36 .command('default', { isDefault: true })
37 .allowUnknownOption()
38 .allowExcessArguments()
39 .action(actionMock);
40 return { program, actionMock };
41 }
42
43 test('when default subcommand and no command then call default', (t) => {
44 const { program, actionMock } = makeProgram(t);

Callers 1

Calls 5

commandMethod · 0.95
addCommandMethod · 0.95
actionMethod · 0.80
allowExcessArgumentsMethod · 0.80
allowUnknownOptionMethod · 0.80

Tested by

no test coverage detected