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 fileTake it
The walk stopped after 200 commits: lines older than 36c2f68 point at it.
Change .action() JSDoc/TSDoc example (#1614)John Geebefore adoption36c2f68
lines 1–7why, one step back1const 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 back8 const writeSpy = jest9 .spyOn(process.stderr, 'write')10 .mockImplementation(() => {});Change .action() JSDoc/TSDoc example (#1614)John Geebefore adoption36c2f68
lines 11–12why, one step back11 const program = new commander.Command();12 programReformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 13–15why, one step back13 .exitOverride((err) => {14 throw err;15 })Change .action() JSDoc/TSDoc example (#1614)John Geebefore adoption36c2f68
lines 16–21why, one step back16 .command('install', 'install description');17 expect(() => {18 program.parse(['node', 'test']);19 }).toThrow('(outputHelp)');20 writeSpy.mockClear();21});