Skip to content
Myr

argument.required.test.js

This file

Path

tests/argument.required.test.js

38 lines · 1.3 KiB · JavaScript

Last changed by

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

History of this file

Take 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 back
1import * as commander 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–7why, one step back
4
5// Low-level tests of setting Argument.required.6// Higher level tests of optional/required arguments elsewhere.7

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 8–12why, one step back
8describe('Argument required/optional', () => {
9 test('when name with surrounding <> then argument required', () => {10 const argument = new commander.Argument('<name>');11 assert.equal(argument.required, true);12 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 13why, one step back
13

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 14–17why, one step back
14 test('when name with surrounding [] then argument optional', () => {
15 const argument = new commander.Argument('[name]');16 assert.equal(argument.required, false);17 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 18why, one step back
18

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 19–23why, one step back
19 test('when name without surrounding brackets then argument required', () => {
20 // default behaviour, allowed from Commander 821 const argument = new commander.Argument('name');22 assert.equal(argument.required, true);23 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 24why, one step back
24

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 25–30why, one step back
25 test('when call .argRequired() then argument required', () => {
26 const argument = new commander.Argument('name');27 argument.required = false;28 argument.argRequired();29 assert.equal(argument.required, true);30 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 31why, one step back
31

Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795

lines 32–37why, one step back
32 test('when call .argOptional() then argument optional', () => {
33 const argument = new commander.Argument('name');34 argument.required = true;35 argument.argOptional();36 assert.equal(argument.required, false);37 });

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 38why, one step back
38});