@@ -35,6 +35,7 @@ describe('parseArguments', () => {
35
35
const tests : { [ test : string ] : Partial < Arguments > | [ '!!!' , Partial < Arguments > , string [ ] ] } = {
36
36
'--bool' : { bool : true } ,
37
37
'--bool=1' : [ '!!!' , { } , [ '--bool=1' ] ] ,
38
+ '--bool ' : { bool : true , p1 : '' } ,
38
39
'-- --bool=1' : { '--' : [ '--bool=1' ] } ,
39
40
'--bool=yellow' : [ '!!!' , { } , [ '--bool=yellow' ] ] ,
40
41
'--bool=true' : { bool : true } ,
@@ -68,6 +69,10 @@ describe('parseArguments', () => {
68
69
'--arr=1 --arr --arr c d' : { arr : [ '1' , '' , 'c' ] , p1 : 'd' } ,
69
70
'--arr=1 --arr --arr c d e' : { arr : [ '1' , '' , 'c' ] , p1 : 'd' , p2 : 'e' } ,
70
71
'--str=1' : { str : '1' } ,
72
+ '--str=' : { str : '' } ,
73
+ '--str ' : { str : '' } ,
74
+ '--str ' : { str : '' , p1 : '' } ,
75
+ '--str ' : { str : '' , p1 : '' , p2 : '' , '--' : [ '' ] } ,
71
76
'--hello-world=1' : { helloWorld : '1' } ,
72
77
'--hello-bool' : { helloBool : true } ,
73
78
'--helloBool' : { helloBool : true } ,
@@ -119,7 +124,7 @@ describe('parseArguments', () => {
119
124
Object . entries ( tests ) . forEach ( ( [ str , expected ] ) => {
120
125
it ( `works for ${ str } ` , ( ) => {
121
126
try {
122
- const actual = parseArguments ( str . split ( / \s + / ) , options ) ;
127
+ const actual = parseArguments ( str . split ( ' ' ) , options ) ;
123
128
124
129
expect ( Array . isArray ( expected ) ) . toBe ( false ) ;
125
130
expect ( actual ) . toEqual ( expected as Arguments ) ;
0 commit comments