command.usage.test.js
This file
Path
tests/command.usage.test.js
92 lines · 2.8 KiB · JavaScript
Last changed by
Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
History of this fileTake it
The walk stopped after 200 commits: lines older than 3103c6b point at it.
Add more tests for implies (#1730)John Geebefore adoption3103c6b
line 1why, one step back1const commander = require('../');Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 2why, one step back2const { test, describe } = require('node:test');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 3why, one step back3const assert = require('node:assert/strict');Add more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
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 more tests for implies (#1730)John Geebefore adoption3103c6b
line 92why, one step back92});