Skip to content
Myr

command.executableSubcommand.test.js

This file

Path

tests/command.executableSubcommand.test.js

17 lines · 643 bytes · JavaScript

Last changed by

Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4

History of this file

Take it

Move to Jest as testing framework (#1035)John Geebefore adoptiond7f9cd4

lines 1–17why, 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 missing then display help', () => {7 // Optional. Suppress normal output to keep test output clean.8 const writeSpy = jest.spyOn(process.stdout, 'write').mockImplementation(() => { });9 const program = new commander.Command();10 program11 ._exitOverride((err) => { throw err; })12 .command('install', 'install description');13 expect(() => {14 program.parse(['node', 'test']);15 }).toThrow('(outputHelp)');16 writeSpy.mockClear();17});