Skip to content
Myr

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 file

Take it

The walk stopped after 200 commits: lines older than cc2db5b point at it.

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 1–5why, one step back
1const commander = require('../');
23test('when call nested subcommand then runs', () => {4 const program = new commander.Command();5 const leafAction = jest.fn();

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

line 6why, one step back
6 program.command('sub1').command('sub2').action(leafAction);

Add optional summary for short form of subcommand description. (#1726)John Geebefore adoptioncc2db5b

lines 7–9why, one step back
7 program.parse('node test.js sub1 sub2'.split(' '));
8 expect(leafAction).toHaveBeenCalled();9});