@@ -43,8 +43,8 @@ class CustomWarning extends Error {
4343 [ testMsg , { type : testType , code : testCode , detail : [ ] } ] ,
4444 [ testMsg , { type : testType , code : testCode , detail : null } ] ,
4545 [ testMsg , { type : testType , code : testCode , detail : 1 } ]
46- ] . forEach ( ( i ) => {
47- process . emitWarning . apply ( null , i ) ;
46+ ] . forEach ( ( args ) => {
47+ process . emitWarning ( ... args ) ;
4848} ) ;
4949
5050const warningNoToString = new CustomWarning ( ) ;
@@ -57,18 +57,25 @@ warningThrowToString.toString = function() {
5757} ;
5858process . emitWarning ( warningThrowToString ) ;
5959
60- const expectedError =
61- common . expectsError ( { code : 'ERR_INVALID_ARG_TYPE' , type : TypeError } , 11 ) ;
62-
6360// TypeError is thrown on invalid input
64- assert . throws ( ( ) => process . emitWarning ( 1 ) , expectedError ) ;
65- assert . throws ( ( ) => process . emitWarning ( { } ) , expectedError ) ;
66- assert . throws ( ( ) => process . emitWarning ( true ) , expectedError ) ;
67- assert . throws ( ( ) => process . emitWarning ( [ ] ) , expectedError ) ;
68- assert . throws ( ( ) => process . emitWarning ( '' , '' , { } ) , expectedError ) ;
69- assert . throws ( ( ) => process . emitWarning ( '' , 1 ) , expectedError ) ;
70- assert . throws ( ( ) => process . emitWarning ( '' , '' , 1 ) , expectedError ) ;
71- assert . throws ( ( ) => process . emitWarning ( '' , true ) , expectedError ) ;
72- assert . throws ( ( ) => process . emitWarning ( '' , '' , true ) , expectedError ) ;
73- assert . throws ( ( ) => process . emitWarning ( '' , [ ] ) , expectedError ) ;
74- assert . throws ( ( ) => process . emitWarning ( '' , '' , [ ] ) , expectedError ) ;
61+ [
62+ [ 1 ] ,
63+ [ { } ] ,
64+ [ true ] ,
65+ [ [ ] ] ,
66+ [ '' , '' , { } ] ,
67+ [ '' , 1 ] ,
68+ [ '' , '' , 1 ] ,
69+ [ '' , true ] ,
70+ [ '' , '' , true ] ,
71+ [ '' , [ ] ] ,
72+ [ '' , '' , [ ] ] ,
73+ [ ] ,
74+ [ undefined , 'foo' , 'bar' ] ,
75+ [ undefined ]
76+ ] . forEach ( ( args ) => {
77+ common . expectsError (
78+ ( ) => process . emitWarning ( ...args ) ,
79+ { code : 'ERR_INVALID_ARG_TYPE' , type : TypeError }
80+ ) ;
81+ } ) ;
0 commit comments