command.addHelpOption.test.js
This file
Path
tests/command.addHelpOption.test.js
41 lines · 1.3 KiB · JavaScript
Last changed by
Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
History of this fileTake it
Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 1–4why, one step back1const { Option } = require('../');2const { createTestCommand } = require('./testHelpers');3const { test, describe } = require('node:test');4const assert = require('node:assert/strict');Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 5–7why, one step back56// More complete tests are in command.helpOption.test.js.7Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 8why, one step back8describe('Command.addHelpOption()', () => {Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 9why, one step back9 test('when addHelpOption has custom flags then custom short flag invokes help', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 10–11why, one step back10 const program = createTestCommand();11 program.addHelpOption(new Option('-c,--custom-help'));Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 12why, one step back12Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 13–18why, one step back13 assert.throws(14 () => {15 program.parse(['-c'], { from: 'user' });16 },17 { message: '(outputHelp)' },18 );Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 19–21why, one step back19 });2021 test('when addHelpOption has custom flags then custom long flag invokes help', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 22–23why, one step back22 const program = createTestCommand();23 program.addHelpOption(new Option('-c,--custom-help'));Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 24why, one step back24Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 25–30why, one step back25 assert.throws(26 () => {27 program.parse(['--custom-help'], { from: 'user' });28 },29 { message: '(outputHelp)' },30 );Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 31–33why, one step back31 });3233 test('when addHelpOption with hidden help option then help does not include help option', () => {Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 34why, one step back34 const program = createTestCommand();Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 35–37why, one step back35 program.addHelpOption(36 new Option('-c,--custom-help', 'help help help').hideHelp(),37 );Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
line 38why, one step back38 const helpInfo = program.helpInformation();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 39why, one step back39 assert.doesNotMatch(helpInfo, /help/);Merge pull request #2140 from tj/release/12.xJohn Geebefore adoptione3192a1
lines 40–41why, one step back40 });41});