program.test.js
This file
Path
tests/program.test.js
67 lines · 1.5 KiB · JavaScript
Last changed by
Remove default export of global program (#2017)John Geebefore adoptionc876dee
History of this fileTake it
The walk stopped after 200 commits: lines older than 20cef03 point at it.
Remove default export of global program (#2017)John Geebefore adoptionc876dee
lines 1–13why, one step back1const {2 program,3 Command,4 Option,5 Argument,6 Help,7 CommanderError,8 InvalidArgumentError,9 InvalidOptionArgumentError,10 createCommand,11 createOption,12 createArgument13} = require('../index.js');Update supported details for 7.x (#1419)John Geebefore adoption20cef03
lines 14–15why, one step back1415// Do some testing of the default export(s).Remove default export of global program (#2017)John Geebefore adoptionc876dee
line 16why, one step back16// Similar tests to ts-imports.test.ts and esm-imports-test.js.Update supported details for 7.x (#1419)John Geebefore adoption20cef03
line 17why, one step back17Remove default export of global program (#2017)John Geebefore adoptionc876dee
lines 18–26why, one step back18/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["expect", "checkClass"] }] */1920function checkClass(obj, name) {21 expect(typeof obj).toEqual('object');22 expect(obj.constructor.name).toEqual(name);23}2425test('program', () => {26 checkClass(program, 'Command');Update supported details for 7.x (#1419)John Geebefore adoption20cef03
lines 27–28why, one step back27});28Remove default export of global program (#2017)John Geebefore adoptionc876dee
lines 29–30why, one step back29test('Command', () => {30 checkClass(new Command('name'), 'Command');Update supported details for 7.x (#1419)John Geebefore adoption20cef03
lines 31–32why, one step back31});32Remove default export of global program (#2017)John Geebefore adoptionc876dee
lines 33–66why, one step back33test('Option', () => {34 checkClass(new Option('-e, --example', 'description'), 'Option');35});3637test('Argument', () => {38 checkClass(new Argument('<foo>', 'description'), 'Argument');39});4041test('Help', () => {42 checkClass(new Help(), 'Help');43});4445test('CommanderError', () => {46 checkClass(new CommanderError(1, 'code', 'failed'), 'CommanderError');47});4849test('InvalidArgumentError', () => {50 checkClass(new InvalidArgumentError('failed'), 'InvalidArgumentError');51});5253test('InvalidOptionArgumentError', () => { // Deprecated54 checkClass(new InvalidOptionArgumentError('failed'), 'InvalidArgumentError');55});5657test('createCommand', () => {58 checkClass(createCommand('foo'), 'Command');59});6061test('createOption', () => {62 checkClass(createOption('-e, --example', 'description'), 'Option');63});6465test('createArgument', () => {66 checkClass(createArgument('<foo>', 'description'), 'Argument');Update supported details for 7.x (#1419)John Geebefore adoption20cef03
line 67why, one step back67});