mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
8f742bb13f
PR-URL: https://github.com/nodejs/node/pull/50318 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
21 lines
592 B
JavaScript
21 lines
592 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { internalBinding } = require('internal/test/binding');
|
|
const cares = internalBinding('cares_wrap');
|
|
const { UV_EPERM } = internalBinding('uv');
|
|
const dnsPromises = require('dns').promises;
|
|
|
|
// Stub cares to force an error so we can test DNS error code path.
|
|
cares.ChannelWrap.prototype.queryA = () => UV_EPERM;
|
|
|
|
assert.rejects(
|
|
dnsPromises.resolve('example.org'),
|
|
{
|
|
code: 'EPERM',
|
|
syscall: 'queryA',
|
|
hostname: 'example.org'
|
|
}
|
|
).then(common.mustCall());
|