Skip to content
Myr

command.executableSubcommand.test.js

This file

Path

tests/command.executableSubcommand.test.js

21 lines · 678 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–7why, one step back
1const commander = require('../');
23// Executable subcommand tests that didn't fit in elsewhere.45// This is the default behaviour when no default command and no action handlers6test('when no command specified and executable then display help', () => {7 // Optional. Suppress normal output to keep test output clean.

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 8–10why, one step back
8 const writeSpy = jest
9 .spyOn(process.stderr, 'write')10 .mockImplementation(() => {});

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

lines 11–12why, one step back
11 const program = new commander.Command();
12 program

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 13–15why, one step back
13 .exitOverride((err) => {
14 throw err;15 })

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

lines 16–21why, one step back
16 .command('install', 'install description');
17 expect(() => {18 program.parse(['node', 'test']);19 }).toThrow('(outputHelp)');20 writeSpy.mockClear();21});