Skip to content
Myr

help.subcommandDescription.test.js

This file

Path

tests/help.subcommandDescription.test.js

39 lines · 1.5 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 { test, describe } from 'node:test';
2import assert from 'node:assert/strict';3import * as commander from '../index.js';

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.subcommandDescription()', () => {

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 9–11why, one step back
9 test('when program has no summary or description then empty string', () => {
10 const program = new commander.Command();11 const helper = new commander.Help();

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

line 12why, one step back
12 assert.equal(helper.subcommandDescription(program), '');

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 13–19why, one step back
13 });
1415 test('when program has summary then return summary', () => {16 const summary = 'summary';17 const program = new commander.Command();18 program.summary(summary);19 const helper = new commander.Help();

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

line 20why, one step back
20 assert.equal(helper.subcommandDescription(program), summary);

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 21–27why, one step back
21 });
2223 test('when program has description then return description', () => {24 const description = 'description';25 const program = new commander.Command();26 program.description(description);27 const helper = new commander.Help();

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

line 28why, one step back
28 assert.equal(helper.subcommandDescription(program), description);

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 29–36why, one step back
29 });
3031 test('when program has summary and description then return summary', () => {32 const summary = 'summary';33 const program = new commander.Command();34 program.summary(summary);35 program.description('description');36 const helper = new commander.Help();

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

line 37why, one step back
37 assert.equal(helper.subcommandDescription(program), summary);

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

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