Skip to content
Myr

command.nested.test.js

This file

Path

tests/command.nested.test.js

12 lines · 340 bytes · JavaScript

Last changed by

Parse rework for nested commands (#1149)John Geebefore adoption1345f98

History of this file

Take it

Parse rework for nested commands (#1149)John Geebefore adoption1345f98

lines 1–12why, one step back
1const commander = require('../');
23test('when call nested subcommand then runs', () => {4 const program = new commander.Command();5 const leafAction = jest.fn();6 program7 .command('sub1')8 .command('sub2')9 .action(leafAction);10 program.parse('node test.js sub1 sub2'.split(' '));11 expect(leafAction).toHaveBeenCalled();12});