@@ -6,7 +6,7 @@ const { parseArgs } = require('../index.js');
66
77// Test results are as we expect
88
9- test ( 'when short option used as flag then stored as flag' , function ( t ) {
9+ test ( 'when short option used as flag then stored as flag' , ( t ) => {
1010 const passedArgs = [ '-f' ] ;
1111 const expected = { flags : { f : true } , values : { f : undefined } , positionals : [ ] } ;
1212 const args = parseArgs ( { args : passedArgs } ) ;
@@ -16,7 +16,7 @@ test('when short option used as flag then stored as flag', function(t) {
1616 t . end ( ) ;
1717} ) ;
1818
19- test ( 'when short option used as flag before positional then stored as flag and positional (and not value)' , function ( t ) {
19+ test ( 'when short option used as flag before positional then stored as flag and positional (and not value)' , ( t ) => {
2020 const passedArgs = [ '-f' , 'bar' ] ;
2121 const expected = { flags : { f : true } , values : { f : undefined } , positionals : [ 'bar' ] } ;
2222 const args = parseArgs ( { args : passedArgs } ) ;
@@ -26,7 +26,7 @@ test('when short option used as flag before positional then stored as flag and p
2626 t . end ( ) ;
2727} ) ;
2828
29- test ( 'when short option `type: "string"` used with value then stored as value' , function ( t ) {
29+ test ( 'when short option `type: "string"` used with value then stored as value' , ( t ) => {
3030 const passedArgs = [ '-f' , 'bar' ] ;
3131 const passedOptions = { f : { type : 'string' } } ;
3232 const expected = { flags : { f : true } , values : { f : 'bar' } , positionals : [ ] } ;
@@ -37,7 +37,7 @@ test('when short option `type: "string"` used with value then stored as value',
3737 t . end ( ) ;
3838} ) ;
3939
40- test ( 'when short option listed in short used as flag then long option stored as flag' , function ( t ) {
40+ test ( 'when short option listed in short used as flag then long option stored as flag' , ( t ) => {
4141 const passedArgs = [ '-f' ] ;
4242 const passedOptions = { foo : { short : 'f' } } ;
4343 const expected = { flags : { foo : true } , values : { foo : undefined } , positionals : [ ] } ;
@@ -48,7 +48,7 @@ test('when short option listed in short used as flag then long option stored as
4848 t . end ( ) ;
4949} ) ;
5050
51- test ( 'when short option listed in short and long listed in `type: "string"` and used with value then long option stored as value' , function ( t ) {
51+ test ( 'when short option listed in short and long listed in `type: "string"` and used with value then long option stored as value' , ( t ) => {
5252 const passedArgs = [ '-f' , 'bar' ] ;
5353 const passedOptions = { foo : { short : 'f' , type : 'string' } } ;
5454 const expected = { flags : { foo : true } , values : { foo : 'bar' } , positionals : [ ] } ;
@@ -59,7 +59,7 @@ test('when short option listed in short and long listed in `type: "string"` and
5959 t . end ( ) ;
6060} ) ;
6161
62- test ( 'when short option `type: "string"` used without value then stored as flag' , function ( t ) {
62+ test ( 'when short option `type: "string"` used without value then stored as flag' , ( t ) => {
6363 const passedArgs = [ '-f' ] ;
6464 const passedOptions = { f : { type : 'string' } } ;
6565 const expected = { flags : { f : true } , values : { f : undefined } , positionals : [ ] } ;
@@ -70,7 +70,7 @@ test('when short option `type: "string"` used without value then stored as flag'
7070 t . end ( ) ;
7171} ) ;
7272
73- test ( 'short option group behaves like multiple short options' , function ( t ) {
73+ test ( 'short option group behaves like multiple short options' , ( t ) => {
7474 const passedArgs = [ '-rf' ] ;
7575 const passedOptions = { } ;
7676 const expected = { flags : { r : true , f : true } , values : { r : undefined , f : undefined } , positionals : [ ] } ;
@@ -81,7 +81,7 @@ test('short option group behaves like multiple short options', function(t) {
8181 t . end ( ) ;
8282} ) ;
8383
84- test ( 'short option group does not consume subsequent positional' , function ( t ) {
84+ test ( 'short option group does not consume subsequent positional' , ( t ) => {
8585 const passedArgs = [ '-rf' , 'foo' ] ;
8686 const passedOptions = { } ;
8787 const expected = { flags : { r : true , f : true } , values : { r : undefined , f : undefined } , positionals : [ 'foo' ] } ;
@@ -92,7 +92,7 @@ test('short option group does not consume subsequent positional', function(t) {
9292} ) ;
9393
9494// // See: Guideline 5 https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
95- test ( 'if terminal of short-option group configured `type: "string"`, subsequent positional is stored' , function ( t ) {
95+ test ( 'if terminal of short-option group configured `type: "string"`, subsequent positional is stored' , ( t ) => {
9696 const passedArgs = [ '-rvf' , 'foo' ] ;
9797 const passedOptions = { f : { type : 'string' } } ;
9898 const expected = { flags : { r : true , f : true , v : true } , values : { r : undefined , v : undefined , f : 'foo' } , positionals : [ ] } ;
@@ -102,7 +102,7 @@ test('if terminal of short-option group configured `type: "string"`, subsequent
102102 t . end ( ) ;
103103} ) ;
104104
105- test ( 'handles short-option groups in conjunction with long-options' , function ( t ) {
105+ test ( 'handles short-option groups in conjunction with long-options' , ( t ) => {
106106 const passedArgs = [ '-rf' , '--foo' , 'foo' ] ;
107107 const passedOptions = { foo : { type : 'string' } } ;
108108 const expected = { flags : { r : true , f : true , foo : true } , values : { r : undefined , f : undefined , foo : 'foo' } , positionals : [ ] } ;
@@ -112,7 +112,7 @@ test('handles short-option groups in conjunction with long-options', function(t)
112112 t . end ( ) ;
113113} ) ;
114114
115- test ( 'handles short-option groups with "short" alias configured' , function ( t ) {
115+ test ( 'handles short-option groups with "short" alias configured' , ( t ) => {
116116 const passedArgs = [ '-rf' ] ;
117117 const passedOptions = { remove : { short : 'r' } } ;
118118 const expected = { flags : { remove : true , f : true } , values : { remove : undefined , f : undefined } , positionals : [ ] } ;
@@ -122,7 +122,7 @@ test('handles short-option groups with "short" alias configured', function(t) {
122122 t . end ( ) ;
123123} ) ;
124124
125- test ( 'Everything after a bare `--` is considered a positional argument' , function ( t ) {
125+ test ( 'Everything after a bare `--` is considered a positional argument' , ( t ) => {
126126 const passedArgs = [ '--' , 'barepositionals' , 'mopositionals' ] ;
127127 const expected = { flags : { } , values : { } , positionals : [ 'barepositionals' , 'mopositionals' ] } ;
128128 const args = parseArgs ( { args : passedArgs } ) ;
@@ -132,7 +132,7 @@ test('Everything after a bare `--` is considered a positional argument', functio
132132 t . end ( ) ;
133133} ) ;
134134
135- test ( 'args are true' , function ( t ) {
135+ test ( 'args are true' , ( t ) => {
136136 const passedArgs = [ '--foo' , '--bar' ] ;
137137 const expected = { flags : { foo : true , bar : true } , values : { foo : undefined , bar : undefined } , positionals : [ ] } ;
138138 const args = parseArgs ( { args : passedArgs } ) ;
@@ -142,7 +142,7 @@ test('args are true', function(t) {
142142 t . end ( ) ;
143143} ) ;
144144
145- test ( 'arg is true and positional is identified' , function ( t ) {
145+ test ( 'arg is true and positional is identified' , ( t ) => {
146146 const passedArgs = [ '--foo=a' , '--foo' , 'b' ] ;
147147 const expected = { flags : { foo : true } , values : { foo : undefined } , positionals : [ 'b' ] } ;
148148 const args = parseArgs ( { args : passedArgs } ) ;
@@ -152,7 +152,7 @@ test('arg is true and positional is identified', function(t) {
152152 t . end ( ) ;
153153} ) ;
154154
155- test ( 'args equals are passed `type: "string"`' , function ( t ) {
155+ test ( 'args equals are passed `type: "string"`' , ( t ) => {
156156 const passedArgs = [ '--so=wat' ] ;
157157 const passedOptions = { so : { type : 'string' } } ;
158158 const expected = { flags : { so : true } , values : { so : 'wat' } , positionals : [ ] } ;
@@ -163,7 +163,7 @@ test('args equals are passed `type: "string"`', function(t) {
163163 t . end ( ) ;
164164} ) ;
165165
166- test ( 'when args include single dash then result stores dash as positional' , function ( t ) {
166+ test ( 'when args include single dash then result stores dash as positional' , ( t ) => {
167167 const passedArgs = [ '-' ] ;
168168 const expected = { flags : { } , values : { } , positionals : [ '-' ] } ;
169169 const args = parseArgs ( { args : passedArgs } ) ;
@@ -173,7 +173,7 @@ test('when args include single dash then result stores dash as positional', func
173173 t . end ( ) ;
174174} ) ;
175175
176- test ( 'zero config args equals are parsed as if `type: "string"`' , function ( t ) {
176+ test ( 'zero config args equals are parsed as if `type: "string"`' , ( t ) => {
177177 const passedArgs = [ '--so=wat' ] ;
178178 const passedOptions = { } ;
179179 const expected = { flags : { so : true } , values : { so : 'wat' } , positionals : [ ] } ;
@@ -184,7 +184,7 @@ test('zero config args equals are parsed as if `type: "string"`', function(t) {
184184 t . end ( ) ;
185185} ) ;
186186
187- test ( 'same arg is passed twice `type: "string"` and last value is recorded' , function ( t ) {
187+ test ( 'same arg is passed twice `type: "string"` and last value is recorded' , ( t ) => {
188188 const passedArgs = [ '--foo=a' , '--foo' , 'b' ] ;
189189 const passedOptions = { foo : { type : 'string' } } ;
190190 const expected = { flags : { foo : true } , values : { foo : 'b' } , positionals : [ ] } ;
@@ -195,7 +195,7 @@ test('same arg is passed twice `type: "string"` and last value is recorded', fun
195195 t . end ( ) ;
196196} ) ;
197197
198- test ( 'args equals pass string including more equals' , function ( t ) {
198+ test ( 'args equals pass string including more equals' , ( t ) => {
199199 const passedArgs = [ '--so=wat=bing' ] ;
200200 const passedOptions = { so : { type : 'string' } } ;
201201 const expected = { flags : { so : true } , values : { so : 'wat=bing' } , positionals : [ ] } ;
@@ -206,7 +206,7 @@ test('args equals pass string including more equals', function(t) {
206206 t . end ( ) ;
207207} ) ;
208208
209- test ( 'first arg passed for `type: "string"` and "multiple" is in array' , function ( t ) {
209+ test ( 'first arg passed for `type: "string"` and "multiple" is in array' , ( t ) => {
210210 const passedArgs = [ '--foo=a' ] ;
211211 const passedOptions = { foo : { type : 'string' , multiple : true } } ;
212212 const expected = { flags : { foo : true } , values : { foo : [ 'a' ] } , positionals : [ ] } ;
@@ -217,7 +217,7 @@ test('first arg passed for `type: "string"` and "multiple" is in array', functio
217217 t . end ( ) ;
218218} ) ;
219219
220- test ( 'args are passed `type: "string"` and "multiple"' , function ( t ) {
220+ test ( 'args are passed `type: "string"` and "multiple"' , ( t ) => {
221221 const passedArgs = [ '--foo=a' , '--foo' , 'b' ] ;
222222 const passedOptions = {
223223 foo : {
@@ -233,7 +233,7 @@ test('args are passed `type: "string"` and "multiple"', function(t) {
233233 t . end ( ) ;
234234} ) ;
235235
236- test ( 'when expecting `multiple:true` boolean option and option used multiple times then result includes array of booleans matching usage' , function ( t ) {
236+ test ( 'when expecting `multiple:true` boolean option and option used multiple times then result includes array of booleans matching usage' , ( t ) => {
237237 const passedArgs = [ '--foo' , '--foo' ] ;
238238 const passedOptions = {
239239 foo : {
@@ -261,7 +261,7 @@ test('order of option and positional does not matter (per README)', function(t)
261261 t . end ( ) ;
262262} ) ;
263263
264- test ( 'correct default args when use node -p' , function ( t ) {
264+ test ( 'correct default args when use node -p' , ( t ) => {
265265 const holdArgv = process . argv ;
266266 process . argv = [ process . argv0 , '--foo' ] ;
267267 const holdExecArgv = process . execArgv ;
@@ -278,7 +278,7 @@ test('correct default args when use node -p', function(t) {
278278 process . execArgv = holdExecArgv ;
279279} ) ;
280280
281- test ( 'correct default args when use node --print' , function ( t ) {
281+ test ( 'correct default args when use node --print' , ( t ) => {
282282 const holdArgv = process . argv ;
283283 process . argv = [ process . argv0 , '--foo' ] ;
284284 const holdExecArgv = process . execArgv ;
@@ -295,7 +295,7 @@ test('correct default args when use node --print', function(t) {
295295 process . execArgv = holdExecArgv ;
296296} ) ;
297297
298- test ( 'correct default args when use node -e' , function ( t ) {
298+ test ( 'correct default args when use node -e' , ( t ) => {
299299 const holdArgv = process . argv ;
300300 process . argv = [ process . argv0 , '--foo' ] ;
301301 const holdExecArgv = process . execArgv ;
@@ -312,7 +312,7 @@ test('correct default args when use node -e', function(t) {
312312 process . execArgv = holdExecArgv ;
313313} ) ;
314314
315- test ( 'correct default args when use node --eval' , function ( t ) {
315+ test ( 'correct default args when use node --eval' , ( t ) => {
316316 const holdArgv = process . argv ;
317317 process . argv = [ process . argv0 , '--foo' ] ;
318318 const holdExecArgv = process . execArgv ;
@@ -329,7 +329,7 @@ test('correct default args when use node --eval', function(t) {
329329 process . execArgv = holdExecArgv ;
330330} ) ;
331331
332- test ( 'correct default args when normal arguments' , function ( t ) {
332+ test ( 'correct default args when normal arguments' , ( t ) => {
333333 const holdArgv = process . argv ;
334334 process . argv = [ process . argv0 , 'script.js' , '--foo' ] ;
335335 const holdExecArgv = process . execArgv ;
@@ -346,7 +346,7 @@ test('correct default args when normal arguments', function(t) {
346346 process . execArgv = holdExecArgv ;
347347} ) ;
348348
349- test ( 'excess leading dashes on options are retained' , function ( t ) {
349+ test ( 'excess leading dashes on options are retained' , ( t ) => {
350350 // Enforce a design decision for an edge case.
351351 const passedArgs = [ '---triple' ] ;
352352 const passedOptions = { } ;
@@ -364,7 +364,7 @@ test('excess leading dashes on options are retained', function(t) {
364364
365365// Test bad inputs
366366
367- test ( 'invalid argument passed for options' , function ( t ) {
367+ test ( 'invalid argument passed for options' , ( t ) => {
368368 const passedArgs = [ '--so=wat' ] ;
369369 const passedOptions = 'bad value' ;
370370
@@ -375,7 +375,7 @@ test('invalid argument passed for options', function(t) {
375375 t . end ( ) ;
376376} ) ;
377377
378- test ( 'boolean passed to "type" option' , function ( t ) {
378+ test ( 'boolean passed to "type" option' , ( t ) => {
379379 const passedArgs = [ '--so=wat' ] ;
380380 const passedOptions = { foo : { type : true } } ;
381381
@@ -386,7 +386,7 @@ test('boolean passed to "type" option', function(t) {
386386 t . end ( ) ;
387387} ) ;
388388
389- test ( 'invalid union value passed to "type" option' , function ( t ) {
389+ test ( 'invalid union value passed to "type" option' , ( t ) => {
390390 const passedArgs = [ '--so=wat' ] ;
391391 const passedOptions = { foo : { type : 'str' } } ;
392392
@@ -397,7 +397,7 @@ test('invalid union value passed to "type" option', function(t) {
397397 t . end ( ) ;
398398} ) ;
399399
400- test ( 'invalid short option length' , function ( t ) {
400+ test ( 'invalid short option length' , ( t ) => {
401401 const passedArgs = [ ] ;
402402 const passedOptions = { foo : { short : 'fo' } } ;
403403
0 commit comments