mirror of
https://github.com/nodejs/node.git
synced 2024-11-25 08:19:38 +01:00
2472b6742c
Due to the unfortunate nature of JavaScript, the extraneous arguments are silently ignored. In this case, the assertion trivially passes regardless of the given regular expressions. Refs: https://github.com/nodejs/node/pull/44633 PR-URL: https://github.com/nodejs/node/pull/46618 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Harshitha K P <harshitha014@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
35 lines
898 B
JavaScript
35 lines
898 B
JavaScript
'use strict';
|
|
|
|
// This tests support for the dns module in snapshot.
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const tmpdir = require('../common/tmpdir');
|
|
const fixtures = require('../common/fixtures');
|
|
const { buildSnapshot, runWithSnapshot } = require('../common/snapshot');
|
|
const {
|
|
addresses: { INET4_HOST },
|
|
} = require('../common/internet');
|
|
|
|
const entry = fixtures.path('snapshot', 'dns-lookup.js');
|
|
const env = {
|
|
NODE_TEST_HOST: INET4_HOST,
|
|
NODE_TEST_PROMISE: 'false',
|
|
};
|
|
|
|
tmpdir.refresh();
|
|
function checkOutput(stderr, stdout) {
|
|
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
|
|
assert.match(stdout, /family: 4/);
|
|
assert.strictEqual(stdout.trim().split('\n').length, 2);
|
|
}
|
|
{
|
|
const { stderr, stdout } = buildSnapshot(entry, env);
|
|
checkOutput(stderr, stdout);
|
|
}
|
|
|
|
{
|
|
const { stderr, stdout } = runWithSnapshot(entry, env);
|
|
checkOutput(stderr, stdout);
|
|
}
|