@@ -5,14 +5,13 @@ const common = require('../common');
5
5
const assert = require ( 'assert' ) ;
6
6
const getValidStdio = require ( 'internal/child_process' ) . getValidStdio ;
7
7
8
- const expectedError =
9
- common . expectsError ( { code : 'ERR_INVALID_OPT_VALUE' , type : TypeError } , 2 ) ;
8
+ const expectedError = { code : 'ERR_INVALID_OPT_VALUE' , type : TypeError } ;
10
9
11
10
// Should throw if string and not ignore, pipe, or inherit
12
- assert . throws ( ( ) => getValidStdio ( 'foo' ) , expectedError ) ;
11
+ common . expectsError ( ( ) => getValidStdio ( 'foo' ) , expectedError ) ;
13
12
14
13
// Should throw if not a string or array
15
- assert . throws ( ( ) => getValidStdio ( 600 ) , expectedError ) ;
14
+ common . expectsError ( ( ) => getValidStdio ( 600 ) , expectedError ) ;
16
15
17
16
// Should populate stdio with undefined if len < 3
18
17
{
@@ -30,6 +29,19 @@ common.expectsError(() => getValidStdio(stdio2, true),
30
29
{ code : 'ERR_IPC_SYNC_FORK' , type : Error }
31
30
) ;
32
31
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
+ }
33
45
34
46
if ( common . isMainThread ) {
35
47
const stdio3 = [ process . stdin , process . stdout , process . stderr ] ;
0 commit comments