diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-04-01 07:38:47 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-04-05 11:07:41 +0200 |
commit | 22da2f731d90235289a95bffe1ae3750a62a33bc (patch) | |
tree | 9c63afcdc504b66215e7df6fe3474526d5c74714 /test/parallel | |
parent | 354849eeb595ac364337e564669de4c77aa4c1af (diff) | |
download | android-node-v8-22da2f731d90235289a95bffe1ae3750a62a33bc.tar.gz android-node-v8-22da2f731d90235289a95bffe1ae3750a62a33bc.tar.bz2 android-node-v8-22da2f731d90235289a95bffe1ae3750a62a33bc.zip |
errors: make message non-enumerable
A error message should always be non-enumerable. This makes sure
that is true for dns errors as well. It also adds another check
in `common.expectsError` to make sure no other regressions are
introduced going forward.
Fixes #19716
PR-URL: https://github.com/nodejs/node/pull/19719
Fixes: https://github.com/nodejs/node/issues/19716
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel')
-rw-r--r-- | test/parallel/test-dns-lookup.js | 3 | ||||
-rw-r--r-- | test/parallel/test-dns-resolveany-bad-ancount.js | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/test/parallel/test-dns-lookup.js b/test/parallel/test-dns-lookup.js index d006355742..b9c0dfc6df 100644 --- a/test/parallel/test-dns-lookup.js +++ b/test/parallel/test-dns-lookup.js @@ -92,6 +92,9 @@ dns.lookup('example.com', common.mustCall((error, result, addressType) => { assert(error); assert.strictEqual(tickValue, 1); assert.strictEqual(error.code, 'ENOENT'); + const descriptor = Object.getOwnPropertyDescriptor(error, 'message'); + assert.strictEqual(descriptor.enumerable, + false, 'The error message should be non-enumerable'); })); // Make sure that the error callback is called diff --git a/test/parallel/test-dns-resolveany-bad-ancount.js b/test/parallel/test-dns-resolveany-bad-ancount.js index 25ce15935c..63ed1774b1 100644 --- a/test/parallel/test-dns-resolveany-bad-ancount.js +++ b/test/parallel/test-dns-resolveany-bad-ancount.js @@ -30,6 +30,9 @@ server.bind(0, common.mustCall(() => { assert.strictEqual(err.code, 'EBADRESP'); assert.strictEqual(err.syscall, 'queryAny'); assert.strictEqual(err.hostname, 'example.org'); + const descriptor = Object.getOwnPropertyDescriptor(err, 'message'); + assert.strictEqual(descriptor.enumerable, + false, 'The error message should be non-enumerable'); server.close(); })); })); |