command.allowUnknownOption.test.js
This file
Path
tests/command.allowUnknownOption.test.js
79 lines · 2.3 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.allowUnknownOption()', () => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 8why, one step back8 test('when specify unknown program option then error', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 9–10why, one step back9 const program = createTestCommand();10 program.option('-p, --pepper', 'add pepper');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 11why, one step back11Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 12why, one step back12 assert.throws(() => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 13why, one step back13 program.parse(['node', 'test', '-m']);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 14why, one step back14 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 15–17why, one step back15 });1617 test('when specify unknown program option and allowUnknownOption(false) then error', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 18–19why, one step back18 const program = createTestCommand();19 program.allowUnknownOption(false).option('-p, --pepper', 'add pepper');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 20why, one step back20Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 21why, one step back21 assert.throws(() => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 22why, one step back22 program.parse(['node', 'test', '-m']);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 23why, one step back23 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 24–26why, one step back24 });2526 test('when specify unknown program option and allowUnknownOption() then no error', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 27why, one step back27 const program = createTestCommand();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 28why, one step back28 programSwitch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 29why, one step back29Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 30why, one step back30 .allowUnknownOption()Disallow excess arguments (#2223)John Geebefore adoption58c28eb
line 31why, one step back31 .argument('[args...]') // unknown option will be passed as an argumentAdd copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 32–33why, one step back32 .option('-p, --pepper', 'add pepper');33Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 34why, one step back34 assert.doesNotThrow(() => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 35why, one step back35 program.parse(['node', 'test', '-m']);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 36why, one step back36 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 37–39why, one step back37 });3839 test('when specify unknown program option and allowUnknownOption(true) then no error', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 40why, one step back40 const program = createTestCommand();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 41why, one step back41 programSwitch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 42why, one step back42Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 43why, one step back43 .allowUnknownOption(true)Disallow excess arguments (#2223)John Geebefore adoption58c28eb
line 44why, one step back44 .argument('[args...]') // unknown option will be passed as an argumentAdd copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 45–46why, one step back45 .option('-p, --pepper', 'add pepper');46Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 47why, one step back47 assert.doesNotThrow(() => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 48why, one step back48 program.parse(['node', 'test', '-m']);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 49why, one step back49 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 50–52why, one step back50 });5152 test('when specify unknown command option then error', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 53why, one step back53 const program = createTestCommand();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 54why, one step back54 programSwitch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 55why, one step back55Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 56–57why, one step back56 .command('sub')57 .option('-p, --pepper', 'add pepper')Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 58why, one step back58 .action(() => {});Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 59why, one step back59Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 60why, one step back60 assert.throws(() => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 61why, one step back61 program.parse(['node', 'test', 'sub', '-m']);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 62why, one step back62 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 63–65why, one step back63 });6465 test('when specify unknown command option and allowUnknownOption then no error', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 66why, one step back66 const program = createTestCommand();Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 67why, one step back67 programSwitch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 68why, one step back68Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 69–72why, one step back69 .command('sub')70 .argument('[args...]') // unknown option will be passed as an argument71 .allowUnknownOption()72 .option('-p, --pepper', 'add pepper')Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 73why, one step back73 .action(() => {});Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 74why, one step back74Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 75why, one step back75 assert.doesNotThrow(() => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 76why, one step back76 program.parse(['node', 'test', 'sub', '-m']);Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 77why, one step back77 });Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 78–79why, one step back78 });79});