command.nested.test.js
This file
Path
tests/command.nested.test.js
9 lines · 325 bytes · JavaScript
Last changed by
Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
History of this fileTake it
12345678910const commander = require('../');
test('when call nested subcommand then runs', () => { const program = new commander.Command(); const leafAction = jest.fn(); program.command('sub1').command('sub2').action(leafAction); program.parse('node test.js sub1 sub2'.split(' ')); expect(leafAction).toHaveBeenCalled();});