Skip to content

Commit e9b2325

Browse files
zjywevanlucas
authored andcommitted
test: test error messages in test-dns-regress-7070
Add a RegExp as a second argument to assert.throws(). PR-URL: #10058 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 8a9d68a commit e9b2325

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/parallel/test-dns-regress-7070.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ const assert = require('assert');
44
const dns = require('dns');
55

66
// Should not raise assertion error. Issue #7070
7-
assert.throws(() => dns.resolveNs([])); // bad name
8-
assert.throws(() => dns.resolveNs('')); // bad callback
7+
assert.throws(() => dns.resolveNs([]), // bad name
8+
/^Error: "name" argument must be a string$/);
9+
assert.throws(() => dns.resolveNs(''), // bad callback
10+
/^Error: "callback" argument must be a function$/);

0 commit comments

Comments
 (0)