Skip to content
Myr

help.padWidth.test.js

This file

Path

tests/help.padWidth.test.js

47 lines · 1.9 KiB · JavaScript

Last changed by

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

History of this file

Take 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 back
1import * 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–7why, one step back
4
5// 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).7

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

line 8why, one step back
8describe('Help.padWidth()', () => {

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 9–11why, one step back
9 test('when argument term longest return argument length', () => {
10 const longestThing = 'veryLongThingBiggerThanOthers';11 const program = new commander.Command();

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 12–13why, one step back
12 program.argument(`<${longestThing}>`, 'description').option('-o');
13 program.command('sub');

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 14why, one step back
14 const helper = new commander.Help();

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 15why, one step back
15 assert.equal(helper.padWidth(program, helper), longestThing.length);

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 16–20why, one step back
16 });
1718 test('when option term longest return option length', () => {19 const longestThing = '--very-long-thing-bigger-than-others';20 const program = new commander.Command();

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 21–22why, one step back
21 program.argument('<file>', 'desc').option(longestThing);
22 program.command('sub');

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 23why, one step back
23 const helper = new commander.Help();

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 24why, one step back
24 assert.equal(helper.padWidth(program, helper), longestThing.length);

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 25–26why, one step back
25 });
26

Merge branch 'master' into release/10.xJohn Geebefore adoption2bdd631

lines 27–33why, one step back
27 test('when global option term longest return global option length', () => {
28 const longestThing = '--very-long-thing-bigger-than-others';29 const program = new commander.Command();30 program31 .argument('<file>', 'desc')32 .option(longestThing)33 .configureHelp({ showGlobalOptions: true });

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

line 34why, one step back
34 const sub = program.command('sub');

Merge branch 'master' into release/10.xJohn Geebefore adoption2bdd631

line 35why, one step back
35 const helper = sub.createHelp();

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 36why, one step back
36 assert.equal(helper.padWidth(sub, helper), longestThing.length);

Merge branch 'master' into release/10.xJohn Geebefore adoption2bdd631

lines 37–38why, one step back
37 });
38

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 39–41why, one step back
39 test('when command term longest return command length', () => {
40 const longestThing = 'very-long-thing-bigger-than-others';41 const program = new commander.Command();

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 42–43why, one step back
42 program.argument('<file>', 'desc').option('-o');
43 program.command(longestThing);

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 44why, one step back
44 const helper = new commander.Help();

Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086

line 45why, one step back
45 assert.equal(helper.padWidth(program, helper), longestThing.length);

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 46–47why, one step back
46 });
47});