@@ -68,16 +68,16 @@ const goog = [
6868] ;
6969assert . doesNotThrow ( ( ) => dns . setServers ( goog ) ) ;
7070assert . deepStrictEqual ( dns . getServers ( ) , goog ) ;
71- assert . throws ( ( ) => dns . setServers ( [ 'foobar' ] ) , common . expectsError ( {
71+ common . expectsError ( ( ) => dns . setServers ( [ 'foobar' ] ) , {
7272 code : 'ERR_INVALID_IP_ADDRESS' ,
7373 type : Error ,
7474 message : 'Invalid IP address: foobar'
75- } ) ) ;
76- assert . throws ( ( ) => dns . setServers ( [ '127.0.0.1:va' ] ) , common . expectsError ( {
75+ } ) ;
76+ common . expectsError ( ( ) => dns . setServers ( [ '127.0.0.1:va' ] ) , {
7777 code : 'ERR_INVALID_IP_ADDRESS' ,
7878 type : Error ,
7979 message : 'Invalid IP address: 127.0.0.1:va'
80- } ) ) ;
80+ } ) ;
8181assert . deepStrictEqual ( dns . getServers ( ) , goog ) ;
8282
8383const goog6 = [
@@ -109,14 +109,14 @@ assert.deepStrictEqual(dns.getServers(), portsExpected);
109109assert . doesNotThrow ( ( ) => dns . setServers ( [ ] ) ) ;
110110assert . deepStrictEqual ( dns . getServers ( ) , [ ] ) ;
111111
112- assert . throws ( ( ) => {
112+ common . expectsError ( ( ) => {
113113 dns . resolve ( 'example.com' , [ ] , common . mustNotCall ( ) ) ;
114- } , common . expectsError ( {
114+ } , {
115115 code : 'ERR_INVALID_ARG_TYPE' ,
116116 type : TypeError ,
117117 message : 'The "rrtype" argument must be of type string. ' +
118118 'Received type object'
119- } ) ) ;
119+ } ) ;
120120
121121// dns.lookup should accept only falsey and string values
122122{
@@ -167,24 +167,24 @@ assert.throws(() => {
167167 * - it's an odd number different than 1, and thus is invalid, because
168168 * flags are either === 1 or even.
169169 */
170- assert . throws ( ( ) => {
170+ common . expectsError ( ( ) => {
171171 dns . lookup ( 'nodejs.org' , { hints : ( dns . V4MAPPED | dns . ADDRCONFIG ) + 1 } ,
172172 common . mustNotCall ( ) ) ;
173- } , common . expectsError ( {
173+ } , {
174174 code : 'ERR_INVALID_OPT_VALUE' ,
175175 type : TypeError ,
176176 message : / T h e v a l u e " \d + " i s i n v a l i d f o r o p t i o n " h i n t s " /
177- } ) ) ;
177+ } ) ;
178178
179- assert . throws ( ( ) => dns . lookup ( 'nodejs.org' ) , common . expectsError ( {
179+ common . expectsError ( ( ) => dns . lookup ( 'nodejs.org' ) , {
180180 code : 'ERR_INVALID_CALLBACK' ,
181181 type : TypeError
182- } ) ) ;
182+ } ) ;
183183
184- assert . throws ( ( ) => dns . lookup ( 'nodejs.org' , 4 ) , common . expectsError ( {
184+ common . expectsError ( ( ) => dns . lookup ( 'nodejs.org' , 4 ) , {
185185 code : 'ERR_INVALID_CALLBACK' ,
186186 type : TypeError
187- } ) ) ;
187+ } ) ;
188188
189189assert . doesNotThrow ( ( ) => dns . lookup ( '' , { family : 4 , hints : 0 } ,
190190 common . mustCall ( ) ) ) ;
0 commit comments