command.allowExcessArguments.test.js
This file
Path
tests/command.allowExcessArguments.test.js
115 lines · 3.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 { createTestCommand } from './testHelpers.js';2import { test, describe } from 'node:test';3import assert from 'node:assert/strict';Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 4–6why, one step back45// Not testing output, just testing whether an error is detected.6Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 7why, one step back7describe('Command.allowExcessArguments()', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 8–12why, one step back8 const cases = [true, false];9 cases.forEach((hasActionHandler) => {10 describe(`when ${hasActionHandler ? 'has' : 'no'} action handler`, () => {11 function configureCommand(cmd) {12 if (hasActionHandler) cmd.action(() => {});Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 13why, one step back13 }Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 14why, one step back14Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 15–17why, one step back15 test('when specify excess program argument then error by default', () => {16 const program = createTestCommand();17 configureCommand(program);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 18why, one step back18Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 19–22why, one step back19 assert.throws(() => {20 program.parse(['excess'], { from: 'user' });21 });22 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 23why, one step back23Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 24–27why, one step back24 test('when specify excess program argument and allowExcessArguments(false) then error', () => {25 const program = createTestCommand();26 configureCommand(program);27 program.allowExcessArguments(false);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 28why, one step back28Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 29–32why, one step back29 assert.throws(() => {30 program.parse(['excess'], { from: 'user' });31 });32 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 33why, one step back33Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 34–37why, one step back34 test('when specify excess program argument and allowExcessArguments() then no error', () => {35 const program = createTestCommand();36 configureCommand(program);37 program.allowExcessArguments();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 38why, one step back38Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 39–42why, one step back39 assert.doesNotThrow(() => {40 program.parse(['excess'], { from: 'user' });41 });42 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 43why, one step back43Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 44–47why, one step back44 test('when specify excess program argument and allowExcessArguments(true) then no error', () => {45 const program = createTestCommand();46 configureCommand(program);47 program.allowExcessArguments(true);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 48why, one step back48Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 49–52why, one step back49 assert.doesNotThrow(() => {50 program.parse(['excess'], { from: 'user' });51 });52 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 53why, one step back53Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 54–57why, one step back54 test('when specify excess command argument then error (by default)', () => {55 const program = createTestCommand();56 const sub = program.command('sub');57 configureCommand(sub);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 58why, one step back58Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 59–62why, one step back59 assert.throws(() => {60 program.parse(['sub', 'excess'], { from: 'user' });61 });62 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 63why, one step back63Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 64–67why, one step back64 test('when specify excess command argument and allowExcessArguments(false) then error', () => {65 const program = createTestCommand();66 const sub = program.command('sub').allowExcessArguments(false);67 configureCommand(sub);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 68why, one step back68Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 69–72why, one step back69 assert.throws(() => {70 program.parse(['sub', 'excess'], { from: 'user' });71 });72 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 73why, one step back73Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 74–77why, one step back74 test('when specify expected arg and allowExcessArguments(false) then no error', () => {75 const program = createTestCommand();76 configureCommand(program);77 program.argument('<file>').allowExcessArguments(false);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 78why, one step back78Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 79–82why, one step back79 assert.doesNotThrow(() => {80 program.parse(['file'], { from: 'user' });81 });82 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 83why, one step back83Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 84–87why, one step back84 test('when specify excess after <arg> and allowExcessArguments(false) then error', () => {85 const program = createTestCommand();86 configureCommand(program);87 program.argument('<file>').allowExcessArguments(false);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 88why, one step back88Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 89–92why, one step back89 assert.throws(() => {90 program.parse(['file', 'excess'], { from: 'user' });91 });92 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 93why, one step back93Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 94–97why, one step back94 test('when specify excess after [arg] and allowExcessArguments(false) then error', () => {95 const program = createTestCommand();96 configureCommand(program);97 program.argument('[file]').allowExcessArguments(false);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 98why, one step back98Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 99–102why, one step back99 assert.throws(() => {100 program.parse(['file', 'excess'], { from: 'user' });101 });102 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 103why, one step back103Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 104–107why, one step back104 test('when specify args for [args...] and allowExcessArguments(false) then no error', () => {105 const program = createTestCommand();106 configureCommand(program);107 program.argument('[files...]').allowExcessArguments(false);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 108why, one step back108Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 109–112why, one step back109 assert.doesNotThrow(() => {110 program.parse(['file1', 'file2', 'file3'], { from: 'user' });111 });112 });Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 113why, one step back113 });Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 114–115why, one step back114 });115});