help.commandTerm.test.js
This file
Path
tests/help.commandTerm.test.js
45 lines · 1.8 KiB · JavaScript
Last changed by
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
History of this fileTake it
The walk stopped after 200 commits: lines older than 471ec40 point at it.
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
lines 1–3why, one step back1import * as commander from '../index.js';2import { test, describe } from 'node:test';3import assert from 'node:assert/strict';Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 4–8why, one step back45// These are tests of the Help class, not of the Command help.6// There is some overlap with the higher level Command tests (which predate Help).78// subcommandTerm does not currently respect helpOption or ignore hidden options, so not testing those.Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 9why, one step back9describe('Help.subcommandTerm()', () => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 10–12why, one step back10 test('when plain command then returns name', () => {11 const command = new commander.Command('program');12 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 13why, one step back13 assert.equal(helper.subcommandTerm(command), 'program');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 14–16why, one step back14 });1516 test('when command has alias then returns name|alias', () => {Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 17why, one step back17 const command = new commander.Command('program').alias('alias');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 18why, one step back18 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 19why, one step back19 assert.equal(helper.subcommandTerm(command), 'program|alias');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 20–22why, one step back20 });2122 test('when command has options then returns name [options]', () => {Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 23why, one step back23 const command = new commander.Command('program').option('-a,--all');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 24why, one step back24 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 25why, one step back25 assert.equal(helper.subcommandTerm(command), 'program [options]');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 26–28why, one step back26 });2728 test('when command has <argument> then returns name <argument>', () => {Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 29why, one step back29 const command = new commander.Command('program').argument('<argument>');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 30why, one step back30 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 31why, one step back31 assert.equal(helper.subcommandTerm(command), 'program <argument>');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 32–39why, one step back32 });3334 test('when command has everything then returns name|alias [options] <argument>', () => {35 const command = new commander.Command('program')36 .alias('alias')37 .option('-a,--all')38 .argument('<argument>');39 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 40–41why, one step back40 assert.equal(41 helper.subcommandTerm(command),Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 42–43why, one step back42 'program|alias [options] <argument>',43 );Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 44–45why, one step back44 });45});