@@ -2514,6 +2514,39 @@ describe('yargs-parser', function () {
25142514 parsed . should . not . have . property ( 'a.b' )
25152515 } )
25162516 } )
2517+
2518+ describe ( 'halt-at-non-option' , function ( ) {
2519+ it ( 'gets the entire rest of line' , function ( ) {
2520+ var parse = parser ( [ '--foo' , './file.js' , '--foo' , '--bar' ] , {
2521+ configuration : { 'halt-at-non-option' : true } ,
2522+ boolean : [ 'foo' , 'bar' ]
2523+ } )
2524+ parse . should . deep . equal ( { foo : true , _ : [ './file.js' , '--foo' , '--bar' ] } )
2525+ } )
2526+
2527+ it ( 'is not influenced by --' , function ( ) {
2528+ var parse = parser (
2529+ [ '--foo' , './file.js' , '--foo' , '--' , 'barbar' , '--bar' ] ,
2530+ { configuration : { 'halt-at-non-option' : true } , boolean : [ 'foo' , 'bar' ] }
2531+ )
2532+ parse . should . deep . equal ( {
2533+ foo : true ,
2534+ _ : [ './file.js' , '--foo' , '--' , 'barbar' , '--bar' ]
2535+ } )
2536+ } )
2537+
2538+ it ( 'is not influenced by unknown options' , function ( ) {
2539+ var parse = parser (
2540+ [ '-v' , '--long' , 'arg' , './file.js' , '--foo' , '--' , 'barbar' ] ,
2541+ { configuration : { 'halt-at-non-option' : true } , boolean : [ 'foo' ] }
2542+ )
2543+ parse . should . deep . equal ( {
2544+ v : true ,
2545+ long : 'arg' ,
2546+ _ : [ './file.js' , '--foo' , '--' , 'barbar' ]
2547+ } )
2548+ } )
2549+ } )
25172550 } )
25182551
25192552 // addresses: https://github.com/yargs/yargs-parser/issues/41
0 commit comments