11import { test } from 'node:test' ;
2- import { strictEqual } from 'node:assert' ;
2+ import { deepStrictEqual } from 'node:assert' ;
33import internal from 'internal/options' ;
44import { parseArgs } from 'node:util' ;
55
@@ -21,20 +21,26 @@ const options = {
2121
2222const { values } = parseArgs ( { args : process . argv . slice ( 2 ) , options } ) ;
2323
24- const { flag, expected, description } = values ;
24+ let { flag, expected, description } = values ;
2525
2626test ( description , ( ) => {
2727 const optionValue = internal . getOptionValue ( flag ) ;
28+ const isArrayOption = Array . isArray ( optionValue ) ;
29+
30+ if ( isArrayOption ) {
31+ expected = [ expected ] ;
32+ }
33+
2834 console . error ( `testing flag: ${ flag } , found value: ${ optionValue } , expected: ${ expected } ` ) ;
2935
3036 const isNumber = ! isNaN ( Number ( expected ) ) ;
3137 const booleanValue = expected === 'true' || expected === 'false' ;
3238 if ( booleanValue ) {
33- strictEqual ( optionValue , expected === 'true' ) ;
39+ deepStrictEqual ( optionValue , expected === 'true' ) ;
3440 return ;
3541 } else if ( isNumber ) {
36- strictEqual ( Number ( optionValue ) , Number ( expected ) ) ;
42+ deepStrictEqual ( Number ( optionValue ) , Number ( expected ) ) ;
3743 } else {
38- strictEqual ( optionValue , expected ) ;
44+ deepStrictEqual ( optionValue , expected ) ;
3945 }
4046} ) ;
0 commit comments