File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1215,6 +1215,26 @@ describe('yargs-parser', function () {
1215
1215
parse . should . have . property ( 't' , false ) . and . be . a ( 'boolean' )
1216
1216
parse . should . have . property ( '_' ) . and . deep . equal ( [ 'moo' ] )
1217
1217
} )
1218
+
1219
+ it ( 'should log defaulted options - not specified by user' , function ( ) {
1220
+ var parsed = parser . detailed ( '' , {
1221
+ default : { foo : 'abc' , 'bar.prop' : 33 }
1222
+ } )
1223
+ parsed . argv . foo . should . equal ( 'abc' )
1224
+ parsed . argv . bar . prop . should . equal ( 33 )
1225
+ parsed . defaulted . foo . should . equal ( true )
1226
+ parsed . defaulted [ 'bar.prop' ] . should . equal ( true )
1227
+ } )
1228
+
1229
+ it ( 'should not log defaulted options - specified without value' , function ( ) {
1230
+ var parsed = parser . detailed ( '--foo --bar.prop' , {
1231
+ default : { foo : 'abc' , 'bar.prop' : 33 }
1232
+ } )
1233
+ parsed . argv . foo . should . equal ( 'abc' )
1234
+ parsed . argv . bar . prop . should . equal ( 33 )
1235
+ parsed . defaulted . should . not . have . property ( 'foo' )
1236
+ parsed . defaulted . should . not . have . property ( 'bar.prop' )
1237
+ } )
1218
1238
} )
1219
1239
1220
1240
describe ( 'camelCase' , function ( ) {
You can’t perform that action at this time.
0 commit comments