mirror of
https://github.com/nodejs/node.git
synced 2025-05-04 06:27:35 +00:00

* Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip PR-URL: https://github.com/nodejs/node/pull/14021 Fixes: https://github.com/nodejs/node/issues/14016 Reviewed-By: Refael Ackermann <refack@gmail.com>
23 lines
607 B
JavaScript
23 lines
607 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
const https = require('https');
|
|
const error = 'Unable to determine the domain name';
|
|
|
|
function test(host) {
|
|
['get', 'request'].forEach((method) => {
|
|
[http, https].forEach((module) => {
|
|
assert.throws(() => module[method](host, () => {
|
|
throw new Error(`${module}.${method} should not connect to ${host}`);
|
|
}), error);
|
|
});
|
|
});
|
|
}
|
|
|
|
['www.nodejs.org', 'localhost', '127.0.0.1', 'http://:80/'].forEach(test);
|