@@ -5,14 +5,13 @@ const common = require('../common');
55const assert = require ( 'assert' ) ;
66const getValidStdio = require ( 'internal/child_process' ) . getValidStdio ;
77
8- const expectedError =
9- common . expectsError ( { code : 'ERR_INVALID_OPT_VALUE' , type : TypeError } , 2 ) ;
8+ const expectedError = { code : 'ERR_INVALID_OPT_VALUE' , type : TypeError } ;
109
1110// Should throw if string and not ignore, pipe, or inherit
12- assert . throws ( ( ) => getValidStdio ( 'foo' ) , expectedError ) ;
11+ common . expectsError ( ( ) => getValidStdio ( 'foo' ) , expectedError ) ;
1312
1413// Should throw if not a string or array
15- assert . throws ( ( ) => getValidStdio ( 600 ) , expectedError ) ;
14+ common . expectsError ( ( ) => getValidStdio ( 600 ) , expectedError ) ;
1615
1716// Should populate stdio with undefined if len < 3
1817{
@@ -30,6 +29,19 @@ common.expectsError(() => getValidStdio(stdio2, true),
3029 { code : 'ERR_IPC_SYNC_FORK' , type : Error }
3130) ;
3231
32+ // Should throw if stdio is not a valid input
33+ {
34+ const stdio = [ 'foo' ] ;
35+ common . expectsError ( ( ) => getValidStdio ( stdio , false ) ,
36+ { code : 'ERR_INVALID_SYNC_FORK_INPUT' , type : TypeError }
37+ ) ;
38+ }
39+
40+ // Should throw if stdio is not a valid option
41+ {
42+ const stdio = [ { foo : 'bar' } ] ;
43+ common . expectsError ( ( ) => getValidStdio ( stdio ) , expectedError ) ;
44+ }
3345
3446if ( common . isMainThread ) {
3547 const stdio3 = [ process . stdin , process . stdout , process . stderr ] ;
0 commit comments