command.createHelp.test.js
This file
Path
tests/command.createHelp.test.js
22 lines · 622 bytes · JavaScript
Last changed by
Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
History of this fileTake it
1234567891011121314151617181920212223const commander = require('../');const { test, describe } = require('node:test');const assert = require('node:assert/strict');
describe('Command.createHelp() override in subclass', () => { 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(); assert.equal(program.helpInformation(), 'custom'); });});