@@ -14,14 +14,14 @@ function typeName(value) {
1414 const child = new ChildProcess ( ) ;
1515
1616 [ undefined , null , 'foo' , 0 , 1 , NaN , true , false ] . forEach ( ( options ) => {
17- assert . throws ( ( ) => {
17+ common . expectsError ( ( ) => {
1818 child . spawn ( options ) ;
19- } , common . expectsError ( {
19+ } , {
2020 code : 'ERR_INVALID_ARG_TYPE' ,
2121 type : TypeError ,
2222 message : 'The "options" argument must be of type object. ' +
2323 `Received type ${ typeName ( options ) } `
24- } ) ) ;
24+ } ) ;
2525 } ) ;
2626}
2727
@@ -30,14 +30,14 @@ function typeName(value) {
3030 const child = new ChildProcess ( ) ;
3131
3232 [ undefined , null , 0 , 1 , NaN , true , false , { } ] . forEach ( ( file ) => {
33- assert . throws ( ( ) => {
33+ common . expectsError ( ( ) => {
3434 child . spawn ( { file } ) ;
35- } , common . expectsError ( {
35+ } , {
3636 code : 'ERR_INVALID_ARG_TYPE' ,
3737 type : TypeError ,
3838 message : 'The "options.file" property must be of type string. ' +
3939 `Received type ${ typeName ( file ) } `
40- } ) ) ;
40+ } ) ;
4141 } ) ;
4242}
4343
@@ -46,14 +46,14 @@ function typeName(value) {
4646 const child = new ChildProcess ( ) ;
4747
4848 [ null , 0 , 1 , NaN , true , false , { } , 'foo' ] . forEach ( ( envPairs ) => {
49- assert . throws ( ( ) => {
49+ common . expectsError ( ( ) => {
5050 child . spawn ( { envPairs, stdio : [ 'ignore' , 'ignore' , 'ignore' , 'ipc' ] } ) ;
51- } , common . expectsError ( {
51+ } , {
5252 code : 'ERR_INVALID_ARG_TYPE' ,
5353 type : TypeError ,
54- message : 'The "options.envPairs" property must be of type array . ' +
54+ message : 'The "options.envPairs" property must be of type Array . ' +
5555 `Received type ${ typeName ( envPairs ) } `
56- } ) ) ;
56+ } ) ;
5757 } ) ;
5858}
5959
@@ -62,14 +62,14 @@ function typeName(value) {
6262 const child = new ChildProcess ( ) ;
6363
6464 [ null , 0 , 1 , NaN , true , false , { } , 'foo' ] . forEach ( ( args ) => {
65- assert . throws ( ( ) => {
65+ common . expectsError ( ( ) => {
6666 child . spawn ( { file : 'foo' , args } ) ;
67- } , common . expectsError ( {
67+ } , {
6868 code : 'ERR_INVALID_ARG_TYPE' ,
6969 type : TypeError ,
70- message : 'The "options.args" property must be of type array . ' +
70+ message : 'The "options.args" property must be of type Array . ' +
7171 `Received type ${ typeName ( args ) } `
72- } ) ) ;
72+ } ) ;
7373 } ) ;
7474}
7575
@@ -86,8 +86,9 @@ assert.strictEqual(child.hasOwnProperty('pid'), true);
8686assert ( Number . isInteger ( child . pid ) ) ;
8787
8888// try killing with invalid signal
89- assert . throws ( ( ) => {
90- child . kill ( 'foo' ) ;
91- } , common . expectsError ( { code : 'ERR_UNKNOWN_SIGNAL' , type : TypeError } ) ) ;
89+ common . expectsError (
90+ ( ) => { child . kill ( 'foo' ) ; } ,
91+ { code : 'ERR_UNKNOWN_SIGNAL' , type : TypeError }
92+ ) ;
9293
9394assert . strictEqual ( child . kill ( ) , true ) ;
0 commit comments