command.chain.test.js
This file
Path
tests/command.chain.test.js
280 lines · 9.1 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 { Command, Option, Argument } 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–11why, one step back45// Testing the functions which should chain.6// parse and parseAsync are tested in command.parse.test.js78describe('Command methods that should return this for chaining', () => {9 test('when call .command() with description for stand-alone executable then returns this', () => {10 const program = new Command();11 const result = program.command('foo', 'foo description');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 12why, one step back12 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 13–17why, one step back13 });1415 test('when call .addCommand() then returns this', () => {16 const program = new Command();17 const result = program.addCommand(new Command('name'));Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 18why, one step back18 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 19–23why, one step back19 });2021 test('when call .argument() then returns this', () => {22 const program = new Command();23 const result = program.argument('<file>');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 24why, one step back24 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 25–29why, one step back25 });2627 test('when call .addArgument() then returns this', () => {28 const program = new Command();29 const result = program.addArgument(new Argument('<file>'));Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 30why, one step back30 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 31–35why, one step back31 });3233 test('when set .arguments() then returns this', () => {34 const program = new Command();35 const result = program.arguments('<file>');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 36why, one step back36 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 37–38why, one step back37 });38Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 39why, one step back39 test('when call .addHelpCommand(cmd) then returns this', () => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 40why, one step back40 const program = new Command();Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 41why, one step back41 const result = program.addHelpCommand(new Command('assist'));Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 42why, one step back42 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 43–44why, one step back43 });44Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 45–47why, one step back45 test('when call deprecated .addHelpCommand() then returns this', () => {46 const program = new Command();47 const result = program.addHelpCommand();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 48why, one step back48 assert.equal(result, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 49–53why, one step back49 });5051 test('when call deprecated .addHelpCommand(boolean) then returns this', () => {52 const program = new Command();53 const result1 = program.addHelpCommand(true);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 54why, one step back54 assert.equal(result1, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 55why, one step back55 const result2 = program.addHelpCommand(false);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 56why, one step back56 assert.equal(result2, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 57–61why, one step back57 });5859 test('when call deprecated .addHelpCommand(string[, string]) then returns this', () => {60 const program = new Command();61 const result1 = program.addHelpCommand('assist');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 62why, one step back62 assert.equal(result1, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 63why, one step back63 const result2 = program.addHelpCommand('assist', 'assist description');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 64why, one step back64 assert.equal(result2, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 65–69why, one step back65 });6667 test('when call .helpCommand(name) then returns this', () => {68 const program = new Command();69 const result = program.helpCommand();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 70why, one step back70 assert.equal(result, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 71–75why, one step back71 });7273 test('when call .helpCommand(name, description) then returns this', () => {74 const program = new Command();75 const result1 = program.helpCommand('assist', 'assist description');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 76why, one step back76 assert.equal(result1, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 77–81why, one step back77 });7879 test('when call .helpCommand(boolean) then returns this', () => {80 const program = new Command();81 const result1 = program.helpCommand(true);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 82why, one step back82 assert.equal(result1, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 83why, one step back83 const result2 = program.helpCommand(false);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 84why, one step back84 assert.equal(result2, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 85–86why, one step back85 });86Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 87–88why, one step back87 test('when call .exitOverride() then returns this', () => {88 const program = new Command();Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 89why, one step back89 const result = program.exitOverride(() => {});Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 90why, one step back90 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 91–94why, one step back91 });9293 test('when call .action() then returns this', () => {94 const program = new Command();Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 95why, one step back95 const result = program.action(() => {});Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 96why, one step back96 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 97–101why, one step back97 });9899 test('when call .addOption() then returns this', () => {100 const program = new Command();101 const result = program.addOption(new Option('-e'));Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 102why, one step back102 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 103–107why, one step back103 });104105 test('when call .option() then returns this', () => {106 const program = new Command();107 const result = program.option('-e');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 108why, one step back108 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 109–113why, one step back109 });110111 test('when call .requiredOption() then returns this', () => {112 const program = new Command();113 const result = program.requiredOption('-r');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 114why, one step back114 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 115–119why, one step back115 });116117 test('when call .combineFlagAndOptionalValue() then returns this', () => {118 const program = new Command();119 const result = program.combineFlagAndOptionalValue();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 120why, one step back120 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 121–125why, one step back121 });122123 test('when call .allowUnknownOption() then returns this', () => {124 const program = new Command();125 const result = program.allowUnknownOption();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 126why, one step back126 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 127–131why, one step back127 });128129 test('when call .allowExcessArguments() then returns this', () => {130 const program = new Command();131 const result = program.allowExcessArguments();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 132why, one step back132 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 133–137why, one step back133 });134135 test('when call .storeOptionsAsProperties() then returns this', () => {136 const program = new Command();137 const result = program.storeOptionsAsProperties();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 138why, one step back138 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 139–143why, one step back139 });140141 test('when call .version() then returns this', () => {142 const program = new Command();143 const result = program.version('1.2.3');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 144why, one step back144 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 145–149why, one step back145 });146147 test('when set .description() then returns this', () => {148 const program = new Command();149 const result = program.description('description');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 150why, one step back150 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 151–155why, one step back151 });152153 test('when set .alias() then returns this', () => {154 const program = new Command();155 const result = program.alias('alias');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 156why, one step back156 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 157–161why, one step back157 });158159 test('when set .aliases() then returns this', () => {160 const program = new Command();161 const result = program.aliases(['foo', 'bar']);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 162why, one step back162 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 163–167why, one step back163 });164165 test('when set .usage() then returns this', () => {166 const program = new Command();167 const result = program.usage('[options]');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 168why, one step back168 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 169–173why, one step back169 });170171 test('when set .name() then returns this', () => {172 const program = new Command();173 const result = program.name('easy');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 174why, one step back174 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 175–176why, one step back175 });176Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 177why, one step back177 test('when call .helpOption(flags) then returns this', () => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 178why, one step back178 const program = new Command();Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 179–180why, one step back179 const flags = '-h, --help';180 const result = program.helpOption(flags);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 181why, one step back181 assert.equal(result, program);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 182–186why, one step back182 });183184 test('when call .addHelpOption() then returns this', () => {185 const program = new Command();186 const result = program.addHelpOption(new Option('-h, --help'));Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 187why, one step back187 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 188–192why, one step back188 });189190 test('when call .addHelpText() then returns this', () => {191 const program = new Command();192 const result = program.addHelpText('before', 'example');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 193why, one step back193 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 194–197why, one step back194 });195196 test('when call .configureHelp() then returns this', () => {197 const program = new Command();Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 198why, one step back198 const result = program.configureHelp({});Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 199why, one step back199 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 200–203why, one step back200 });201202 test('when call .configureOutput() then returns this', () => {203 const program = new Command();Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 204why, one step back204 const result = program.configureOutput({});Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 205why, one step back205 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 206–210why, one step back206 });207208 test('when call .passThroughOptions() then returns this', () => {209 const program = new Command();210 const result = program.passThroughOptions();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 211why, one step back211 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 212–216why, one step back212 });213214 test('when call .enablePositionalOptions() then returns this', () => {215 const program = new Command();216 const result = program.enablePositionalOptions();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 217why, one step back217 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 218–222why, one step back218 });219220 test('when call .hook() then returns this', () => {221 const program = new Command();222 const result = program.hook('preAction', () => {});Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 223why, one step back223 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 224–228why, one step back224 });225226 test('when call .setOptionValue() then returns this', () => {227 const program = new Command();228 const result = program.setOptionValue('foo', 'bar');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 229why, one step back229 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 230–234why, one step back230 });231232 test('when call .setOptionValueWithSource() then returns this', () => {233 const program = new Command();234 const result = program.setOptionValueWithSource('foo', 'bar', 'cli');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 235why, one step back235 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 236–240why, one step back236 });237238 test('when call .showHelpAfterError() then returns this', () => {239 const program = new Command();240 const result = program.showHelpAfterError();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 241why, one step back241 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 242–246why, one step back242 });243244 test('when call .showSuggestionAfterError() then returns this', () => {245 const program = new Command();246 const result = program.showSuggestionAfterError();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 247why, one step back247 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 248–253why, one step back248 });249250 test('when call .copyInheritedSettings() then returns this', () => {251 const program = new Command();252 const cmd = new Command();253 const result = cmd.copyInheritedSettings(program);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 254why, one step back254 assert.equal(result, cmd);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 255–259why, one step back255 });256257 test('when set .nameFromFilename() then returns this', () => {258 const program = new Command();259 const result = program.nameFromFilename('name');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 260why, one step back260 assert.equal(result, program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 261why, one step back261 });Add support for groups of options and commands in the help (#2328)John Geebefore adoptionc324ea3
lines 262–265why, one step back262263 test('when set .helpGroup(heading) then returns this', () => {264 const program = new Command();265 const result = program.helpGroup('Commands:');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 266why, one step back266 assert.equal(result, program);Add support for groups of options and commands in the help (#2328)John Geebefore adoptionc324ea3
lines 267–271why, one step back267 });268269 test('when set .commandsGroup(heading) then returns this', () => {270 const program = new Command();271 const result = program.commandsGroup('Commands:');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 272why, one step back272 assert.equal(result, program);Add support for groups of options and commands in the help (#2328)John Geebefore adoptionc324ea3
lines 273–277why, one step back273 });274275 test('when set .optionsGroup(heading) then returns this', () => {276 const program = new Command();277 const result = program.optionsGroup('Options:');Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 278why, one step back278 assert.equal(result, program);Add support for groups of options and commands in the help (#2328)John Geebefore adoptionc324ea3
line 279why, one step back279 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 280why, one step back280});