@@ -1108,7 +1108,7 @@ describe('yargs-parser', function () {
1108
1108
} )
1109
1109
} )
1110
1110
1111
- describe ( 'with implied false default' , function ( ) {
1111
+ describe ( 'without any default value ' , function ( ) {
1112
1112
var opts = null
1113
1113
1114
1114
beforeEach ( function ( ) {
@@ -1125,8 +1125,8 @@ describe('yargs-parser', function () {
1125
1125
parser ( [ '--no-flag' ] , opts ) . flag . should . be . false // eslint-disable-line
1126
1126
} )
1127
1127
1128
- it ( 'should set false if no flag in arg' , function ( ) {
1129
- expect ( parser ( [ ] , opts ) . flag ) . to . be . undefined // eslint-disable-line
1128
+ it ( 'should not add property if no flag in arg' , function ( ) {
1129
+ parser ( [ '' ] , opts ) . should . not . have . property ( 'flag' )
1130
1130
} )
1131
1131
} )
1132
1132
@@ -2334,6 +2334,18 @@ describe('yargs-parser', function () {
2334
2334
parsed [ 'x' ] . should . deep . equal ( 3 )
2335
2335
} )
2336
2336
} )
2337
+ describe ( 'type=boolean' , function ( ) {
2338
+ it ( '[-x true -x true -x false] => false' , function ( ) {
2339
+ var parsed = parser ( '-x true -x true -x false' , {
2340
+ boolean : [ 'x' ] ,
2341
+ configuration : {
2342
+ 'duplicate-arguments-array' : false ,
2343
+ 'flatten-duplicate-arrays' : false
2344
+ }
2345
+ } )
2346
+ parsed [ 'x' ] . should . deep . equal ( false )
2347
+ } )
2348
+ } )
2337
2349
} )
2338
2350
describe ( 'duplicate=false, flatten=true,' , function ( ) {
2339
2351
describe ( 'type=array' , function ( ) {
@@ -2370,6 +2382,18 @@ describe('yargs-parser', function () {
2370
2382
parsed [ 'x' ] . should . deep . equal ( 3 )
2371
2383
} )
2372
2384
} )
2385
+ describe ( 'type=boolean' , function ( ) {
2386
+ it ( '[-x true -x true -x false] => false' , function ( ) {
2387
+ var parsed = parser ( '-x true -x true -x false' , {
2388
+ boolean : [ 'x' ] ,
2389
+ configuration : {
2390
+ 'duplicate-arguments-array' : false ,
2391
+ 'flatten-duplicate-arrays' : true
2392
+ }
2393
+ } )
2394
+ parsed [ 'x' ] . should . deep . equal ( false )
2395
+ } )
2396
+ } )
2373
2397
} )
2374
2398
describe ( 'duplicate=true, flatten=true,' , function ( ) {
2375
2399
describe ( 'type=array' , function ( ) {
@@ -2406,6 +2430,18 @@ describe('yargs-parser', function () {
2406
2430
parsed [ 'x' ] . should . deep . equal ( [ 1 , 2 , 3 ] )
2407
2431
} )
2408
2432
} )
2433
+ describe ( 'type=boolean' , function ( ) {
2434
+ it ( '[-x true -x true -x false] => [true, true, false]' , function ( ) {
2435
+ var parsed = parser ( '-x true -x true -x false' , {
2436
+ boolean : [ 'x' ] ,
2437
+ configuration : {
2438
+ 'duplicate-arguments-array' : true ,
2439
+ 'flatten-duplicate-arrays' : true
2440
+ }
2441
+ } )
2442
+ parsed [ 'x' ] . should . deep . equal ( [ true , true , false ] )
2443
+ } )
2444
+ } )
2409
2445
} )
2410
2446
describe ( 'duplicate=true, flatten=false,' , function ( ) {
2411
2447
describe ( 'type=array' , function ( ) {
@@ -2442,6 +2478,18 @@ describe('yargs-parser', function () {
2442
2478
parsed [ 'x' ] . should . deep . equal ( [ 1 , 2 , 3 ] )
2443
2479
} )
2444
2480
} )
2481
+ describe ( 'type=boolean' , function ( ) {
2482
+ it ( '[-x true -x true -x false] => [true, true, false]' , function ( ) {
2483
+ var parsed = parser ( '-x true -x true -x false' , {
2484
+ boolean : [ 'x' ] ,
2485
+ configuration : {
2486
+ 'duplicate-arguments-array' : true ,
2487
+ 'flatten-duplicate-arrays' : false
2488
+ }
2489
+ } )
2490
+ parsed [ 'x' ] . should . deep . equal ( [ true , true , false ] )
2491
+ } )
2492
+ } )
2445
2493
} )
2446
2494
} )
2447
2495
0 commit comments