@@ -68,16 +68,16 @@ const goog = [
68
68
] ;
69
69
assert . doesNotThrow ( ( ) => dns . setServers ( goog ) ) ;
70
70
assert . deepStrictEqual ( dns . getServers ( ) , goog ) ;
71
- assert . throws ( ( ) => dns . setServers ( [ 'foobar' ] ) , common . expectsError ( {
71
+ common . expectsError ( ( ) => dns . setServers ( [ 'foobar' ] ) , {
72
72
code : 'ERR_INVALID_IP_ADDRESS' ,
73
73
type : Error ,
74
74
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' ] ) , {
77
77
code : 'ERR_INVALID_IP_ADDRESS' ,
78
78
type : Error ,
79
79
message : 'Invalid IP address: 127.0.0.1:va'
80
- } ) ) ;
80
+ } ) ;
81
81
assert . deepStrictEqual ( dns . getServers ( ) , goog ) ;
82
82
83
83
const goog6 = [
@@ -109,14 +109,14 @@ assert.deepStrictEqual(dns.getServers(), portsExpected);
109
109
assert . doesNotThrow ( ( ) => dns . setServers ( [ ] ) ) ;
110
110
assert . deepStrictEqual ( dns . getServers ( ) , [ ] ) ;
111
111
112
- assert . throws ( ( ) => {
112
+ common . expectsError ( ( ) => {
113
113
dns . resolve ( 'example.com' , [ ] , common . mustNotCall ( ) ) ;
114
- } , common . expectsError ( {
114
+ } , {
115
115
code : 'ERR_INVALID_ARG_TYPE' ,
116
116
type : TypeError ,
117
117
message : 'The "rrtype" argument must be of type string. ' +
118
118
'Received type object'
119
- } ) ) ;
119
+ } ) ;
120
120
121
121
// dns.lookup should accept only falsey and string values
122
122
{
@@ -167,24 +167,24 @@ assert.throws(() => {
167
167
* - it's an odd number different than 1, and thus is invalid, because
168
168
* flags are either === 1 or even.
169
169
*/
170
- assert . throws ( ( ) => {
170
+ common . expectsError ( ( ) => {
171
171
dns . lookup ( 'nodejs.org' , { hints : ( dns . V4MAPPED | dns . ADDRCONFIG ) + 1 } ,
172
172
common . mustNotCall ( ) ) ;
173
- } , common . expectsError ( {
173
+ } , {
174
174
code : 'ERR_INVALID_OPT_VALUE' ,
175
175
type : TypeError ,
176
176
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
+ } ) ;
178
178
179
- assert . throws ( ( ) => dns . lookup ( 'nodejs.org' ) , common . expectsError ( {
179
+ common . expectsError ( ( ) => dns . lookup ( 'nodejs.org' ) , {
180
180
code : 'ERR_INVALID_CALLBACK' ,
181
181
type : TypeError
182
- } ) ) ;
182
+ } ) ;
183
183
184
- assert . throws ( ( ) => dns . lookup ( 'nodejs.org' , 4 ) , common . expectsError ( {
184
+ common . expectsError ( ( ) => dns . lookup ( 'nodejs.org' , 4 ) , {
185
185
code : 'ERR_INVALID_CALLBACK' ,
186
186
type : TypeError
187
- } ) ) ;
187
+ } ) ;
188
188
189
189
assert . doesNotThrow ( ( ) => dns . lookup ( '' , { family : 4 , hints : 0 } ,
190
190
common . mustCall ( ) ) ) ;
0 commit comments