command.createHelp.test.js
This file
Path
tests/command.createHelp.test.js
18 lines · 436 bytes · JavaScript
Last changed by
Refactor help internals into separate interface/class (#1365)John Geebefore adoption19ae912
History of this fileTake it
12345678910111213141516171819const commander = require('../');
test('when override createCommand then affects help', () => { class MyHelp extends commander.Help { formatHelp(cmd, helper) { return 'custom'; } }
class MyCommand extends commander.Command { createHelp() { return Object.assign(new MyHelp(), this.configureHelp()); }; }
const program = new MyCommand(); expect(program.helpInformation()).toEqual('custom');});