command.createHelp.test.js
This file
Path
tests/command.createHelp.test.js
22 lines · 620 bytes · JavaScript
Last changed by
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
History of this fileTake it
1234567891011121314151617181920212223import * as commander from '../index.js';import { test, describe } from 'node:test';import assert from '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'); });});