Skip to content

Commit 2224211

Browse files
Trottcodebytere
authored andcommitted
test: improve assertion message in test-dns-any
Improve error message from "The expression evaluated to a falsy value" to a message formatted dynamically that lists the record types found so that someone investigating can look at the code and determine which values are missing. This came up because the test failed in nightly master branch CI but generally passes. It may prove helpful to know what record types were missing. (All of them? Just one? Something else?) PR-URL: #31697 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 6ad8ca5 commit 2224211

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/internet/test-dns-any.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ TEST(async function test_google(done) {
119119
function validateResult(res) {
120120
const types = processResult(res);
121121
assert.ok(
122-
types.A && types.AAAA && types.MX &&
123-
types.NS && types.TXT && types.SOA);
122+
types.A && types.AAAA && types.MX && types.NS && types.TXT && types.SOA,
123+
`Missing record type, found ${Object.keys(types)}`);
124124
}
125125

126126
validateResult(await dnsPromises.resolve('google.com', 'ANY'));
@@ -140,7 +140,8 @@ TEST(async function test_google(done) {
140140
TEST(async function test_sip2sip_for_naptr(done) {
141141
function validateResult(res) {
142142
const types = processResult(res);
143-
assert.ok(types.A && types.NS && types.NAPTR && types.SOA);
143+
assert.ok(types.A && types.NS && types.NAPTR && types.SOA,
144+
`Missing record type, found ${Object.keys(types)}`);
144145
}
145146

146147
validateResult(await dnsPromises.resolve('sip2sip.info', 'ANY'));

0 commit comments

Comments
 (0)