command.usage.test.js
This file
Path
tests/command.usage.test.js
92 lines · 2.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
line 4why, one step back4Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 5–7why, one step back5describe('command Usage section in help', () => {6 test('when default usage and check program help then starts with default usage', () => {7 const program = new commander.Command();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 8why, one step back8Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 9–10why, one step back9 program.name('test');10 const helpInformation = program.helpInformation();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 11why, one step back11Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 12–13why, one step back12 assert.match(helpInformation, /^Usage: test \[options\]/);13 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 14why, one step back14Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 15–18why, one step back15 test('when custom usage and check program help then starts with custom usage', () => {16 const myUsage = 'custom';17 const program = new commander.Command();18 program.usage(myUsage);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 19why, one step back19Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 20–21why, one step back20 program.name('test');21 const helpInformation = program.helpInformation();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 22why, one step back22Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 23–24why, one step back23 assert.match(helpInformation, new RegExp(`^Usage: test ${myUsage}`));24 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 25why, one step back25Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 26–28why, one step back26 test('when default usage and check subcommand help then starts with default usage including program name', () => {27 const program = new commander.Command();28 const subCommand = program.command('info');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 29why, one step back29Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 30–31why, one step back30 program.name('test');31 const helpInformation = subCommand.helpInformation();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 32why, one step back32Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 33–34why, one step back33 assert.match(helpInformation, /^Usage: test info \[options\]/);34 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 35why, one step back35Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 36–39why, one step back36 test('when custom usage and check subcommand help then starts with custom usage including program name', () => {37 const myUsage = 'custom';38 const program = new commander.Command();39 const subCommand = program.command('info').usage(myUsage);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 40why, one step back40Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 41–42why, one step back41 program.name('test');42 const helpInformation = subCommand.helpInformation();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 43why, one step back43Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 44–45why, one step back44 assert.match(helpInformation, new RegExp(`^Usage: test info ${myUsage}`));45 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 46why, one step back46Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 47–48why, one step back47 test('when has option then [options] included in usage', () => {48 const program = new commander.Command();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 49why, one step back49Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 50why, one step back50 program.option('--foo');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 51why, one step back51Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 52–53why, one step back52 assert.match(program.usage(), /\[options\]/);53 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 54why, one step back54Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 55–56why, one step back55 test('when no options then [options] not included in usage', () => {56 const program = new commander.Command();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 57why, one step back57Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 58why, one step back58 program.helpOption(false);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 59why, one step back59Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 60–61why, one step back60 assert.doesNotMatch(program.usage(), /\[options\]/);61 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 62why, one step back62Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 63–64why, one step back63 test('when has command then [command] included in usage', () => {64 const program = new commander.Command();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 65why, one step back65Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 66why, one step back66 program.command('foo');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 67why, one step back67Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 68–69why, one step back68 assert.match(program.usage(), /\[command\]/);69 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 70why, one step back70Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 71–72why, one step back71 test('when no commands then [command] not included in usage', () => {72 const program = new commander.Command();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 73why, one step back73Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 74–75why, one step back74 assert.doesNotMatch(program.usage(), /\[command\]/);75 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 76why, one step back76Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 77–78why, one step back77 test('when argument then argument included in usage', () => {78 const program = new commander.Command();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 79why, one step back79Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 80why, one step back80 program.argument('<file>');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 81why, one step back81Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 82–83why, one step back82 assert.match(program.usage(), /<file>/);83 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 84why, one step back84Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 85–86why, one step back85 test('when options and command and argument then all three included in usage', () => {86 const program = new commander.Command();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 87why, one step back87Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 88why, one step back88 program.argument('<file>').option('--alpha').command('beta');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 89why, one step back89Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
lines 90–91why, one step back90 assert.equal(program.usage(), '[options] [command] <file>');91 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 92why, one step back92});