From 932ee65cd280808dd27e08fea7dfc4ebdc492b7a Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Mon, 26 Jun 2017 21:41:28 +0300 Subject: [PATCH 01/13] test: refactor test-http(s)-set-timeout-server * Make changes to `test-https-set-timeout-server` to resolve inconsistencies with its http counterpart: - Apply the changes analogous to those in GH-13802 to the https test. - Add a missing `common.mustCall()` wrapper. - Make small stylistic changes (e.g., remove unnecessary line breaks in comments) to make it visually consistent with the http test. * Use arrow functions. PR-URL: https://github.com/nodejs/node/pull/13935 Fixes: https://github.com/nodejs/node/issues/13588 Refs: https://github.com/nodejs/node/pull/13802 Refs: https://github.com/nodejs/node/pull/13625 Refs: https://github.com/nodejs/node/pull/13822 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Yuta Hiroto Reviewed-By: James M Snell --- test/parallel/test-http-set-timeout-server.js | 44 ++++++------ .../test-https-set-timeout-server.js | 69 +++++++++---------- 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/test/parallel/test-http-set-timeout-server.js b/test/parallel/test-http-set-timeout-server.js index cd3cfa3bf11..83fc7dc0462 100644 --- a/test/parallel/test-http-set-timeout-server.js +++ b/test/parallel/test-http-set-timeout-server.js @@ -42,11 +42,11 @@ function run() { } test(function serverTimeout(cb) { - const server = http.createServer(common.mustCall(function(req, res) { + const server = http.createServer(common.mustCall((req, res) => { // just do nothing, we should get a timeout event. })); - server.listen(common.mustCall(function() { - const s = server.setTimeout(50, common.mustCall(function(socket) { + server.listen(common.mustCall(() => { + const s = server.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); cb(); @@ -59,16 +59,16 @@ test(function serverTimeout(cb) { }); test(function serverRequestTimeout(cb) { - const server = http.createServer(common.mustCall(function(req, res) { + const server = http.createServer(common.mustCall((req, res) => { // just do nothing, we should get a timeout event. - const s = req.setTimeout(50, common.mustCall(function(socket) { + const s = req.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); cb(); })); assert.ok(s instanceof http.IncomingMessage); })); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { const req = http.request({ port: server.address().port, method: 'POST' @@ -80,16 +80,16 @@ test(function serverRequestTimeout(cb) { }); test(function serverResponseTimeout(cb) { - const server = http.createServer(common.mustCall(function(req, res) { + const server = http.createServer(common.mustCall((req, res) => { // just do nothing, we should get a timeout event. - const s = res.setTimeout(50, common.mustCall(function(socket) { + const s = res.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); cb(); })); assert.ok(s instanceof http.OutgoingMessage); })); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { http.get({ port: server.address().port }).on('error', common.mustCall()); @@ -97,18 +97,18 @@ test(function serverResponseTimeout(cb) { }); test(function serverRequestNotTimeoutAfterEnd(cb) { - const server = http.createServer(common.mustCall(function(req, res) { + const server = http.createServer(common.mustCall((req, res) => { // just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustNotCall()); assert.ok(s instanceof http.IncomingMessage); res.on('timeout', common.mustCall()); })); - server.on('timeout', common.mustCall(function(socket) { + server.on('timeout', common.mustCall((socket) => { socket.destroy(); server.close(); cb(); })); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { http.get({ port: server.address().port }).on('error', common.mustCall()); @@ -118,31 +118,31 @@ test(function serverRequestNotTimeoutAfterEnd(cb) { test(function serverResponseTimeoutWithPipeline(cb) { let caughtTimeout = ''; let secReceived = false; - process.on('exit', function() { + process.on('exit', () => { assert.strictEqual(caughtTimeout, '/2'); }); - const server = http.createServer(function(req, res) { + const server = http.createServer((req, res) => { if (req.url === '/2') secReceived = true; - const s = res.setTimeout(50, function() { + const s = res.setTimeout(50, () => { caughtTimeout += req.url; }); assert.ok(s instanceof http.OutgoingMessage); if (req.url === '/1') res.end(); }); - server.on('timeout', common.mustCall(function(socket) { + server.on('timeout', common.mustCall((socket) => { if (secReceived) { socket.destroy(); server.close(); cb(); } })); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { const options = { port: server.address().port, allowHalfOpen: true, }; - const c = net.connect(options, function() { + const c = net.connect(options, () => { c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); c.write('GET /2 HTTP/1.1\r\nHost: localhost\r\n\r\n'); c.write('GET /3 HTTP/1.1\r\nHost: localhost\r\n\r\n'); @@ -151,23 +151,23 @@ test(function serverResponseTimeoutWithPipeline(cb) { }); test(function idleTimeout(cb) { - const server = http.createServer(common.mustCall(function(req, res) { + const server = http.createServer(common.mustCall((req, res) => { req.on('timeout', common.mustNotCall()); res.on('timeout', common.mustNotCall()); res.end(); })); - const s = server.setTimeout(50, common.mustCall(function(socket) { + const s = server.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); cb(); })); assert.ok(s instanceof http.Server); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { const options = { port: server.address().port, allowHalfOpen: true, }; - const c = net.connect(options, function() { + const c = net.connect(options, () => { c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); // Keep-Alive }); diff --git a/test/sequential/test-https-set-timeout-server.js b/test/sequential/test-https-set-timeout-server.js index beec5109da0..aa4eb5714ff 100644 --- a/test/sequential/test-https-set-timeout-server.js +++ b/test/sequential/test-https-set-timeout-server.js @@ -43,28 +43,24 @@ const serverOptions = { function test(fn) { if (!tests.length) process.nextTick(run); - tests.push(fn); + tests.push(common.mustCall(fn)); } function run() { const fn = tests.shift(); if (fn) { - console.log('# %s', fn.name); fn(run); - } else { - console.log('ok'); } } test(function serverTimeout(cb) { const server = https.createServer( serverOptions, - common.mustCall(function(req, res) { - // just do nothing, we should get a - // timeout event. + common.mustCall((req, res) => { + // just do nothing, we should get a timeout event. })); - server.listen(common.mustCall(function() { - const s = server.setTimeout(50, common.mustCall(function(socket) { + server.listen(common.mustCall(() => { + const s = server.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); cb(); @@ -80,19 +76,16 @@ test(function serverTimeout(cb) { test(function serverRequestTimeout(cb) { const server = https.createServer( serverOptions, - common.mustCall(function(req, res) { - // just do nothing, we should get a - // timeout event. - const s = req.setTimeout( - 50, - common.mustCall(function(socket) { - socket.destroy(); - server.close(); - cb(); - })); + common.mustCall((req, res) => { + // just do nothing, we should get a timeout event. + const s = req.setTimeout(50, common.mustCall((socket) => { + socket.destroy(); + server.close(); + cb(); + })); assert.ok(s instanceof http.IncomingMessage); })); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { const req = https.request({ port: server.address().port, method: 'POST', @@ -107,16 +100,16 @@ test(function serverRequestTimeout(cb) { test(function serverResponseTimeout(cb) { const server = https.createServer( serverOptions, - common.mustCall(function(req, res) { + common.mustCall((req, res) => { // just do nothing, we should get a timeout event. - const s = res.setTimeout(50, common.mustCall(function(socket) { + const s = res.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); cb(); })); assert.ok(s instanceof http.OutgoingMessage); })); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { https.get({ port: server.address().port, rejectUnauthorized: false @@ -127,18 +120,18 @@ test(function serverResponseTimeout(cb) { test(function serverRequestNotTimeoutAfterEnd(cb) { const server = https.createServer( serverOptions, - common.mustCall(function(req, res) { + common.mustCall((req, res) => { // just do nothing, we should get a timeout event. const s = req.setTimeout(50, common.mustNotCall()); assert.ok(s instanceof http.IncomingMessage); res.on('timeout', common.mustCall()); })); - server.on('timeout', common.mustCall(function(socket) { + server.on('timeout', common.mustCall((socket) => { socket.destroy(); server.close(); cb(); })); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { https.get({ port: server.address().port, rejectUnauthorized: false @@ -149,32 +142,32 @@ test(function serverRequestNotTimeoutAfterEnd(cb) { test(function serverResponseTimeoutWithPipeline(cb) { let caughtTimeout = ''; let secReceived = false; - process.on('exit', function() { + process.on('exit', () => { assert.strictEqual(caughtTimeout, '/2'); }); - const server = https.createServer(serverOptions, function(req, res) { + const server = https.createServer(serverOptions, (req, res) => { if (req.url === '/2') secReceived = true; - const s = res.setTimeout(50, function() { + const s = res.setTimeout(50, () => { caughtTimeout += req.url; }); assert.ok(s instanceof http.OutgoingMessage); if (req.url === '/1') res.end(); }); - server.on('timeout', function(socket) { + server.on('timeout', common.mustCall((socket) => { if (secReceived) { socket.destroy(); server.close(); cb(); } - }); - server.listen(common.mustCall(function() { + })); + server.listen(common.mustCall(() => { const options = { port: server.address().port, allowHalfOpen: true, rejectUnauthorized: false }; - const c = tls.connect(options, function() { + const c = tls.connect(options, () => { c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); c.write('GET /2 HTTP/1.1\r\nHost: localhost\r\n\r\n'); c.write('GET /3 HTTP/1.1\r\nHost: localhost\r\n\r\n'); @@ -185,25 +178,25 @@ test(function serverResponseTimeoutWithPipeline(cb) { test(function idleTimeout(cb) { const server = https.createServer( serverOptions, - common.mustCall(function(req, res) { + common.mustCall((req, res) => { req.on('timeout', common.mustNotCall()); res.on('timeout', common.mustNotCall()); res.end(); })); - const s = server.setTimeout(50, common.mustCall(function(socket) { + const s = server.setTimeout(50, common.mustCall((socket) => { socket.destroy(); server.close(); cb(); })); assert.ok(s instanceof https.Server); - server.listen(common.mustCall(function() { + server.listen(common.mustCall(() => { const options = { port: server.address().port, allowHalfOpen: true, rejectUnauthorized: false }; - tls.connect(options, function() { - this.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); + const c = tls.connect(options, () => { + c.write('GET /1 HTTP/1.1\r\nHost: localhost\r\n\r\n'); // Keep-Alive }); })); From 380929ec0c4c4004b522bed5e3800ebce2b68bfd Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 3 May 2017 21:07:54 -0700 Subject: [PATCH 02/13] test: remove common.noop This change removes `common.noop` from the Node.js internal testing common module. Over the last few weeks, I've grown to dislike the `common.noop` abstraction. First, new (and experienced) contributors are unaware of it and so it results in a large number of low-value nits on PRs. It also increases the number of things newcomers and infrequent contributors have to be aware of to be effective on the project. Second, it is confusing. Is it a singleton/property or a getter? Which should be expected? This can lead to subtle and hard-to-find bugs. (To my knowledge, none have landed on master. But I also think it's only a matter of time.) Third, the abstraction is low-value in my opinion. What does it really get us? A case could me made that it is without value at all. Lastly, and this is minor, but the abstraction is wordier than not using the abstraction. `common.noop` doesn't save anything over `() => {}`. So, I propose removing it. PR-URL: https://github.com/nodejs/node/pull/12822 Reviewed-By: Teddy Katz Reviewed-By: Timothy Gu Reviewed-By: Benjamin Gruenbaum Reviewed-By: Gibson Fahnestock Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann --- test/common/README.md | 21 ++++--------------- test/common/index.js | 1 - .../unhandled_promise_trace_warnings.js | 4 ++-- test/parallel/test-assert.js | 9 ++++---- test/parallel/test-buffer-includes.js | 4 ++-- test/parallel/test-child-process-bad-stdio.js | 2 +- ...est-child-process-spawnsync-kill-signal.js | 2 +- .../parallel/test-cluster-rr-domain-listen.js | 6 +++--- .../test-cluster-worker-wait-server-close.js | 4 ++-- test/parallel/test-common.js | 2 +- test/parallel/test-console-instance.js | 2 +- .../test-event-emitter-get-max-listeners.js | 6 +++--- .../test-event-emitter-listener-count.js | 10 ++++----- ...-emitter-max-listeners-warning-for-null.js | 4 ++-- ...mitter-max-listeners-warning-for-symbol.js | 4 ++-- ...est-event-emitter-max-listeners-warning.js | 6 +++--- .../test-event-emitter-remove-listeners.js | 4 ++-- .../test-event-emitter-special-event-names.js | 2 +- test/parallel/test-event-emitter-subclass.js | 2 +- test/parallel/test-events-list.js | 1 - test/parallel/test-fs-buffertype-writesync.js | 2 +- test/parallel/test-fs-mkdir.js | 2 +- test/parallel/test-handle-wrap-isrefed.js | 4 ++-- test/parallel/test-http-client-defaults.js | 8 +++---- test/parallel/test-http-parser-bad-ref.js | 4 ++-- test/parallel/test-http-upgrade-server.js | 4 ++-- test/parallel/test-https-close.js | 2 +- test/parallel/test-https-socket-options.js | 4 ++-- test/parallel/test-instanceof.js | 4 ++-- .../test-net-listen-exclusive-random-ports.js | 4 ++-- test/parallel/test-net-options-lookup.js | 4 ++-- test/parallel/test-net-socket-timeout.js | 8 +++---- test/parallel/test-net-stream.js | 4 ++-- test/parallel/test-no-enter-tickcallback.js | 2 +- .../test-process-getactiverequests.js | 4 ++-- ...promises-warning-on-unhandled-rejection.js | 2 +- test/parallel/test-readline-interface.js | 8 +++---- test/parallel/test-readline-keys.js | 2 +- test/parallel/test-regress-GH-4948.js | 6 +++--- test/parallel/test-regress-GH-5051.js | 4 ++-- ...test-repl-function-definition-edge-case.js | 2 +- test/parallel/test-repl-history-perm.js | 2 +- test/parallel/test-repl-mode.js | 2 +- test/parallel/test-repl-save-load.js | 6 +++--- test/parallel/test-repl-tab-complete-crash.js | 2 +- .../test-stream-decoder-objectmode.js | 4 ++-- test/parallel/test-stream-duplex.js | 4 ++-- test/parallel/test-stream-pipe-await-drain.js | 2 +- .../test-stream-pipe-cleanup-pause.js | 2 +- .../test-stream-pipe-error-handling.js | 4 ++-- .../test-stream-pipe-multiple-pipes.js | 2 +- .../test-stream-pipe-unpipe-streams.js | 6 +++--- .../test-stream-readable-emittedReadable.js | 6 +++--- .../test-stream-readable-invalid-chunk.js | 4 ++-- .../test-stream-readable-needReadable.js | 8 +++---- .../test-stream-readableListening-state.js | 4 ++-- .../test-stream2-pipe-error-once-listener.js | 4 ++-- .../test-stream2-readable-wrap-empty.js | 6 +++--- test/parallel/test-timers-unref-call.js | 4 ++-- ...-timers-unref-remove-other-unref-timers.js | 2 +- test/parallel/test-timers-unref.js | 8 +++---- .../test-timers-unrefed-in-beforeexit.js | 4 ++-- test/parallel/test-timers-zero-timeout.js | 2 +- test/parallel/test-util-inspect.js | 6 +++--- .../test-vm-sigint-existing-handler.js | 2 +- test/parallel/test-whatwg-url-parsing.js | 2 +- test/pseudo-tty/ref_keeps_node_running.js | 4 ++-- 67 files changed, 134 insertions(+), 148 deletions(-) diff --git a/test/common/README.md b/test/common/README.md index f418115ce31..0502cacaf60 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -209,7 +209,7 @@ Gets IP of localhost Array of IPV6 hosts. ### mustCall([fn][, exact]) -* `fn` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = `common.noop` +* `fn` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = () => {} * `exact` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 * return [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) @@ -217,10 +217,10 @@ Returns a function that calls `fn`. If the returned function has not been called exactly `expected` number of times when the test is complete, then the test will fail. -If `fn` is not provided, `common.noop` will be used. +If `fn` is not provided, an empty function will be used. ### mustCallAtLeast([fn][, minimum]) -* `fn` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = `common.noop` +* `fn` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = () => {} * `minimum` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 * return [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) @@ -228,7 +228,7 @@ Returns a function that calls `fn`. If the returned function has not been called at least `minimum` number of times when the test is complete, then the test will fail. -If `fn` is not provided, `common.noop` will be used. +If `fn` is not provided, an empty function will be used. ### mustNotCall([msg]) * `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) default = 'function should not have been called' @@ -243,19 +243,6 @@ Returns a function that triggers an `AssertionError` if it is invoked. `msg` is Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise. -### noop - -A non-op `Function` that can be used for a variety of scenarios. - -For instance, - - -```js -const common = require('../common'); - -someAsyncAPI('foo', common.mustCall(common.noop)); -``` - ### opensslCli * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) diff --git a/test/common/index.js b/test/common/index.js index 5c820211d72..e3e53f4574a 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -37,7 +37,6 @@ const testRoot = process.env.NODE_TEST_DIR ? const noop = () => {}; -exports.noop = noop; exports.fixturesDir = path.join(__dirname, '..', 'fixtures'); exports.tmpDirName = 'tmp'; // PORT should match the definition in test/testpy/__init__.py. diff --git a/test/message/unhandled_promise_trace_warnings.js b/test/message/unhandled_promise_trace_warnings.js index 8aad957fb5c..48450fb21e2 100644 --- a/test/message/unhandled_promise_trace_warnings.js +++ b/test/message/unhandled_promise_trace_warnings.js @@ -1,5 +1,5 @@ // Flags: --trace-warnings 'use strict'; -const common = require('../common'); +require('../common'); const p = Promise.reject(new Error('This was rejected')); -setImmediate(() => p.catch(common.noop)); +setImmediate(() => p.catch(() => {})); diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 0054705df45..382123ef870 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -571,29 +571,30 @@ a.throws(makeBlock(a.deepEqual, args, [])); // check messages from assert.throws() { + const noop = () => {}; assert.throws( - () => { a.throws(common.noop); }, + () => { a.throws((noop)); }, common.expectsError({ code: 'ERR_ASSERTION', message: /^Missing expected exception\.$/ })); assert.throws( - () => { a.throws(common.noop, TypeError); }, + () => { a.throws(noop, TypeError); }, common.expectsError({ code: 'ERR_ASSERTION', message: /^Missing expected exception \(TypeError\)\.$/ })); assert.throws( - () => { a.throws(common.noop, 'fhqwhgads'); }, + () => { a.throws(noop, 'fhqwhgads'); }, common.expectsError({ code: 'ERR_ASSERTION', message: /^Missing expected exception: fhqwhgads$/ })); assert.throws( - () => { a.throws(common.noop, TypeError, 'fhqwhgads'); }, + () => { a.throws(noop, TypeError, 'fhqwhgads'); }, common.expectsError({ code: 'ERR_ASSERTION', message: /^Missing expected exception \(TypeError\): fhqwhgads$/ diff --git a/test/parallel/test-buffer-includes.js b/test/parallel/test-buffer-includes.js index 9ce9578b3a1..a114ad264e5 100644 --- a/test/parallel/test-buffer-includes.js +++ b/test/parallel/test-buffer-includes.js @@ -1,5 +1,5 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const b = Buffer.from('abcdef'); @@ -274,7 +274,7 @@ for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { const expectedError = /^TypeError: "val" argument must be string, number, Buffer or Uint8Array$/; assert.throws(() => { - b.includes(common.noop); + b.includes(() => {}); }, expectedError); assert.throws(() => { b.includes({}); diff --git a/test/parallel/test-child-process-bad-stdio.js b/test/parallel/test-child-process-bad-stdio.js index 2e06f4e2b12..45294d7d82d 100644 --- a/test/parallel/test-child-process-bad-stdio.js +++ b/test/parallel/test-child-process-bad-stdio.js @@ -5,7 +5,7 @@ const assert = require('assert'); const cp = require('child_process'); if (process.argv[2] === 'child') { - setTimeout(common.noop, common.platformTimeout(100)); + setTimeout(() => {}, common.platformTimeout(100)); return; } diff --git a/test/parallel/test-child-process-spawnsync-kill-signal.js b/test/parallel/test-child-process-spawnsync-kill-signal.js index 90d6225223e..73063e7f386 100644 --- a/test/parallel/test-child-process-spawnsync-kill-signal.js +++ b/test/parallel/test-child-process-spawnsync-kill-signal.js @@ -5,7 +5,7 @@ const assert = require('assert'); const cp = require('child_process'); if (process.argv[2] === 'child') { - setInterval(common.noop, 1000); + setInterval(() => {}, 1000); } else { const internalCp = require('internal/child_process'); const oldSpawnSync = internalCp.spawnSync; diff --git a/test/parallel/test-cluster-rr-domain-listen.js b/test/parallel/test-cluster-rr-domain-listen.js index 4b511d0d204..45e1200a3d6 100644 --- a/test/parallel/test-cluster-rr-domain-listen.js +++ b/test/parallel/test-cluster-rr-domain-listen.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const cluster = require('cluster'); const domain = require('domain'); @@ -29,10 +29,10 @@ const domain = require('domain'); if (cluster.isWorker) { const d = domain.create(); - d.run(common.noop); + d.run(() => {}); const http = require('http'); - http.Server(common.noop).listen(0, '127.0.0.1'); + http.Server(() => {}).listen(0, '127.0.0.1'); } else if (cluster.isMaster) { diff --git a/test/parallel/test-cluster-worker-wait-server-close.js b/test/parallel/test-cluster-worker-wait-server-close.js index a563d52beb3..b8183afb06a 100644 --- a/test/parallel/test-cluster-worker-wait-server-close.js +++ b/test/parallel/test-cluster-worker-wait-server-close.js @@ -11,7 +11,7 @@ if (cluster.isWorker) { const server = net.createServer(function(socket) { // Wait for any data, then close connection socket.write('.'); - socket.on('data', common.noop); + socket.on('data', () => {}); }).listen(0, common.localhostIPv4); server.once('close', function() { @@ -20,7 +20,7 @@ if (cluster.isWorker) { // Although not typical, the worker process can exit before the disconnect // event fires. Use this to keep the process open until the event has fired. - const keepOpen = setInterval(common.noop, 9999); + const keepOpen = setInterval(() => {}, 9999); // Check worker events and properties process.once('disconnect', function() { diff --git a/test/parallel/test-common.js b/test/parallel/test-common.js index 47ed7d9f313..819cd815538 100644 --- a/test/parallel/test-common.js +++ b/test/parallel/test-common.js @@ -101,7 +101,7 @@ const HIJACK_TEST_ARRAY = [ 'foo\n', 'bar\n', 'baz\n' ]; assert.notStrictEqual(originalWrite, stream.write); HIJACK_TEST_ARRAY.forEach((val) => { - stream.write(val, common.mustCall(common.noop)); + stream.write(val, common.mustCall()); }); assert.strictEqual(HIJACK_TEST_ARRAY.length, stream.writeTimes); diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index 1e68de3f6eb..20ac2ceb72a 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -49,7 +49,7 @@ assert.throws( // Console constructor should throw if stderr exists but is not writable assert.throws( () => { - out.write = common.noop; + out.write = () => {}; err.write = undefined; new Console(out, err); }, diff --git a/test/parallel/test-event-emitter-get-max-listeners.js b/test/parallel/test-event-emitter-get-max-listeners.js index 98ac02e8713..43f9f0cebc4 100644 --- a/test/parallel/test-event-emitter-get-max-listeners.js +++ b/test/parallel/test-event-emitter-get-max-listeners.js @@ -1,5 +1,5 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const EventEmitter = require('events'); @@ -15,5 +15,5 @@ assert.strictEqual(emitter.getMaxListeners(), 3); // https://github.com/nodejs/node/issues/523 - second call should not throw. const recv = {}; -EventEmitter.prototype.on.call(recv, 'event', common.noop); -EventEmitter.prototype.on.call(recv, 'event', common.noop); +EventEmitter.prototype.on.call(recv, 'event', () => {}); +EventEmitter.prototype.on.call(recv, 'event', () => {}); diff --git a/test/parallel/test-event-emitter-listener-count.js b/test/parallel/test-event-emitter-listener-count.js index 50247f42770..117d38f575d 100644 --- a/test/parallel/test-event-emitter-listener-count.js +++ b/test/parallel/test-event-emitter-listener-count.js @@ -1,15 +1,15 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const EventEmitter = require('events'); const emitter = new EventEmitter(); -emitter.on('foo', common.noop); -emitter.on('foo', common.noop); -emitter.on('baz', common.noop); +emitter.on('foo', () => {}); +emitter.on('foo', () => {}); +emitter.on('baz', () => {}); // Allow any type -emitter.on(123, common.noop); +emitter.on(123, () => {}); assert.strictEqual(EventEmitter.listenerCount(emitter, 'foo'), 2); assert.strictEqual(emitter.listenerCount('foo'), 2); diff --git a/test/parallel/test-event-emitter-max-listeners-warning-for-null.js b/test/parallel/test-event-emitter-max-listeners-warning-for-null.js index c8a904b9bb6..2929e1c7093 100644 --- a/test/parallel/test-event-emitter-max-listeners-warning-for-null.js +++ b/test/parallel/test-event-emitter-max-listeners-warning-for-null.js @@ -18,5 +18,5 @@ process.on('warning', common.mustCall((warning) => { assert.ok(warning.message.includes('2 null listeners added.')); })); -e.on(null, common.noop); -e.on(null, common.noop); +e.on(null, () => {}); +e.on(null, () => {}); diff --git a/test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js b/test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js index 551c1276b85..51c31ba0cf2 100644 --- a/test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js +++ b/test/parallel/test-event-emitter-max-listeners-warning-for-symbol.js @@ -20,5 +20,5 @@ process.on('warning', common.mustCall((warning) => { assert.ok(warning.message.includes('2 Symbol(symbol) listeners added.')); })); -e.on(symbol, common.noop); -e.on(symbol, common.noop); +e.on(symbol, () => {}); +e.on(symbol, () => {}); diff --git a/test/parallel/test-event-emitter-max-listeners-warning.js b/test/parallel/test-event-emitter-max-listeners-warning.js index 1a4a1b8bf2a..0be7fc84bce 100644 --- a/test/parallel/test-event-emitter-max-listeners-warning.js +++ b/test/parallel/test-event-emitter-max-listeners-warning.js @@ -18,6 +18,6 @@ process.on('warning', common.mustCall((warning) => { assert.ok(warning.message.includes('2 event-type listeners added.')); })); -e.on('event-type', common.noop); -e.on('event-type', common.noop); // Trigger warning. -e.on('event-type', common.noop); // Verify that warning is emitted only once. +e.on('event-type', () => {}); +e.on('event-type', () => {}); // Trigger warning. +e.on('event-type', () => {}); // Verify that warning is emitted only once. diff --git a/test/parallel/test-event-emitter-remove-listeners.js b/test/parallel/test-event-emitter-remove-listeners.js index 01ed0141354..d1c01e0bc3c 100644 --- a/test/parallel/test-event-emitter-remove-listeners.js +++ b/test/parallel/test-event-emitter-remove-listeners.js @@ -140,7 +140,7 @@ function listener2() {} { const ee = new EventEmitter(); - assert.deepStrictEqual(ee, ee.removeListener('foo', common.noop)); + assert.deepStrictEqual(ee, ee.removeListener('foo', () => {})); } // Verify that the removed listener must be a function @@ -152,7 +152,7 @@ assert.throws(() => { { const ee = new EventEmitter(); - const listener = common.noop; + const listener = () => {}; ee._events = undefined; const e = ee.removeListener('foo', listener); assert.strictEqual(e, ee); diff --git a/test/parallel/test-event-emitter-special-event-names.js b/test/parallel/test-event-emitter-special-event-names.js index 116cdfcc16a..7ff781f0f90 100644 --- a/test/parallel/test-event-emitter-special-event-names.js +++ b/test/parallel/test-event-emitter-special-event-names.js @@ -5,7 +5,7 @@ const EventEmitter = require('events'); const assert = require('assert'); const ee = new EventEmitter(); -const handler = common.noop; +const handler = () => {}; assert.deepStrictEqual(ee.eventNames(), []); diff --git a/test/parallel/test-event-emitter-subclass.js b/test/parallel/test-event-emitter-subclass.js index 00ebd1e3567..5189c3aa134 100644 --- a/test/parallel/test-event-emitter-subclass.js +++ b/test/parallel/test-event-emitter-subclass.js @@ -62,6 +62,6 @@ MyEE2.prototype = new EventEmitter(); const ee1 = new MyEE2(); const ee2 = new MyEE2(); -ee1.on('x', common.noop); +ee1.on('x', () => {}); assert.strictEqual(ee2.listenerCount('x'), 0); diff --git a/test/parallel/test-events-list.js b/test/parallel/test-events-list.js index 5d2e8c019a1..4e589b07f2d 100644 --- a/test/parallel/test-events-list.js +++ b/test/parallel/test-events-list.js @@ -5,7 +5,6 @@ const EventEmitter = require('events'); const assert = require('assert'); const EE = new EventEmitter(); -// Do not use common.noop here, these need to be separate listener functions const m = () => {}; EE.on('foo', () => {}); assert.deepStrictEqual(['foo'], EE.eventNames()); diff --git a/test/parallel/test-fs-buffertype-writesync.js b/test/parallel/test-fs-buffertype-writesync.js index 02d2cb58f83..73a6f211893 100644 --- a/test/parallel/test-fs-buffertype-writesync.js +++ b/test/parallel/test-fs-buffertype-writesync.js @@ -9,7 +9,7 @@ const fs = require('fs'); const path = require('path'); const filePath = path.join(common.tmpDir, 'test_buffer_type'); -const v = [true, false, 0, 1, Infinity, common.noop, {}, [], undefined, null]; +const v = [true, false, 0, 1, Infinity, () => {}, {}, [], undefined, null]; common.refreshTmpDir(); diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index 17a945c9753..679e0b255ac 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -77,4 +77,4 @@ common.refreshTmpDir(); // Keep the event loop alive so the async mkdir() requests // have a chance to run (since they don't ref the event loop). -process.nextTick(common.noop); +process.nextTick(() => {}); diff --git a/test/parallel/test-handle-wrap-isrefed.js b/test/parallel/test-handle-wrap-isrefed.js index c027b6f2d1a..66353fcc036 100644 --- a/test/parallel/test-handle-wrap-isrefed.js +++ b/test/parallel/test-handle-wrap-isrefed.js @@ -87,7 +87,7 @@ const strictEqual = require('assert').strictEqual; // tcp { const net = require('net'); - const server = net.createServer(common.noop).listen(0); + const server = net.createServer(() => {}).listen(0); strictEqual(Object.getPrototypeOf(server._handle).hasOwnProperty('hasRef'), true, 'tcp_wrap: hasRef() missing'); strictEqual(server._handle.hasRef(), @@ -112,7 +112,7 @@ const strictEqual = require('assert').strictEqual; // timers { - const timer = setTimeout(common.noop, 500); + const timer = setTimeout(() => {}, 500); timer.unref(); strictEqual(Object.getPrototypeOf(timer._handle).hasOwnProperty('hasRef'), true, 'timer_wrap: hasRef() missing'); diff --git a/test/parallel/test-http-client-defaults.js b/test/parallel/test-http-client-defaults.js index 57ac0e99d65..43419d1dfd6 100644 --- a/test/parallel/test-http-client-defaults.js +++ b/test/parallel/test-http-client-defaults.js @@ -1,23 +1,23 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const ClientRequest = require('http').ClientRequest; { - const req = new ClientRequest({ createConnection: common.noop }); + const req = new ClientRequest({ createConnection: () => {} }); assert.strictEqual(req.path, '/'); assert.strictEqual(req.method, 'GET'); } { - const req = new ClientRequest({ method: '', createConnection: common.noop }); + const req = new ClientRequest({ method: '', createConnection: () => {} }); assert.strictEqual(req.path, '/'); assert.strictEqual(req.method, 'GET'); } { - const req = new ClientRequest({ path: '', createConnection: common.noop }); + const req = new ClientRequest({ path: '', createConnection: () => {} }); assert.strictEqual(req.path, '/'); assert.strictEqual(req.method, 'GET'); } diff --git a/test/parallel/test-http-parser-bad-ref.js b/test/parallel/test-http-parser-bad-ref.js index 70c6a1e515c..6e9fb2f9ac6 100644 --- a/test/parallel/test-http-parser-bad-ref.js +++ b/test/parallel/test-http-parser-bad-ref.js @@ -4,7 +4,7 @@ // Flags: --expose_gc -const common = require('../common'); +require('../common'); const assert = require('assert'); const HTTPParser = process.binding('http_parser').HTTPParser; @@ -39,7 +39,7 @@ function demoBug(part1, part2) { console.log('url', info.url); }; - parser[kOnBody] = common.noop; + parser[kOnBody] = () => {}; parser[kOnMessageComplete] = function() { messagesComplete++; diff --git a/test/parallel/test-http-upgrade-server.js b/test/parallel/test-http-upgrade-server.js index 11c0aba5b4d..3b91afc03fb 100644 --- a/test/parallel/test-http-upgrade-server.js +++ b/test/parallel/test-http-upgrade-server.js @@ -21,7 +21,7 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const util = require('util'); @@ -38,7 +38,7 @@ function createTestServer() { } function testServer() { - http.Server.call(this, common.noop); + http.Server.call(this, () => {}); this.on('connection', function() { requests_recv++; diff --git a/test/parallel/test-https-close.js b/test/parallel/test-https-close.js index e32e2531474..4c4dea577c0 100644 --- a/test/parallel/test-https-close.js +++ b/test/parallel/test-https-close.js @@ -49,7 +49,7 @@ server.listen(0, function() { }; const req = https.request(requestOptions, function(res) { - res.on('data', common.noop); + res.on('data', () => {}); setImmediate(shutdown); }); req.end(); diff --git a/test/parallel/test-https-socket-options.js b/test/parallel/test-https-socket-options.js index 3718d3809cc..d6f6aaae7af 100644 --- a/test/parallel/test-https-socket-options.js +++ b/test/parallel/test-https-socket-options.js @@ -58,7 +58,7 @@ server_http.listen(0, function() { }); // These methods should exist on the request and get passed down to the socket req.setNoDelay(true); - req.setTimeout(1000, common.noop); + req.setTimeout(1000, () => {}); req.setSocketKeepAlive(true, 1000); req.end(); }); @@ -82,7 +82,7 @@ server_https.listen(0, function() { }); // These methods should exist on the request and get passed down to the socket req.setNoDelay(true); - req.setTimeout(1000, common.noop); + req.setTimeout(1000, () => {}); req.setSocketKeepAlive(true, 1000); req.end(); }); diff --git a/test/parallel/test-instanceof.js b/test/parallel/test-instanceof.js index c3d4ece42ab..658f1e29c7a 100644 --- a/test/parallel/test-instanceof.js +++ b/test/parallel/test-instanceof.js @@ -1,11 +1,11 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); // Regression test for instanceof, see // https://github.com/nodejs/node/issues/7592 -const F = common.noop; +const F = () => {}; F.prototype = {}; assert(Object.create(F.prototype) instanceof F); diff --git a/test/parallel/test-net-listen-exclusive-random-ports.js b/test/parallel/test-net-listen-exclusive-random-ports.js index 9ca023cfa40..00d5e73cb17 100644 --- a/test/parallel/test-net-listen-exclusive-random-ports.js +++ b/test/parallel/test-net-listen-exclusive-random-ports.js @@ -1,6 +1,6 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); @@ -20,7 +20,7 @@ if (cluster.isMaster) { }); }); } else { - const server = net.createServer(common.noop); + const server = net.createServer(() => {}); server.on('error', function(err) { process.send(err.code); diff --git a/test/parallel/test-net-options-lookup.js b/test/parallel/test-net-options-lookup.js index c61f338b701..f0e8b34c807 100644 --- a/test/parallel/test-net-options-lookup.js +++ b/test/parallel/test-net-options-lookup.js @@ -1,5 +1,5 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const net = require('net'); @@ -20,7 +20,7 @@ function connectThrows(input) { }, expectedError); } -connectDoesNotThrow(common.noop); +connectDoesNotThrow(() => {}); function connectDoesNotThrow(input) { const opts = { diff --git a/test/parallel/test-net-socket-timeout.js b/test/parallel/test-net-socket-timeout.js index 0319e181739..de4a7ed37cc 100644 --- a/test/parallel/test-net-socket-timeout.js +++ b/test/parallel/test-net-socket-timeout.js @@ -27,7 +27,7 @@ const assert = require('assert'); // Verify that invalid delays throw const s = new net.Socket(); const nonNumericDelays = [ - '100', true, false, undefined, null, '', {}, common.noop, [] + '100', true, false, undefined, null, '', {}, () => {}, [] ]; const badRangeDelays = [-0.001, -1, -Infinity, Infinity, NaN]; const validDelays = [0, 0.001, 1, 1e6]; @@ -35,19 +35,19 @@ const validDelays = [0, 0.001, 1, 1e6]; for (let i = 0; i < nonNumericDelays.length; i++) { assert.throws(function() { - s.setTimeout(nonNumericDelays[i], common.noop); + s.setTimeout(nonNumericDelays[i], () => {}); }, TypeError); } for (let i = 0; i < badRangeDelays.length; i++) { assert.throws(function() { - s.setTimeout(badRangeDelays[i], common.noop); + s.setTimeout(badRangeDelays[i], () => {}); }, RangeError); } for (let i = 0; i < validDelays.length; i++) { assert.doesNotThrow(function() { - s.setTimeout(validDelays[i], common.noop); + s.setTimeout(validDelays[i], () => {}); }); } diff --git a/test/parallel/test-net-stream.js b/test/parallel/test-net-stream.js index 1eb984936c0..4690cf7c905 100644 --- a/test/parallel/test-net-stream.js +++ b/test/parallel/test-net-stream.js @@ -21,7 +21,7 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const net = require('net'); @@ -54,7 +54,7 @@ const server = net.createServer(function(socket) { }); for (let i = 0; i < N; ++i) { - socket.write(buf, common.noop); + socket.write(buf, () => {}); } socket.end(); diff --git a/test/parallel/test-no-enter-tickcallback.js b/test/parallel/test-no-enter-tickcallback.js index 34c7eb8e08e..aab22c5f3ed 100644 --- a/test/parallel/test-no-enter-tickcallback.js +++ b/test/parallel/test-no-enter-tickcallback.js @@ -27,6 +27,6 @@ setImmediate(common.mustCall(() => { require('domain'); setImmediate(common.mustCall(() => setImmediate(common.mustCall(() => { allsGood = true; - process.nextTick(common.noop); + process.nextTick(() => {}); })))); })); diff --git a/test/parallel/test-process-getactiverequests.js b/test/parallel/test-process-getactiverequests.js index 2885eb86137..f55f298298d 100644 --- a/test/parallel/test-process-getactiverequests.js +++ b/test/parallel/test-process-getactiverequests.js @@ -1,10 +1,10 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const fs = require('fs'); for (let i = 0; i < 12; i++) - fs.open(__filename, 'r', common.noop); + fs.open(__filename, 'r', () => {}); assert.strictEqual(12, process._getActiveRequests().length); diff --git a/test/parallel/test-promises-warning-on-unhandled-rejection.js b/test/parallel/test-promises-warning-on-unhandled-rejection.js index f3c7a8771e9..10f95162a09 100644 --- a/test/parallel/test-promises-warning-on-unhandled-rejection.js +++ b/test/parallel/test-promises-warning-on-unhandled-rejection.js @@ -26,4 +26,4 @@ process.on('warning', common.mustCall((warning) => { }, 3)); const p = Promise.reject('This was rejected'); -setImmediate(common.mustCall(() => p.catch(common.noop))); +setImmediate(common.mustCall(() => p.catch(() => {}))); diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 5d77119cdd2..9acfb5421d0 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -34,10 +34,10 @@ function FakeInput() { EventEmitter.call(this); } inherits(FakeInput, EventEmitter); -FakeInput.prototype.resume = common.noop; -FakeInput.prototype.pause = common.noop; -FakeInput.prototype.write = common.noop; -FakeInput.prototype.end = common.noop; +FakeInput.prototype.resume = () => {}; +FakeInput.prototype.pause = () => {}; +FakeInput.prototype.write = () => {}; +FakeInput.prototype.end = () => {}; function isWarned(emitter) { for (const name in emitter) { diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index 6b46874f72b..1b05b06f58f 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -298,7 +298,7 @@ const runKeyIntervalTests = [ { name: 'escape', sequence: '\x1b', meta: true }, { name: 'escape', sequence: '\x1b', meta: true } ]) -].reverse().reduce((acc, fn) => fn(acc), common.noop); +].reverse().reduce((acc, fn) => fn(acc), () => {}); // run key interval tests one after another runKeyIntervalTests(); diff --git a/test/parallel/test-regress-GH-4948.js b/test/parallel/test-regress-GH-4948.js index bdf60e2e539..5ec79b8685b 100644 --- a/test/parallel/test-regress-GH-4948.js +++ b/test/parallel/test-regress-GH-4948.js @@ -1,7 +1,7 @@ 'use strict'; // https://github.com/joyent/node/issues/4948 -const common = require('../common'); +require('../common'); const http = require('http'); let reqCount = 0; @@ -22,10 +22,10 @@ const server = http.createServer(function(serverReq, serverRes) { serverRes.end(); // required for test to fail - res.on('data', common.noop); + res.on('data', () => {}); }); - r.on('error', common.noop); + r.on('error', () => {}); r.end(); serverRes.write('some data'); diff --git a/test/parallel/test-regress-GH-5051.js b/test/parallel/test-regress-GH-5051.js index f0a2d7aa7f1..0fef879c6f1 100644 --- a/test/parallel/test-regress-GH-5051.js +++ b/test/parallel/test-regress-GH-5051.js @@ -1,11 +1,11 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const agent = require('http').globalAgent; // small stub just so we can call addRequest directly const req = { - getHeader: common.noop + getHeader: () => {} }; agent.maxSockets = 0; diff --git a/test/parallel/test-repl-function-definition-edge-case.js b/test/parallel/test-repl-function-definition-edge-case.js index 90234eb1313..1e3063e3db5 100644 --- a/test/parallel/test-repl-function-definition-edge-case.js +++ b/test/parallel/test-repl-function-definition-edge-case.js @@ -19,7 +19,7 @@ assert.strictEqual(got, expected); function initRepl() { const input = new stream(); - input.write = input.pause = input.resume = common.noop; + input.write = input.pause = input.resume = () => {}; input.readable = true; const output = new stream(); diff --git a/test/parallel/test-repl-history-perm.js b/test/parallel/test-repl-history-perm.js index ebca7c97256..1a98999c3be 100644 --- a/test/parallel/test-repl-history-perm.js +++ b/test/parallel/test-repl-history-perm.js @@ -19,7 +19,7 @@ const Duplex = require('stream').Duplex; // and mode 600. const stream = new Duplex(); -stream.pause = stream.resume = common.noop; +stream.pause = stream.resume = () => {}; // ends immediately stream._read = function() { this.push(null); diff --git a/test/parallel/test-repl-mode.js b/test/parallel/test-repl-mode.js index cf492a7e4b3..5606200859e 100644 --- a/test/parallel/test-repl-mode.js +++ b/test/parallel/test-repl-mode.js @@ -52,7 +52,7 @@ function testAutoMode() { function initRepl(mode) { const input = new Stream(); - input.write = input.pause = input.resume = common.noop; + input.write = input.pause = input.resume = () => {}; input.readable = true; const output = new Stream(); diff --git a/test/parallel/test-repl-save-load.js b/test/parallel/test-repl-save-load.js index 746f6f2b6cd..4ef2a633541 100644 --- a/test/parallel/test-repl-save-load.js +++ b/test/parallel/test-repl-save-load.js @@ -98,7 +98,7 @@ putIn.write = function(data) { // make sure I get a failed to load message and not some crazy error assert.strictEqual(data, `Failed to load:${loadFile}\n`); // eat me to avoid work - putIn.write = common.noop; + putIn.write = () => {}; }; putIn.run([`.load ${loadFile}`]); @@ -106,7 +106,7 @@ putIn.run([`.load ${loadFile}`]); loadFile = common.tmpDir; putIn.write = function(data) { assert.strictEqual(data, `Failed to load:${loadFile} is not a valid file\n`); - putIn.write = common.noop; + putIn.write = () => {}; }; putIn.run([`.load ${loadFile}`]); @@ -122,7 +122,7 @@ putIn.write = function(data) { // make sure I get a failed to save message and not some other error assert.strictEqual(data, `Failed to save:${invalidFileName}\n`); // reset to no-op - putIn.write = common.noop; + putIn.write = () => {}; }; // save it to a file diff --git a/test/parallel/test-repl-tab-complete-crash.js b/test/parallel/test-repl-tab-complete-crash.js index fe9c1573666..ba8de7888e3 100644 --- a/test/parallel/test-repl-tab-complete-crash.js +++ b/test/parallel/test-repl-tab-complete-crash.js @@ -4,7 +4,7 @@ const common = require('../common'); const assert = require('assert'); const repl = require('repl'); -common.ArrayStream.prototype.write = common.noop; +common.ArrayStream.prototype.write = () => {}; const putIn = new common.ArrayStream(); const testMe = repl.start('', putIn); diff --git a/test/parallel/test-stream-decoder-objectmode.js b/test/parallel/test-stream-decoder-objectmode.js index b536fbc4e8d..4c572fed6b6 100644 --- a/test/parallel/test-stream-decoder-objectmode.js +++ b/test/parallel/test-stream-decoder-objectmode.js @@ -1,11 +1,11 @@ 'use strict'; -const common = require('../common'); +require('../common'); const stream = require('stream'); const assert = require('assert'); const readable = new stream.Readable({ - read: common.noop, + read: () => {}, encoding: 'utf16le', objectMode: true }); diff --git a/test/parallel/test-stream-duplex.js b/test/parallel/test-stream-duplex.js index f0c8a47a507..1cc54db0520 100644 --- a/test/parallel/test-stream-duplex.js +++ b/test/parallel/test-stream-duplex.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const Duplex = require('stream').Duplex; @@ -38,7 +38,7 @@ stream._write = (obj, _, cb) => { cb(); }; -stream._read = common.noop; +stream._read = () => {}; stream.on('data', (obj) => { read = obj; diff --git a/test/parallel/test-stream-pipe-await-drain.js b/test/parallel/test-stream-pipe-await-drain.js index b90a9d0edd1..5bdf4800847 100644 --- a/test/parallel/test-stream-pipe-await-drain.js +++ b/test/parallel/test-stream-pipe-await-drain.js @@ -15,7 +15,7 @@ const writer3 = new stream.Writable(); // See: https://github.com/nodejs/node/issues/5820 const buffer = Buffer.allocUnsafe(560000); -reader._read = common.noop; +reader._read = () => {}; writer1._write = common.mustCall(function(chunk, encoding, cb) { this.emit('chunk-received'); diff --git a/test/parallel/test-stream-pipe-cleanup-pause.js b/test/parallel/test-stream-pipe-cleanup-pause.js index 2f3754de3ee..3cdab94648d 100644 --- a/test/parallel/test-stream-pipe-cleanup-pause.js +++ b/test/parallel/test-stream-pipe-cleanup-pause.js @@ -11,7 +11,7 @@ const writer2 = new stream.Writable(); // See: https://github.com/nodejs/node/issues/2323 const buffer = Buffer.allocUnsafe(560000); -reader._read = common.noop; +reader._read = () => {}; writer1._write = common.mustCall(function(chunk, encoding, cb) { this.emit('chunk-received'); diff --git a/test/parallel/test-stream-pipe-error-handling.js b/test/parallel/test-stream-pipe-error-handling.js index e7eca593e76..e725465e079 100644 --- a/test/parallel/test-stream-pipe-error-handling.js +++ b/test/parallel/test-stream-pipe-error-handling.js @@ -101,10 +101,10 @@ const Stream = require('stream').Stream; }); w.on('error', common.mustCall()); - w._write = common.noop; + w._write = () => {}; r.pipe(w); // Removing some OTHER random listener should not do anything - w.removeListener('error', common.noop); + w.removeListener('error', () => {}); removed = true; } diff --git a/test/parallel/test-stream-pipe-multiple-pipes.js b/test/parallel/test-stream-pipe-multiple-pipes.js index d89dcbd9476..890c274b9d9 100644 --- a/test/parallel/test-stream-pipe-multiple-pipes.js +++ b/test/parallel/test-stream-pipe-multiple-pipes.js @@ -4,7 +4,7 @@ const stream = require('stream'); const assert = require('assert'); const readable = new stream.Readable({ - read: common.noop + read: () => {} }); const writables = []; diff --git a/test/parallel/test-stream-pipe-unpipe-streams.js b/test/parallel/test-stream-pipe-unpipe-streams.js index 067b7f44820..916bd2cdfac 100644 --- a/test/parallel/test-stream-pipe-unpipe-streams.js +++ b/test/parallel/test-stream-pipe-unpipe-streams.js @@ -4,9 +4,9 @@ const assert = require('assert'); const { Readable, Writable } = require('stream'); -const source = Readable({read: common.noop}); -const dest1 = Writable({write: common.noop}); -const dest2 = Writable({write: common.noop}); +const source = Readable({read: () => {}}); +const dest1 = Writable({write: () => {}}); +const dest2 = Writable({write: () => {}}); source.pipe(dest1); source.pipe(dest2); diff --git a/test/parallel/test-stream-readable-emittedReadable.js b/test/parallel/test-stream-readable-emittedReadable.js index 82d8b645efe..65b6b5b15a5 100644 --- a/test/parallel/test-stream-readable-emittedReadable.js +++ b/test/parallel/test-stream-readable-emittedReadable.js @@ -4,7 +4,7 @@ const assert = require('assert'); const Readable = require('stream').Readable; const readable = new Readable({ - read: common.noop + read: () => {} }); // Initialized to false. @@ -37,7 +37,7 @@ process.nextTick(common.mustCall(() => { })); const noRead = new Readable({ - read: common.noop + read: () => {} }); noRead.on('readable', common.mustCall(() => { @@ -52,7 +52,7 @@ noRead.push('foo'); noRead.push(null); const flowing = new Readable({ - read: common.noop + read: () => {} }); flowing.on('data', common.mustCall(() => { diff --git a/test/parallel/test-stream-readable-invalid-chunk.js b/test/parallel/test-stream-readable-invalid-chunk.js index 990154144ab..f528dfe6933 100644 --- a/test/parallel/test-stream-readable-invalid-chunk.js +++ b/test/parallel/test-stream-readable-invalid-chunk.js @@ -1,11 +1,11 @@ 'use strict'; -const common = require('../common'); +require('../common'); const stream = require('stream'); const assert = require('assert'); const readable = new stream.Readable({ - read: common.noop + read: () => {} }); const errMessage = /Invalid non-string\/buffer chunk/; diff --git a/test/parallel/test-stream-readable-needReadable.js b/test/parallel/test-stream-readable-needReadable.js index dba188c5726..be397dc5dc5 100644 --- a/test/parallel/test-stream-readable-needReadable.js +++ b/test/parallel/test-stream-readable-needReadable.js @@ -4,7 +4,7 @@ const assert = require('assert'); const Readable = require('stream').Readable; const readable = new Readable({ - read: common.noop + read: () => {} }); // Initialized to false. @@ -28,7 +28,7 @@ readable.on('end', common.mustCall(() => { })); const asyncReadable = new Readable({ - read: common.noop + read: () => {} }); asyncReadable.on('readable', common.mustCall(() => { @@ -51,7 +51,7 @@ process.nextTick(common.mustCall(() => { })); const flowing = new Readable({ - read: common.noop + read: () => {} }); // Notice this must be above the on('data') call. @@ -69,7 +69,7 @@ flowing.on('data', common.mustCall(function(data) { }, 3)); const slowProducer = new Readable({ - read: common.noop + read: () => {} }); slowProducer.on('readable', common.mustCall(() => { diff --git a/test/parallel/test-stream-readableListening-state.js b/test/parallel/test-stream-readableListening-state.js index 84e09aabca0..5e3071faf37 100644 --- a/test/parallel/test-stream-readableListening-state.js +++ b/test/parallel/test-stream-readableListening-state.js @@ -5,7 +5,7 @@ const assert = require('assert'); const stream = require('stream'); const r = new stream.Readable({ - read: common.noop + read: () => {} }); // readableListening state should start in `false`. @@ -19,7 +19,7 @@ r.on('readable', common.mustCall(() => { r.push(Buffer.from('Testing readableListening state')); const r2 = new stream.Readable({ - read: common.noop + read: () => {} }); // readableListening state should start in `false`. diff --git a/test/parallel/test-stream2-pipe-error-once-listener.js b/test/parallel/test-stream2-pipe-error-once-listener.js index de65c2469e0..71ce19b3606 100644 --- a/test/parallel/test-stream2-pipe-error-once-listener.js +++ b/test/parallel/test-stream2-pipe-error-once-listener.js @@ -21,7 +21,7 @@ 'use strict'; -const common = require('../common'); +require('../common'); const util = require('util'); const stream = require('stream'); @@ -50,7 +50,7 @@ Write.prototype._write = function(buffer, encoding, cb) { const read = new Read(); const write = new Write(); -write.once('error', common.noop); +write.once('error', () => {}); write.once('alldone', function(err) { console.log('ok'); }); diff --git a/test/parallel/test-stream2-readable-wrap-empty.js b/test/parallel/test-stream2-readable-wrap-empty.js index 39bc509a394..1489717f3e4 100644 --- a/test/parallel/test-stream2-readable-wrap-empty.js +++ b/test/parallel/test-stream2-readable-wrap-empty.js @@ -26,13 +26,13 @@ const Readable = require('_stream_readable'); const EE = require('events').EventEmitter; const oldStream = new EE(); -oldStream.pause = common.noop; -oldStream.resume = common.noop; +oldStream.pause = () => {}; +oldStream.resume = () => {}; const newStream = new Readable().wrap(oldStream); newStream - .on('readable', common.noop) + .on('readable', () => {}) .on('end', common.mustCall()); oldStream.emit('end'); diff --git a/test/parallel/test-timers-unref-call.js b/test/parallel/test-timers-unref-call.js index 45263f61788..0015318c4ba 100644 --- a/test/parallel/test-timers-unref-call.js +++ b/test/parallel/test-timers-unref-call.js @@ -1,12 +1,12 @@ 'use strict'; -const common = require('../common'); +require('../common'); const Timer = process.binding('timer_wrap').Timer; Timer.now = function() { return ++Timer.now.ticks; }; Timer.now.ticks = 0; -const t = setInterval(common.noop, 1); +const t = setInterval(() => {}, 1); const o = { _idleStart: 0, _idleTimeout: 1 }; t.unref.call(o); diff --git a/test/parallel/test-timers-unref-remove-other-unref-timers.js b/test/parallel/test-timers-unref-remove-other-unref-timers.js index 221f5bb6fd9..84dd75025d6 100644 --- a/test/parallel/test-timers-unref-remove-other-unref-timers.js +++ b/test/parallel/test-timers-unref-remove-other-unref-timers.js @@ -29,4 +29,4 @@ timers.enroll(foo, 50); timers._unrefActive(foo); // Keep the process open. -setTimeout(common.noop, 100); +setTimeout(() => {}, 100); diff --git a/test/parallel/test-timers-unref.js b/test/parallel/test-timers-unref.js index f0d0a27536e..7f66a364e3f 100644 --- a/test/parallel/test-timers-unref.js +++ b/test/parallel/test-timers-unref.js @@ -21,7 +21,7 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); let interval_fired = false; @@ -35,11 +35,11 @@ const LONG_TIME = 10 * 1000; const SHORT_TIME = 100; assert.doesNotThrow(function() { - setTimeout(common.noop, 10).unref().ref().unref(); + setTimeout(() => {}, 10).unref().ref().unref(); }, 'ref and unref are chainable'); assert.doesNotThrow(function() { - setInterval(common.noop, 10).unref().ref().unref(); + setInterval(() => {}, 10).unref().ref().unref(); }, 'ref and unref are chainable'); setInterval(function() { @@ -78,7 +78,7 @@ setInterval(function() { // Should not assert on args.Holder()->InternalFieldCount() > 0. See #4261. { - const t = setInterval(common.noop, 1); + const t = setInterval(() => {}, 1); process.nextTick(t.unref.bind({})); process.nextTick(t.unref.bind(t)); } diff --git a/test/parallel/test-timers-unrefed-in-beforeexit.js b/test/parallel/test-timers-unrefed-in-beforeexit.js index 487a4ecef52..530d97674d8 100644 --- a/test/parallel/test-timers-unrefed-in-beforeexit.js +++ b/test/parallel/test-timers-unrefed-in-beforeexit.js @@ -1,6 +1,6 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); let once = 0; @@ -9,7 +9,7 @@ process.on('beforeExit', () => { if (once > 1) throw new RangeError('beforeExit should only have been called once!'); - setTimeout(common.noop, 1).unref(); + setTimeout(() => {}, 1).unref(); once++; }); diff --git a/test/parallel/test-timers-zero-timeout.js b/test/parallel/test-timers-zero-timeout.js index 4e1eefb40d2..7feb01854e0 100644 --- a/test/parallel/test-timers-zero-timeout.js +++ b/test/parallel/test-timers-zero-timeout.js @@ -26,7 +26,7 @@ const assert = require('assert'); // https://github.com/joyent/node/issues/2079 - zero timeout drops extra args { setTimeout(common.mustCall(f), 0, 'foo', 'bar', 'baz'); - setTimeout(common.noop, 0); + setTimeout(() => {}, 0); function f(a, b, c) { assert.strictEqual(a, 'foo'); diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 2d05a55e2c7..3b3b93dc003 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -785,9 +785,9 @@ if (typeof Symbol !== 'undefined') { const rejected = Promise.reject(3); assert.strictEqual(util.inspect(rejected), 'Promise { 3 }'); // squelch UnhandledPromiseRejection - rejected.catch(common.noop); + rejected.catch(() => {}); - const pending = new Promise(common.noop); + const pending = new Promise(() => {}); assert.strictEqual(util.inspect(pending), 'Promise { }'); const promiseWithProperty = Promise.resolve('foo'); @@ -885,7 +885,7 @@ if (typeof Symbol !== 'undefined') { 'SetSubclass { 1, 2, 3 }'); assert.strictEqual(util.inspect(new MapSubclass([['foo', 42]])), 'MapSubclass { \'foo\' => 42 }'); - assert.strictEqual(util.inspect(new PromiseSubclass(common.noop)), + assert.strictEqual(util.inspect(new PromiseSubclass(() => {})), 'PromiseSubclass { }'); } diff --git a/test/parallel/test-vm-sigint-existing-handler.js b/test/parallel/test-vm-sigint-existing-handler.js index 9bd5d338797..cbd91bef06c 100644 --- a/test/parallel/test-vm-sigint-existing-handler.js +++ b/test/parallel/test-vm-sigint-existing-handler.js @@ -44,7 +44,7 @@ if (process.argv[2] === 'child') { assert.strictEqual(onceHandlerCalled, 0); // Keep the process alive for a while so that the second SIGINT can be caught. - const timeout = setTimeout(common.noop, 1000); + const timeout = setTimeout(() => {}, 1000); let afterHandlerCalled = 0; diff --git a/test/parallel/test-whatwg-url-parsing.js b/test/parallel/test-whatwg-url-parsing.js index 0e8f3b6d77c..6c95a5e9139 100644 --- a/test/parallel/test-whatwg-url-parsing.js +++ b/test/parallel/test-whatwg-url-parsing.js @@ -23,7 +23,7 @@ const failureTests = tests.filter((test) => test.failure).concat([ { input: null }, { input: new Date() }, { input: new RegExp() }, - { input: common.noop } + { input: () => {} } ]); const expectedError = common.expectsError( diff --git a/test/pseudo-tty/ref_keeps_node_running.js b/test/pseudo-tty/ref_keeps_node_running.js index 7eb2d1a60a7..7832e9ee21b 100644 --- a/test/pseudo-tty/ref_keeps_node_running.js +++ b/test/pseudo-tty/ref_keeps_node_running.js @@ -1,6 +1,6 @@ 'use strict'; -const common = require('../common'); +require('../common'); const { TTY, isTTY } = process.binding('tty_wrap'); const strictEqual = require('assert').strictEqual; @@ -9,7 +9,7 @@ strictEqual(isTTY(0), true, 'fd 0 is not a TTY'); const handle = new TTY(0); handle.readStart(); -handle.onread = common.noop; +handle.onread = () => {}; function isHandleActive(handle) { return process._getActiveHandles().some((active) => active === handle); From 4b276e985fc682dc326f27f2e3ab9ddd41814a23 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sun, 2 Jul 2017 23:52:41 -0400 Subject: [PATCH 03/13] http: guard against failed sockets creation PR-URL: https://github.com/nodejs/node/pull/13839 Fixes: https://github.com/nodejs/node/issues/13045 Fixes: https://github.com/nodejs/node/issues/13831 Refs: https://github.com/nodejs/node/issues/13352 Refs: https://github.com/nodejs/node/issues/13548#issuecomment-307177400 Reviewed-By: Trevor Norris --- lib/_http_agent.js | 37 +++++++------- test/parallel/test-http-agent.js | 82 +++++++++++++++++++++----------- 2 files changed, 72 insertions(+), 47 deletions(-) diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 9f0efe82d14..426cf5b5027 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -181,15 +181,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/*legacy*/, } else if (sockLen < this.maxSockets) { debug('call onSocket', sockLen, freeLen); // If we are under maxSockets create a new one. - this.createSocket(req, options, function(err, newSocket) { - if (err) { - nextTick(newSocket._handle.getAsyncId(), function() { - req.emit('error', err); - }); - return; - } - req.onSocket(newSocket); - }); + this.createSocket(req, options, handleSocketCreation(req, true)); } else { debug('wait for socket'); // We are over limit so we'll add it to the queue. @@ -222,6 +214,7 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) { const newSocket = self.createConnection(options, oncreate); if (newSocket) oncreate(null, newSocket); + function oncreate(err, s) { if (called) return; @@ -294,15 +287,7 @@ Agent.prototype.removeSocket = function removeSocket(s, options) { debug('removeSocket, have a request, make a socket'); var req = this.requests[name][0]; // If we have pending requests and a socket gets closed make a new one - this.createSocket(req, options, function(err, newSocket) { - if (err) { - nextTick(newSocket._handle.getAsyncId(), function() { - req.emit('error', err); - }); - return; - } - newSocket.emit('free'); - }); + this.createSocket(req, options, handleSocketCreation(req, false)); } }; @@ -332,6 +317,22 @@ Agent.prototype.destroy = function destroy() { } }; +function handleSocketCreation(request, informRequest) { + return function handleSocketCreation_Inner(err, socket) { + if (err) { + const asyncId = (socket && socket._handle && socket._handle.getAsyncId) ? + socket._handle.getAsyncId() : + null; + nextTick(asyncId, () => request.emit('error', err)); + return; + } + if (informRequest) + request.onSocket(socket); + else + socket.emit('free'); + }; +} + module.exports = { Agent, globalAgent: new Agent() diff --git a/test/parallel/test-http-agent.js b/test/parallel/test-http-agent.js index 23878673aaf..d7cb56fb459 100644 --- a/test/parallel/test-http-agent.js +++ b/test/parallel/test-http-agent.js @@ -20,41 +20,65 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const http = require('http'); -const server = http.Server(function(req, res) { - res.writeHead(200); - res.end('hello world\n'); -}); - -let responses = 0; const N = 4; const M = 4; +const server = http.Server(common.mustCall(function(req, res) { + res.writeHead(200); + res.end('hello world\n'); +}, (N * M))); // N * M = good requests (the errors will not be counted) -server.listen(0, function() { - const port = this.address().port; - for (let i = 0; i < N; i++) { - setTimeout(function() { - for (let j = 0; j < M; j++) { - http.get({ port: port, path: '/' }, function(res) { - console.log('%d %d', responses, res.statusCode); - if (++responses === N * M) { - console.error('Received all responses, closing server'); - server.close(); - } - res.resume(); - }).on('error', function(e) { - console.log('Error!', e); - process.exit(1); - }); +function makeRequests(outCount, inCount, shouldFail) { + let responseCount = outCount * inCount; + let onRequest = common.mustNotCall(); // Temporary + const p = new Promise((resolve) => { + onRequest = common.mustCall((res) => { + if (--responseCount === 0) { + server.close(); + resolve(); } - }, i); - } -}); + if (!shouldFail) + res.resume(); + }, outCount * inCount); + }); + + server.listen(0, () => { + const port = server.address().port; + for (let i = 0; i < outCount; i++) { + setTimeout(() => { + for (let j = 0; j < inCount; j++) { + const req = http.get({ port: port, path: '/' }, onRequest); + if (shouldFail) + req.on('error', common.mustCall(onRequest)); + else + req.on('error', (e) => assert.fail(e)); + } + }, i); + } + }); + return p; +} +const test1 = makeRequests(N, M); -process.on('exit', function() { - assert.strictEqual(N * M, responses); -}); +const test2 = () => { + // Should not explode if can not create sockets. + // Ref: https://github.com/nodejs/node/issues/13045 + // Ref: https://github.com/nodejs/node/issues/13831 + http.Agent.prototype.createConnection = function createConnection(_, cb) { + process.nextTick(cb, new Error('nothing')); + }; + return makeRequests(N, M, true); +}; + +test1 + .then(test2) + .catch((e) => { + // This is currently the way to fail a test with a Promise. + console.error(e); + process.exit(1); + } +); From bec387725af44a1f250c8dcf5f7e584d6d432b77 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 29 May 2017 08:53:30 -0700 Subject: [PATCH 04/13] doc: add CTC members to Collaborators list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For simplicity and clarity (if not brevity), add CTC and CTC Emeriti to Collaborators list in README. This will avoid confusion about who is and isn't a Collaborator. PR-URL: https://github.com/nodejs/node/pull/13284 Reviewed-By: Anna Henningsen Reviewed-By: Daniel Bevenius Reviewed-By: Gibson Fahnestock Reviewed-By: Matteo Collina Reviewed-By: Michael Dawson Reviewed-By: Tobias Nießen --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7ed0e64f628..26adc1817aa 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,8 @@ more information about the governance of the Node.js project, see * [abouthiroppy](https://github.com/abouthiroppy) - **Yuta Hiroto** <hello@about-hiroppy.com> (he/him) +* [addaleax](https://github.com/addaleax) - +**Anna Henningsen** <anna@addaleax.net> (she/her) * [ak239](https://github.com/ak239) - **Aleksei Koziatinskii** <ak239spb@gmail.com> * [andrasq](https://github.com/andrasq) - @@ -257,12 +259,20 @@ more information about the governance of the Node.js project, see **Benjamin Gruenbaum** <benjamingr@gmail.com> * [bmeck](https://github.com/bmeck) - **Bradley Farias** <bradley.meck@gmail.com> +* [bnoordhuis](https://github.com/bnoordhuis) - +**Ben Noordhuis** <info@bnoordhuis.nl> * [brendanashworth](https://github.com/brendanashworth) - **Brendan Ashworth** <brendan.ashworth@me.com> * [bzoz](https://github.com/bzoz) - **Bartosz Sosnowski** <bartosz@janeasystems.com> * [calvinmetcalf](https://github.com/calvinmetcalf) - **Calvin Metcalf** <calvin.metcalf@gmail.com> +* [ChALkeR](https://github.com/ChALkeR) - +**Сковорода Никита Андреевич** <chalkerx@gmail.com> (he/him) +* [chrisdickinson](https://github.com/chrisdickinson) - +**Chris Dickinson** <christopher.s.dickinson@gmail.com> +* [cjihrig](https://github.com/cjihrig) - +**Colin Ihrig** <cjihrig@gmail.com> * [claudiorodriguez](https://github.com/claudiorodriguez) - **Claudio Rodriguez** <cjrodr@yahoo.com> * [danbev](https://github.com/danbev) - @@ -277,8 +287,14 @@ more information about the governance of the Node.js project, see **Alexander Makarenko** <estliberitas@gmail.com> * [eugeneo](https://github.com/eugeneo) - **Eugene Ostroukhov** <eostroukhov@google.com> +* [evanlucas](https://github.com/evanlucas) - +**Evan Lucas** <evanlucas@me.com> (he/him) +* [fhinkel](https://github.com/fhinkel) - +**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> * [firedfox](https://github.com/firedfox) - **Daniel Wang** <wangyang0123@gmail.com> +* [Fishrock123](https://github.com/Fishrock123) - +**Jeremiah Senkpiel** <fishrock123@rocketmail.com> * [geek](https://github.com/geek) - **Wyatt Preul** <wpreul@gmail.com> * [gibfahn](https://github.com/gibfahn) - @@ -291,10 +307,16 @@ more information about the governance of the Node.js project, see **Imran Iqbal** <imran@imraniqbal.org> * [imyller](https://github.com/imyller) - **Ilkka Myller** <ilkka.myller@nodefield.com> +* [indutny](https://github.com/indutny) - +**Fedor Indutny** <fedor.indutny@gmail.com> +* [isaacs](https://github.com/isaacs) - +**Isaac Z. Schlueter** <i@izs.me> * [italoacasas](https://github.com/italoacasas) - **Italo A. Casas** <me@italoacasas.com> (he/him) * [JacksonTian](https://github.com/JacksonTian) - **Jackson Tian** <shyvo1987@gmail.com> +* [jasnell](https://github.com/jasnell) - +**James M Snell** <jasnell@gmail.com> (he/him) * [jasongin](https://github.com/jasongin) - **Jason Ginchereau** <jasongin@microsoft.com> * [jbergstroem](https://github.com/jbergstroem) - @@ -307,6 +329,8 @@ more information about the governance of the Node.js project, see **João Reis** <reis@janeasystems.com> * [joshgav](https://github.com/joshgav) - **Josh Gavant** <josh.gavant@outlook.com> +* [joyeecheung](https://github.com/joyeecheung) - +**Joyee Cheung** <joyeec9h3@gmail.com> (she/her) * [julianduque](https://github.com/julianduque) - **Julian Duque** <julianduquej@gmail.com> (he/him) * [JungMinu](https://github.com/JungMinu) - @@ -323,22 +347,38 @@ more information about the governance of the Node.js project, see **Aleksey Smolenchuk** <lxe@lxe.co> * [matthewloring](https://github.com/matthewloring) - **Matthew Loring** <mattloring@google.com> +* [mcollina](https://github.com/mcollina) - +**Matteo Collina** <matteo.collina@gmail.com> (he/him) +* [mhdawson](https://github.com/mhdawson) - +**Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) * [micnic](https://github.com/micnic) - **Nicu Micleușanu** <micnic90@gmail.com> (he/him) * [mikeal](https://github.com/mikeal) - **Mikeal Rogers** <mikeal.rogers@gmail.com> +* [misterdjules](https://github.com/misterdjules) - +**Julien Gilli** <jgilli@nodejs.org> * [monsanto](https://github.com/monsanto) - **Christopher Monsanto** <chris@monsan.to> +* [mscdex](https://github.com/mscdex) - +**Brian White** <mscdex@mscdex.net> +* [MylesBorins](https://github.com/MylesBorins) - +**Myles Borins** <myles.borins@gmail.com> (he/him) * [not-an-aardvark](https://github.com/not-an-aardvark) - **Teddy Katz** <teddy.katz@gmail.com> +* [ofrobots](https://github.com/ofrobots) - +**Ali Ijaz Sheikh** <ofrobots@google.com> * [Olegas](https://github.com/Olegas) - **Oleg Elifantiev** <oleg@elifantiev.ru> +* [orangemocha](https://github.com/orangemocha) - +**Alexis Campailla** <orangemocha@nodejs.org> * [othiym23](https://github.com/othiym23) - **Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him) * [petkaantonov](https://github.com/petkaantonov) - **Petka Antonov** <petka_antonov@hotmail.com> * [phillipj](https://github.com/phillipj) - **Phillip Johnsen** <johphi@gmail.com> +* [piscisaureus](https://github.com/piscisaureus) - +**Bert Belder** <bertbelder@gmail.com> * [pmq20](https://github.com/pmq20) - **Minqi Pan** <pmq2001@gmail.com> * [princejwesley](https://github.com/princejwesley) - @@ -361,6 +401,8 @@ more information about the governance of the Node.js project, see **Ron Korving** <ron@ronkorving.nl> * [RReverser](https://github.com/RReverser) - **Ingvar Stepanyan** <me@rreverser.com> +* [rvagg](https://github.com/rvagg) - +**Rod Vagg** <rod@vagg.org> * [saghul](https://github.com/saghul) - **Saúl Ibarra Corretgé** <saghul@gmail.com> * [sam-github](https://github.com/sam-github) - @@ -369,14 +411,20 @@ more information about the governance of the Node.js project, see **Santiago Gimeno** <santiago.gimeno@gmail.com> * [seishun](https://github.com/seishun) - **Nikolai Vavilov** <vvnicholas@gmail.com> +* [shigeki](https://github.com/shigeki) - +**Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him) * [silverwind](https://github.com/silverwind) - **Roman Reiss** <me@silverwind.io> * [srl295](https://github.com/srl295) - **Steven R Loomis** <srloomis@us.ibm.com> * [stefanmb](https://github.com/stefanmb) - **Stefan Budeanu** <stefan@budeanu.com> +* [targos](https://github.com/targos) - +**Michaël Zasso** <targos@protonmail.com> (he/him) * [tellnes](https://github.com/tellnes) - **Christian Tellnes** <christian@tellnes.no> +* [thefourtheye](https://github.com/thefourtheye) - +**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> (he/him) * [thekemkid](https://github.com/thekemkid) - **Glen Keane** <glenkeane.94@gmail.com> (he/him) * [thlorenz](https://github.com/thlorenz) - @@ -385,6 +433,10 @@ more information about the governance of the Node.js project, see **Timothy Gu** <timothygu99@gmail.com> (he/him) * [tniessen](https://github.com/tniessen) - **Tobias Nießen** <tniessen@tnie.de> +* [trevnorris](https://github.com/trevnorris) - +**Trevor Norris** <trev.norris@gmail.com> +* [Trott](https://github.com/Trott) - +**Rich Trott** <rtrott@gmail.com> (he/him) * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com> * [vkurchatkin](https://github.com/vkurchatkin) - @@ -400,9 +452,8 @@ more information about the governance of the Node.js project, see * [yosuke-furukawa](https://github.com/yosuke-furukawa) - **Yosuke Furukawa** <yosuke.furukawa@gmail.com> -Collaborators (which includes CTC members) follow the -[COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js -project. +Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in +maintaining the Node.js project. ### Release Team From f1c890afb05274880df0f1ce4084607c03b194bf Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Fri, 30 Jun 2017 19:35:52 +0100 Subject: [PATCH 05/13] test,fs: delay unlink in test-regress-GH-4027.js The sequential/test-regress-GH-4027 test is flaky with an increased system load, failing when the watched file is unlinked before the first state of the watched file is retrieved. After increasing the delay before unlinking and calling setTimeout after watchFile, the flakiness stopped reproducing. PR-URL: https://github.com/nodejs/node/pull/14010 Fixes: https://github.com/nodejs/node/issues/13800 Reviewed-By: Rich Trott Reviewed-By: Refael Ackermann --- test/sequential/test-regress-GH-4027.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/sequential/test-regress-GH-4027.js b/test/sequential/test-regress-GH-4027.js index e3e9e5a4de4..6ab6afcfd6b 100644 --- a/test/sequential/test-regress-GH-4027.js +++ b/test/sequential/test-regress-GH-4027.js @@ -29,10 +29,11 @@ common.refreshTmpDir(); const filename = path.join(common.tmpDir, 'watched'); fs.writeFileSync(filename, 'quis custodiet ipsos custodes'); -setTimeout(fs.unlinkSync, 100, filename); fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) { assert.strictEqual(prev.nlink, 1); assert.strictEqual(curr.nlink, 0); fs.unwatchFile(filename); })); + +setTimeout(fs.unlinkSync, common.platformTimeout(300), filename); From cc1a47dc6b94b2feb4de9e46be9333d81d537783 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Fri, 30 Jun 2017 20:52:53 +0300 Subject: [PATCH 06/13] test: fix require nits in some test-tls-* tests * Do not require if test is skipped. * Do not re-require without need. * Sort requiring by module names. PR-URL: https://github.com/nodejs/node/pull/14008 Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig --- test/internet/test-tls-add-ca-cert.js | 3 +- test/parallel/test-tls-alert-handling.js | 7 +++-- test/parallel/test-tls-alert.js | 9 +++--- test/parallel/test-tls-alpn-server-client.js | 3 +- test/parallel/test-tls-client-verify.js | 7 +++-- test/parallel/test-tls-cnnic-whitelist.js | 2 +- test/parallel/test-tls-npn-server-client.js | 10 +++---- test/parallel/test-tls-server-verify.js | 28 +++++++++---------- test/parallel/test-tls-sni-option.js | 9 +++--- test/parallel/test-tls-sni-server-client.js | 9 +++--- .../test-tls-startcom-wosign-whitelist.js | 5 ++-- 11 files changed, 50 insertions(+), 42 deletions(-) diff --git a/test/internet/test-tls-add-ca-cert.js b/test/internet/test-tls-add-ca-cert.js index 457dfdac7f1..1283230e911 100644 --- a/test/internet/test-tls-add-ca-cert.js +++ b/test/internet/test-tls-add-ca-cert.js @@ -10,10 +10,11 @@ if (!common.hasCrypto) { const assert = require('assert'); const fs = require('fs'); +const path = require('path'); const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js index 5268f520f13..d089ad223b1 100644 --- a/test/parallel/test-tls-alert-handling.js +++ b/test/parallel/test-tls-alert-handling.js @@ -11,12 +11,13 @@ if (!common.hasCrypto) { return; } -const tls = require('tls'); -const net = require('net'); const fs = require('fs'); +const net = require('net'); +const path = require('path'); +const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index d12d45f529c..ef79856108e 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -21,7 +21,6 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); if (!common.opensslCli) { common.skip('node compiled without OpenSSL CLI.'); @@ -32,15 +31,17 @@ if (!common.hasCrypto) { common.skip('missing crypto'); return; } -const tls = require('tls'); +const assert = require('assert'); +const { spawn } = require('child_process'); const fs = require('fs'); -const spawn = require('child_process').spawn; +const path = require('path'); +const tls = require('tls'); let success = false; function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js index a397550d968..3d3453d32fd 100644 --- a/test/parallel/test-tls-alpn-server-client.js +++ b/test/parallel/test-tls-alpn-server-client.js @@ -14,10 +14,11 @@ if (!process.features.tls_alpn || !process.features.tls_npn) { const assert = require('assert'); const fs = require('fs'); +const path = require('path'); const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index 93fa99f7735..d713be3b0cf 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -21,15 +21,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -const tls = require('tls'); +const assert = require('assert'); const fs = require('fs'); +const path = require('path'); +const tls = require('tls'); const hosterr = /Hostname\/IP doesn't match certificate's altnames/; const testCases = @@ -65,7 +66,7 @@ const testCases = ]; function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } diff --git a/test/parallel/test-tls-cnnic-whitelist.js b/test/parallel/test-tls-cnnic-whitelist.js index a33e631ddf7..08453174865 100644 --- a/test/parallel/test-tls-cnnic-whitelist.js +++ b/test/parallel/test-tls-cnnic-whitelist.js @@ -8,9 +8,9 @@ if (!common.hasCrypto) { } const assert = require('assert'); -const tls = require('tls'); const fs = require('fs'); const path = require('path'); +const tls = require('tls'); function filenamePEM(n) { return path.join(common.fixturesDir, 'keys', `${n}.pem`); diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js index ac617072f3a..ffaf61b633b 100644 --- a/test/parallel/test-tls-npn-server-client.js +++ b/test/parallel/test-tls-npn-server-client.js @@ -26,18 +26,18 @@ if (!process.features.tls_npn) { return; } -const assert = require('assert'); -const fs = require('fs'); - if (!common.hasCrypto) { common.skip('missing crypto'); return; } -const tls = require('tls'); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); +const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index 65ddaa5e2dc..86a735f64c9 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -27,6 +27,11 @@ if (!common.opensslCli) { return; } +if (!common.hasCrypto) { + common.skip('missing crypto'); + return; +} + // This is a rather complex test which sets up various TLS servers with node // and connects to them using the 'openssl s_client' command line utility // with various keys. Depending on the certificate authority and other @@ -35,6 +40,14 @@ if (!common.opensslCli) { // - accepted and "unauthorized", or // - accepted and "authorized". +const assert = require('assert'); +const { spawn } = require('child_process'); +const { SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION } = + require('crypto').constants; +const fs = require('fs'); +const path = require('path'); +const tls = require('tls'); + const testCases = [{ title: 'Do not request certs. Everyone is unauthorized.', requestCert: false, @@ -119,22 +132,9 @@ const testCases = } ]; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const tls = require('tls'); - -const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = - require('crypto').constants.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION; - -const assert = require('assert'); -const fs = require('fs'); -const spawn = require('child_process').spawn; - function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js index 52fb90ec931..ad7410b1631 100644 --- a/test/parallel/test-tls-sni-option.js +++ b/test/parallel/test-tls-sni-option.js @@ -26,17 +26,18 @@ if (!process.features.tls_sni) { return; } -const assert = require('assert'); -const fs = require('fs'); - if (!common.hasCrypto) { common.skip('missing crypto'); return; } + +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js index 0ee382ad38b..300010cfa13 100644 --- a/test/parallel/test-tls-sni-server-client.js +++ b/test/parallel/test-tls-sni-server-client.js @@ -26,17 +26,18 @@ if (!process.features.tls_sni) { return; } -const assert = require('assert'); -const fs = require('fs'); - if (!common.hasCrypto) { common.skip('missing crypto'); return; } + +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); const tls = require('tls'); function filenamePEM(n) { - return require('path').join(common.fixturesDir, 'keys', `${n}.pem`); + return path.join(common.fixturesDir, 'keys', `${n}.pem`); } function loadPEM(n) { diff --git a/test/parallel/test-tls-startcom-wosign-whitelist.js b/test/parallel/test-tls-startcom-wosign-whitelist.js index 21dbb55c156..601c0e4393c 100644 --- a/test/parallel/test-tls-startcom-wosign-whitelist.js +++ b/test/parallel/test-tls-startcom-wosign-whitelist.js @@ -1,15 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -const tls = require('tls'); +const assert = require('assert'); const fs = require('fs'); const path = require('path'); +const tls = require('tls'); + let finished = 0; function filenamePEM(n) { From 2d2986ae72f2f5c63d95a94f05fa996d9f0609f1 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 1 Jul 2017 02:29:09 +0300 Subject: [PATCH 07/13] test: simplify test skipping * 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 --- test/abort/test-abort-backtrace.js | 8 +++----- test/addons/load-long-path/test.js | 8 +++----- test/addons/openssl-binding/test.js | 5 ++--- .../test-stringbytes-external-at-max.js | 15 +++++---------- ...ingbytes-external-exceed-max-by-1-ascii.js | 15 +++++---------- ...ngbytes-external-exceed-max-by-1-base64.js | 15 +++++---------- ...ngbytes-external-exceed-max-by-1-binary.js | 15 +++++---------- ...tringbytes-external-exceed-max-by-1-hex.js | 15 +++++---------- ...ringbytes-external-exceed-max-by-1-utf8.js | 15 +++++---------- ...st-stringbytes-external-exceed-max-by-2.js | 15 +++++---------- .../test-stringbytes-external-exceed-max.js | 15 +++++---------- test/addons/symlinked-module/test.js | 1 - test/async-hooks/test-connection.ssl.js | 10 ++++------ test/async-hooks/test-crypto-pbkdf2.js | 5 ++--- test/async-hooks/test-crypto-randomBytes.js | 5 ++--- test/async-hooks/test-graph.connection.js | 10 ++++------ test/async-hooks/test-graph.shutdown.js | 9 +++------ test/async-hooks/test-graph.tcp.js | 9 +++------ test/async-hooks/test-graph.tls-write.js | 16 ++++++---------- test/async-hooks/test-tcpwrap.js | 9 +++------ test/async-hooks/test-tlswrap.js | 10 ++++------ test/async-hooks/test-ttywrap.writestream.js | 10 ++++++---- test/async-hooks/test-writewrap.js | 10 ++++------ test/common/README.md | 7 ++++++- test/common/index.js | 8 ++++++-- test/doctool/test-doctool-html.js | 9 ++++----- test/doctool/test-doctool-json.js | 9 ++++----- test/fixtures/tls-connect.js | 9 ++++----- test/inspector/test-inspector-ip-detection.js | 6 ++---- .../test-dgram-broadcast-multi-process.js | 8 +++----- .../test-dgram-multicast-multi-process.js | 10 ++++------ test/internet/test-dns-ipv6.js | 8 +++----- .../internet/test-http-https-default-ports.js | 5 ++--- test/internet/test-tls-add-ca-cert.js | 4 +--- .../internet/test-tls-connnect-melissadata.js | 4 +--- .../test-tls-reuse-host-from-socket.js | 5 ++--- test/known_issues/test-cwd-enoent-file.js | 1 - test/parallel/test-async-wrap-GH13045.js | 4 +--- .../test-async-wrap-uncaughtexception.js | 5 ++--- test/parallel/test-benchmark-crypto.js | 8 ++------ test/parallel/test-buffer-alloc.js | 2 +- .../parallel/test-child-process-fork-dgram.js | 8 +++----- test/parallel/test-cli-node-options.js | 2 +- .../test-cluster-bind-privileged-port.js | 16 ++++++---------- test/parallel/test-cluster-dgram-1.js | 9 +++------ test/parallel/test-cluster-dgram-2.js | 9 +++------ test/parallel/test-cluster-dgram-reuse.js | 8 +++----- test/parallel/test-cluster-disconnect-race.js | 8 +++----- .../test-cluster-disconnect-unshared-udp.js | 4 +--- test/parallel/test-cluster-http-pipe.js | 9 ++++----- ...ster-shared-handle-bind-privileged-port.js | 16 ++++++---------- test/parallel/test-crypto-authenticated.js | 12 +++++------- test/parallel/test-crypto-binary-default.js | 4 +--- test/parallel/test-crypto-certificate.js | 8 +++----- test/parallel/test-crypto-cipher-decipher.js | 10 ++++------ .../test-crypto-cipheriv-decipheriv.js | 8 +++----- test/parallel/test-crypto-deprecated.js | 8 +++----- test/parallel/test-crypto-dh-odd-key.js | 8 +++----- test/parallel/test-crypto-dh.js | 9 ++++----- test/parallel/test-crypto-domain.js | 8 +++----- test/parallel/test-crypto-domains.js | 11 +++++------ test/parallel/test-crypto-ecb.js | 13 +++++-------- test/parallel/test-crypto-engine.js | 4 +--- test/parallel/test-crypto-fips.js | 8 +++----- test/parallel/test-crypto-from-binary.js | 8 +++----- test/parallel/test-crypto-hash-stream-pipe.js | 4 +--- test/parallel/test-crypto-hash.js | 8 +++----- test/parallel/test-crypto-hmac.js | 8 +++----- .../test-crypto-lazy-transform-writable.js | 5 ++--- test/parallel/test-crypto-padding-aes256.js | 8 +++----- test/parallel/test-crypto-padding.js | 8 +++----- test/parallel/test-crypto-pbkdf2.js | 5 +---- test/parallel/test-crypto-random.js | 5 ++--- test/parallel/test-crypto-rsa-dsa.js | 10 ++++------ test/parallel/test-crypto-sign-verify.js | 12 ++++-------- test/parallel/test-crypto-stream.js | 8 +++----- test/parallel/test-crypto-verify-failure.js | 5 ++--- test/parallel/test-crypto.js | 4 +--- test/parallel/test-cwd-enoent-preload.js | 10 ++++------ test/parallel/test-cwd-enoent-repl.js | 10 ++++------ test/parallel/test-cwd-enoent.js | 10 ++++------ test/parallel/test-debug-usage.js | 8 +++----- .../test-dgram-bind-default-address.js | 12 +++++------- .../test-dgram-cluster-close-during-bind.js | 8 +++----- test/parallel/test-dgram-send-empty-array.js | 4 +--- test/parallel/test-dgram-send-empty-buffer.js | 7 ++----- test/parallel/test-dgram-send-empty-packet.js | 7 ++----- .../test-dgram-udp6-send-default-host.js | 8 +++----- test/parallel/test-dh-padding.js | 4 +--- test/parallel/test-domain-crypto.js | 4 +--- test/parallel/test-dsa-fips-invalid-key.js | 7 ++----- test/parallel/test-fs-long-path.js | 8 +++----- .../test-fs-read-file-sync-hostname.js | 8 +++----- test/parallel/test-fs-readdir-ucs2.js | 8 +++----- test/parallel/test-fs-readfile-error.js | 12 +++++------- test/parallel/test-fs-readfile-pipe-large.js | 8 +++----- test/parallel/test-fs-readfile-pipe.js | 6 ++---- .../test-fs-readfilesync-pipe-large.js | 8 +++----- .../test-fs-realpath-on-substed-drive.js | 11 ++++------- test/parallel/test-fs-realpath-pipe.js | 4 +--- test/parallel/test-fs-realpath.js | 16 ++++++++-------- test/parallel/test-fs-symlink.js | 8 +++----- test/parallel/test-fs-watch-encoding.js | 9 ++++----- test/parallel/test-fs-watch-recursive.js | 4 +--- test/parallel/test-http-chunk-problem.js | 7 +++---- test/parallel/test-http-default-port.js | 4 +--- test/parallel/test-http-dns-error.js | 6 ++---- test/parallel/test-http-full-response.js | 2 +- test/parallel/test-http-invalid-urls.js | 4 +--- test/parallel/test-http-localaddress.js | 8 +++----- .../test-http-url.parse-https.request.js | 9 +++------ test/parallel/test-https-agent-constructor.js | 5 ++--- .../test-https-agent-create-connection.js | 4 +--- .../test-https-agent-disable-session-reuse.js | 12 ++++-------- test/parallel/test-https-agent-getname.js | 4 +--- .../test-https-agent-secure-protocol.js | 7 ++----- test/parallel/test-https-agent-servername.js | 4 +--- .../test-https-agent-session-eviction.js | 4 +--- .../test-https-agent-session-reuse.js | 4 +--- test/parallel/test-https-agent-sni.js | 9 +++------ .../parallel/test-https-agent-sockets-leak.js | 4 +--- test/parallel/test-https-agent.js | 9 +++------ .../test-https-argument-of-creating.js | 4 +--- test/parallel/test-https-byteswritten.js | 8 +++----- .../test-https-client-checkServerIdentity.js | 9 +++------ test/parallel/test-https-client-get-url.js | 10 ++++------ test/parallel/test-https-client-reject.js | 9 +++------ test/parallel/test-https-client-resume.js | 9 +++------ test/parallel/test-https-close.js | 8 +++----- .../test-https-connect-address-family.js | 13 ++++--------- .../parallel/test-https-connecting-to-http.js | 9 +++------ test/parallel/test-https-drain.js | 9 +++------ test/parallel/test-https-eof-for-eom.js | 9 +++------ test/parallel/test-https-foafssl.js | 12 +++--------- test/parallel/test-https-host-headers.js | 10 ++++------ .../test-https-localaddress-bind-error.js | 8 +++----- test/parallel/test-https-localaddress.js | 16 ++++++---------- test/parallel/test-https-pfx.js | 8 +++----- test/parallel/test-https-req-split.js | 7 +++---- .../parallel/test-https-resume-after-renew.js | 4 +--- .../test-https-server-keep-alive-timeout.js | 5 ++--- test/parallel/test-https-simple.js | 4 +--- test/parallel/test-https-socket-options.js | 7 ++----- test/parallel/test-https-strict.js | 9 +++------ test/parallel/test-https-timeout-server-2.js | 9 +++------ test/parallel/test-https-timeout-server.js | 5 ++--- test/parallel/test-https-timeout.js | 5 ++--- test/parallel/test-https-truncate.js | 4 +--- .../test-https-unix-socket-self-signed.js | 4 +--- test/parallel/test-icu-data-dir.js | 5 ++--- test/parallel/test-icu-punycode.js | 4 +--- test/parallel/test-icu-stringwidth.js | 4 +--- test/parallel/test-icu-transcode.js | 4 +--- test/parallel/test-inspector-open.js | 3 +-- test/parallel/test-intl-v8BreakIterator.js | 5 ++--- test/parallel/test-intl.js | 3 +-- test/parallel/test-listen-fd-cluster.js | 8 +++----- .../test-listen-fd-detached-inherit.js | 8 +++----- test/parallel/test-listen-fd-detached.js | 8 +++----- test/parallel/test-listen-fd-server.js | 8 +++----- .../parallel/test-module-circular-symlinks.js | 1 - .../test-module-symlinked-peer-modules.js | 1 - test/parallel/test-net-access-byteswritten.js | 5 ++--- test/parallel/test-net-connect-options-fd.js | 8 +++----- .../parallel/test-net-connect-options-ipv6.js | 10 ++++------ .../parallel/test-net-socket-local-address.js | 10 ++++------ test/parallel/test-npm-install.js | 4 +--- test/parallel/test-openssl-ca-options.js | 5 ++--- test/parallel/test-pipe-writev.js | 8 +++----- test/parallel/test-preload.js | 10 ++++------ test/parallel/test-process-execpath.js | 8 +++----- test/parallel/test-process-getgroups.js | 5 ++--- ...est-process-remove-all-signal-listeners.js | 9 +++------ test/parallel/test-regress-GH-1531.js | 5 ++--- test/parallel/test-regress-GH-3542.js | 10 ++++------ test/parallel/test-regress-GH-9819.js | 8 +++----- test/parallel/test-repl-history-perm.js | 1 - test/parallel/test-repl-sigint-nested-eval.js | 8 +++----- test/parallel/test-repl-sigint.js | 8 +++----- test/parallel/test-require-long-path.js | 8 +++----- test/parallel/test-require-symlink.js | 4 +--- test/parallel/test-setproctitle.js | 10 ++++------ test/parallel/test-signal-handler.js | 4 +--- test/parallel/test-spawn-cmd-named-pipe.js | 8 +++----- test/parallel/test-tls-0-dns-altname.js | 9 +++------ test/parallel/test-tls-alert-handling.js | 12 ++++-------- test/parallel/test-tls-alert.js | 11 +++-------- test/parallel/test-tls-alpn-server-client.js | 5 +---- .../test-tls-async-cb-after-socket-end.js | 4 +--- test/parallel/test-tls-basic-validations.js | 4 +--- test/parallel/test-tls-cert-regression.js | 5 ++--- .../test-tls-check-server-identity.js | 4 +--- test/parallel/test-tls-cipher-list.js | 4 +--- test/parallel/test-tls-client-abort.js | 9 +++------ test/parallel/test-tls-client-abort2.js | 8 +++----- .../test-tls-client-default-ciphers.js | 8 +++----- test/parallel/test-tls-client-destroy-soon.js | 9 +++------ .../test-tls-client-getephemeralkeyinfo.js | 10 ++++------ test/parallel/test-tls-client-mindhsize.js | 10 ++++------ test/parallel/test-tls-client-reject.js | 9 +++------ test/parallel/test-tls-client-resume.js | 9 +++------ test/parallel/test-tls-client-verify.js | 5 +---- test/parallel/test-tls-close-error.js | 9 +++------ test/parallel/test-tls-close-notify.js | 6 ++---- test/parallel/test-tls-cnnic-whitelist.js | 4 +--- .../test-tls-connect-address-family.js | 13 ++++--------- .../parallel/test-tls-connect-given-socket.js | 10 ++++------ test/parallel/test-tls-connect-no-host.js | 5 ++--- test/parallel/test-tls-connect-pipe.js | 5 ++--- test/parallel/test-tls-connect-simple.js | 5 ++--- .../test-tls-connect-stream-writes.js | 4 +--- test/parallel/test-tls-connect.js | 6 ++---- .../parallel/test-tls-delayed-attach-error.js | 5 ++--- test/parallel/test-tls-delayed-attach.js | 9 +++------ .../parallel/test-tls-destroy-whilst-write.js | 5 ++--- test/parallel/test-tls-dhe.js | 13 ++++--------- test/parallel/test-tls-ecdh-disable.js | 12 +++--------- test/parallel/test-tls-ecdh.js | 8 ++------ test/parallel/test-tls-econnreset.js | 8 +++----- test/parallel/test-tls-empty-sni-context.js | 11 +++-------- test/parallel/test-tls-env-bad-extra-ca.js | 4 +--- test/parallel/test-tls-env-extra-ca.js | 4 +--- test/parallel/test-tls-external-accessor.js | 10 ++++------ test/parallel/test-tls-fast-writing.js | 9 +++------ .../test-tls-friendly-error-message.js | 9 +++------ test/parallel/test-tls-getcipher.js | 5 ++--- test/parallel/test-tls-getprotocol.js | 7 ++----- test/parallel/test-tls-handshake-error.js | 9 +++------ test/parallel/test-tls-handshake-nohang.js | 5 ++--- .../parallel/test-tls-hello-parser-failure.js | 4 +--- test/parallel/test-tls-honorcipherorder.js | 10 ++++------ test/parallel/test-tls-inception.js | 4 +--- test/parallel/test-tls-interleave.js | 5 ++--- test/parallel/test-tls-invoke-queued.js | 4 +--- test/parallel/test-tls-js-stream.js | 9 +++------ test/parallel/test-tls-junk-closes-server.js | 4 +--- test/parallel/test-tls-junk-server.js | 4 +--- test/parallel/test-tls-key-mismatch.js | 5 ++--- test/parallel/test-tls-legacy-deprecated.js | 5 ++--- test/parallel/test-tls-legacy-onselect.js | 5 ++--- test/parallel/test-tls-lookup.js | 5 ++--- test/parallel/test-tls-max-send-fragment.js | 9 +++------ test/parallel/test-tls-multi-key.js | 8 +++----- test/parallel/test-tls-no-cert-required.js | 8 +++----- test/parallel/test-tls-no-rsa-key.js | 9 +++------ test/parallel/test-tls-no-sslv23.js | 8 +++----- test/parallel/test-tls-no-sslv3.js | 19 +++++++------------ test/parallel/test-tls-npn-server-client.js | 12 ++++-------- test/parallel/test-tls-ocsp-callback.js | 14 +++++--------- test/parallel/test-tls-on-empty-socket.js | 5 ++--- test/parallel/test-tls-over-http-tunnel.js | 9 +++------ test/parallel/test-tls-parse-cert-string.js | 4 +--- test/parallel/test-tls-passphrase.js | 9 +++------ test/parallel/test-tls-pause.js | 9 +++------ .../test-tls-peer-certificate-encoding.js | 9 +++------ .../test-tls-peer-certificate-multi-keys.js | 9 +++------ test/parallel/test-tls-pfx-gh-5100-regr.js | 4 +--- test/parallel/test-tls-regr-gh-5108.js | 4 +--- test/parallel/test-tls-request-timeout.js | 9 +++------ .../test-tls-retain-handle-no-abort.js | 8 +++----- test/parallel/test-tls-securepair-fiftharg.js | 4 +--- test/parallel/test-tls-securepair-leak.js | 7 ++----- test/parallel/test-tls-securepair-server.js | 12 +++--------- .../test-tls-server-connection-server.js | 4 +--- ...rver-failed-handshake-emits-clienterror.js | 5 ++--- test/parallel/test-tls-server-verify.js | 12 ++++-------- test/parallel/test-tls-session-cache.js | 8 ++------ test/parallel/test-tls-set-ciphers.js | 8 ++------ test/parallel/test-tls-set-encoding.js | 10 +++------- test/parallel/test-tls-sni-option.js | 12 ++++-------- test/parallel/test-tls-sni-server-client.js | 12 ++++-------- test/parallel/test-tls-socket-close.js | 6 ++---- test/parallel/test-tls-socket-destroy.js | 4 +--- ...tls-socket-failed-handshake-emits-error.js | 5 ++--- .../test-tls-startcom-wosign-whitelist.js | 5 +---- test/parallel/test-tls-starttls-server.js | 4 +--- test/parallel/test-tls-ticket-cluster.js | 9 +++------ test/parallel/test-tls-ticket.js | 9 +++------ test/parallel/test-tls-timeout-server-2.js | 9 +++------ test/parallel/test-tls-timeout-server.js | 6 ++---- test/parallel/test-tls-two-cas-one-string.js | 4 +--- .../test-tls-wrap-econnreset-localaddress.js | 5 ++--- .../parallel/test-tls-wrap-econnreset-pipe.js | 5 ++--- .../test-tls-wrap-econnreset-socket.js | 5 ++--- test/parallel/test-tls-wrap-econnreset.js | 5 ++--- test/parallel/test-tls-wrap-event-emmiter.js | 5 ++--- test/parallel/test-tls-wrap-no-abort.js | 4 +--- test/parallel/test-tls-wrap-timeout.js | 5 ++--- test/parallel/test-tls-writewrap-leak.js | 4 +--- test/parallel/test-tls-zero-clear-in.js | 5 ++--- .../parallel/test-url-domain-ascii-unicode.js | 5 ++--- test/parallel/test-url-format-whatwg.js | 5 ++--- test/parallel/test-util-sigint-watchdog.js | 7 +++---- .../test-vm-sigint-existing-handler.js | 12 +++++------- test/parallel/test-vm-sigint.js | 11 ++++------- test/parallel/test-warn-sigprof.js | 4 +--- test/parallel/test-whatwg-url-constructor.js | 11 +++++------ test/parallel/test-whatwg-url-domainto.js | 4 +--- test/parallel/test-whatwg-url-historical.js | 7 +++---- test/parallel/test-whatwg-url-inspect.js | 9 ++++----- test/parallel/test-whatwg-url-origin.js | 9 ++++----- test/parallel/test-whatwg-url-parsing.js | 9 ++++----- test/parallel/test-whatwg-url-setters.js | 11 +++++------ test/parallel/test-whatwg-url-toascii.js | 9 ++++----- test/parallel/test-windows-abort-exitcode.js | 9 ++++----- test/parallel/test-zlib-random-byte-pipes.js | 11 ++++------- test/pummel/test-abort-fatal-error.js | 7 ++----- test/pummel/test-crypto-dh.js | 8 +++----- ...est-crypto-timing-safe-equal-benchmarks.js | 11 +++-------- test/pummel/test-dh-regr.js | 8 +++----- test/pummel/test-dtrace-jsstack.js | 8 +++----- test/pummel/test-https-ci-reneg-attack.js | 17 ++++++----------- test/pummel/test-https-large-response.js | 9 +++------ test/pummel/test-https-no-reader.js | 9 +++------ test/pummel/test-keep-alive.js | 8 +++----- test/pummel/test-regress-GH-892.js | 9 +++------ test/pummel/test-tls-ci-reneg-attack.js | 17 ++++++----------- test/pummel/test-tls-connect-memleak.js | 9 +++------ test/pummel/test-tls-securepair-client.js | 9 ++------- test/pummel/test-tls-server-large-request.js | 9 +++------ test/pummel/test-tls-session-timeout.js | 8 ++------ test/pummel/test-tls-throttle.js | 8 +++----- test/sequential/test-benchmark-http.js | 4 +--- .../test-buffer-creation-regression.js | 3 ++- test/sequential/test-child-process-emfile.js | 8 +++----- test/sequential/test-child-process-pass-fd.js | 10 ++++------ .../test-crypto-timing-safe-equal.js | 7 ++----- .../test-fs-readfile-tostring-fail.js | 7 ++----- .../test-https-set-timeout-server.js | 4 +--- test/sequential/test-net-server-address.js | 2 +- .../test-tick-processor-builtin.js | 12 ++++-------- .../test-tick-processor-cpp-core.js | 12 ++++-------- .../test-tick-processor-unknown.js | 8 ++------ 333 files changed, 896 insertions(+), 1633 deletions(-) diff --git a/test/abort/test-abort-backtrace.js b/test/abort/test-abort-backtrace.js index 7f72ee8e71c..dd108171684 100644 --- a/test/abort/test-abort-backtrace.js +++ b/test/abort/test-abort-backtrace.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Backtraces unimplemented on Windows.'); + const assert = require('assert'); const cp = require('child_process'); -if (common.isWindows) { - common.skip('Backtraces unimplemented on Windows.'); - return; -} - if (process.argv[2] === 'child') { process.abort(); } else { diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index 73d85a75a09..accb90d2638 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); +if (common.isWOW64) + common.skip('doesn\'t work on WOW64'); + const fs = require('fs'); const path = require('path'); const assert = require('assert'); -if (common.isWOW64) { - common.skip('doesn\'t work on WOW64'); - return; -} - common.refreshTmpDir(); // make a path that is more than 260 chars long. diff --git a/test/addons/openssl-binding/test.js b/test/addons/openssl-binding/test.js index 452f59f752f..1e6c57ffd1e 100644 --- a/test/addons/openssl-binding/test.js +++ b/test/addons/openssl-binding/test.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(0); -} + const assert = require('assert'); const binding = require(`./build/${common.buildType}/binding`); const bytes = new Uint8Array(1024); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js index 5dd727f8ffd..4c074773a21 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js @@ -1,6 +1,10 @@ 'use strict'; const common = require('../../common'); +const skipMessage = 'intensive toString tests due to memory confinements'; +if (!common.enoughTestMem) + common.skip(skipMessage); + const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); @@ -8,12 +12,6 @@ const assert = require('assert'); // v8::String::kMaxLength defined in v8.h const kStringMaxLength = process.binding('buffer').kStringMaxLength; -const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { - common.skip(skipMessage); - return; -} - let buf; try { buf = Buffer.allocUnsafe(kStringMaxLength); @@ -21,14 +19,11 @@ try { // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} const maxString = buf.toString('latin1'); assert.strictEqual(maxString.length, kStringMaxLength); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js index 2466c8ec42e..43b8c63f1e4 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ try { // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('ascii'); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js index 16f0f5392e5..a94a57e1803 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ try { // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('base64'); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js index 1028706b1d1..996c01752da 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ try { // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('latin1'); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js index caf6112011e..17d9ae5d68f 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ try { // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('hex'); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js index 4d3199a033e..d3368ca7b2e 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ try { // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString(); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js index 786d0b67989..db007a53a44 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ try { // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} const maxString = buf.toString('utf16le'); assert.strictEqual(maxString.length, (kStringMaxLength + 2) / 2); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js index 36b0d4174a0..319a8a93558 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../../common'); -const binding = require(`./build/${common.buildType}/binding`); -const assert = require('assert'); - const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} + +const binding = require(`./build/${common.buildType}/binding`); +const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength // v8::String::kMaxLength defined in v8.h @@ -21,14 +19,11 @@ try { // If the exception is not due to memory confinement then rethrow it. if (e.message !== 'Array buffer allocation failed') throw (e); common.skip(skipMessage); - return; } // Ensure we have enough memory available for future allocations to succeed. -if (!binding.ensureAllocation(2 * kStringMaxLength)) { +if (!binding.ensureAllocation(2 * kStringMaxLength)) common.skip(skipMessage); - return; -} assert.throws(function() { buf.toString('utf16le'); diff --git a/test/addons/symlinked-module/test.js b/test/addons/symlinked-module/test.js index d2025c54e43..d9455c027bd 100644 --- a/test/addons/symlinked-module/test.js +++ b/test/addons/symlinked-module/test.js @@ -22,7 +22,6 @@ try { } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('module identity test (no privs for symlinks)'); - return; } const sub = require('./submodule'); diff --git a/test/async-hooks/test-connection.ssl.js b/test/async-hooks/test-connection.ssl.js index ac3e069fb8a..faee0fdf080 100644 --- a/test/async-hooks/test-connection.ssl.js +++ b/test/async-hooks/test-connection.ssl.js @@ -1,16 +1,14 @@ 'use strict'; +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const initHooks = require('./init-hooks'); const tick = require('./tick'); -const common = require('../common'); const assert = require('assert'); const { checkInvocations } = require('./hook-checks'); -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const tls = require('tls'); const Connection = process.binding('crypto').Connection; const hooks = initHooks(); diff --git a/test/async-hooks/test-crypto-pbkdf2.js b/test/async-hooks/test-crypto-pbkdf2.js index 3023101f0b6..2a0b44db8ce 100644 --- a/test/async-hooks/test-crypto-pbkdf2.js +++ b/test/async-hooks/test-crypto-pbkdf2.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); diff --git a/test/async-hooks/test-crypto-randomBytes.js b/test/async-hooks/test-crypto-randomBytes.js index 49ffc6fdb61..76f8f775950 100644 --- a/test/async-hooks/test-crypto-randomBytes.js +++ b/test/async-hooks/test-crypto-randomBytes.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); diff --git a/test/async-hooks/test-graph.connection.js b/test/async-hooks/test-graph.connection.js index 37ecc79bb06..fcc764b5ccf 100644 --- a/test/async-hooks/test-graph.connection.js +++ b/test/async-hooks/test-graph.connection.js @@ -1,13 +1,11 @@ 'use strict'; -const initHooks = require('./init-hooks'); const common = require('../common'); -const verifyGraph = require('./verify-graph'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const initHooks = require('./init-hooks'); +const verifyGraph = require('./verify-graph'); const tls = require('tls'); const Connection = process.binding('crypto').Connection; diff --git a/test/async-hooks/test-graph.shutdown.js b/test/async-hooks/test-graph.shutdown.js index 029a9c86b66..136f0182121 100644 --- a/test/async-hooks/test-graph.shutdown.js +++ b/test/async-hooks/test-graph.shutdown.js @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const initHooks = require('./init-hooks'); -const verifyGraph = require('./verify-graph'); - -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('IPv6 support required'); - return; -} +const initHooks = require('./init-hooks'); +const verifyGraph = require('./verify-graph'); const net = require('net'); const hooks = initHooks(); diff --git a/test/async-hooks/test-graph.tcp.js b/test/async-hooks/test-graph.tcp.js index f9703769b83..87261599073 100644 --- a/test/async-hooks/test-graph.tcp.js +++ b/test/async-hooks/test-graph.tcp.js @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const initHooks = require('./init-hooks'); -const verifyGraph = require('./verify-graph'); - -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('IPv6 support required'); - return; -} +const initHooks = require('./init-hooks'); +const verifyGraph = require('./verify-graph'); const net = require('net'); const hooks = initHooks(); diff --git a/test/async-hooks/test-graph.tls-write.js b/test/async-hooks/test-graph.tls-write.js index 77a97bedbc5..338a714c322 100644 --- a/test/async-hooks/test-graph.tls-write.js +++ b/test/async-hooks/test-graph.tls-write.js @@ -1,21 +1,17 @@ 'use strict'; const common = require('../common'); -const initHooks = require('./init-hooks'); -const verifyGraph = require('./verify-graph'); -const fs = require('fs'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('IPv6 support required'); - return; -} +const initHooks = require('./init-hooks'); +const verifyGraph = require('./verify-graph'); +const fs = require('fs'); const tls = require('tls'); + const hooks = initHooks(); hooks.enable(); diff --git a/test/async-hooks/test-tcpwrap.js b/test/async-hooks/test-tcpwrap.js index 0dce8c7d9f0..b4021753a07 100644 --- a/test/async-hooks/test-tcpwrap.js +++ b/test/async-hooks/test-tcpwrap.js @@ -2,16 +2,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('IPv6 support required'); + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); - -if (!common.hasIPv6) { - common.skip('IPv6 support required'); - return; -} - const net = require('net'); let tcp1, tcp2, tcp3; diff --git a/test/async-hooks/test-tlswrap.js b/test/async-hooks/test-tlswrap.js index 47cca62c182..878afac0631 100644 --- a/test/async-hooks/test-tlswrap.js +++ b/test/async-hooks/test-tlswrap.js @@ -1,18 +1,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const fs = require('fs'); const { checkInvocations } = require('./hook-checks'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const tls = require('tls'); + const hooks = initHooks(); hooks.enable(); diff --git a/test/async-hooks/test-ttywrap.writestream.js b/test/async-hooks/test-ttywrap.writestream.js index b1cc768877d..990460b5376 100644 --- a/test/async-hooks/test-ttywrap.writestream.js +++ b/test/async-hooks/test-ttywrap.writestream.js @@ -1,14 +1,16 @@ 'use strict'; const common = require('../common'); + +const tty_fd = common.getTTYfd(); +if (tty_fd < 0) + common.skip('no valid TTY fd available'); + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); -const tty_fd = common.getTTYfd(); -if (tty_fd < 0) - return common.skip('no valid TTY fd available'); const ttyStream = (() => { try { return new (require('tty').WriteStream)(tty_fd); @@ -17,7 +19,7 @@ const ttyStream = (() => { } })(); if (ttyStream === null) - return common.skip('no valid TTY fd available'); + common.skip('no valid TTY fd available'); const hooks = initHooks(); hooks.enable(); diff --git a/test/async-hooks/test-writewrap.js b/test/async-hooks/test-writewrap.js index 6253b09d4ad..eca0d08f10f 100644 --- a/test/async-hooks/test-writewrap.js +++ b/test/async-hooks/test-writewrap.js @@ -1,17 +1,15 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const initHooks = require('./init-hooks'); const fs = require('fs'); const { checkInvocations } = require('./hook-checks'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const tls = require('tls'); + const hooks = initHooks(); hooks.enable(); diff --git a/test/common/README.md b/test/common/README.md index 0502cacaf60..07f9bc6583d 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -264,6 +264,11 @@ Path to the test sock. Port tests are running on. +### printSkipMessage(msg) +* `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Logs '1..0 # Skipped: ' + `msg` + ### refreshTmpDir * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) @@ -285,7 +290,7 @@ Path to the 'root' directory. either `/` or `c:\\` (windows) ### skip(msg) * `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) -Logs '1..0 # Skipped: ' + `msg` +Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`. ### spawnPwd(options) * `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) diff --git a/test/common/index.js b/test/common/index.js index e3e53f4574a..3caed88e203 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -570,10 +570,15 @@ exports.mustNotCall = function(msg) { }; }; -exports.skip = function(msg) { +exports.printSkipMessage = function(msg) { console.log(`1..0 # Skipped: ${msg}`); }; +exports.skip = function(msg) { + exports.printSkipMessage(msg); + process.exit(0); +}; + // A stream to push an array into a REPL function ArrayStream() { this.run = function(data) { @@ -717,7 +722,6 @@ exports.expectsError = function expectsError({code, type, message}) { exports.skipIfInspectorDisabled = function skipIfInspectorDisabled() { if (process.config.variables.v8_enable_inspector === 0) { exports.skip('V8 inspector is disabled'); - process.exit(0); } }; diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 3af5a5409db..64f1d7f8b14 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -1,17 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -const path = require('path'); - // The doctool currently uses js-yaml from the tool/eslint/ tree. try { require('../../tools/eslint/node_modules/js-yaml'); } catch (e) { - return common.skip('missing js-yaml (eslint not present)'); + common.skip('missing js-yaml (eslint not present)'); } +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); const processIncludes = require('../../tools/doc/preprocess.js'); const html = require('../../tools/doc/html.js'); diff --git a/test/doctool/test-doctool-json.js b/test/doctool/test-doctool-json.js index 346a7f331e9..4a4d3a895c3 100644 --- a/test/doctool/test-doctool-json.js +++ b/test/doctool/test-doctool-json.js @@ -1,17 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -const path = require('path'); - // The doctool currently uses js-yaml from the tool/eslint/ tree. try { require('../../tools/eslint/node_modules/js-yaml'); } catch (e) { - return common.skip('missing js-yaml (eslint not present)'); + common.skip('missing js-yaml (eslint not present)'); } +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); const json = require('../../tools/doc/json.js'); // Outputs valid json with the expected fields when given simple markdown diff --git a/test/fixtures/tls-connect.js b/test/fixtures/tls-connect.js index a434a0316d6..2ce75a53767 100644 --- a/test/fixtures/tls-connect.js +++ b/test/fixtures/tls-connect.js @@ -4,14 +4,13 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); -const join = require('path').join; // Check if Node was compiled --without-ssl and if so exit early // as the require of tls will otherwise throw an Error. -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(0); -} + +const fs = require('fs'); +const join = require('path').join; const tls = require('tls'); const util = require('util'); diff --git a/test/inspector/test-inspector-ip-detection.js b/test/inspector/test-inspector-ip-detection.js index ad51c631645..be5e34a977e 100644 --- a/test/inspector/test-inspector-ip-detection.js +++ b/test/inspector/test-inspector-ip-detection.js @@ -9,10 +9,8 @@ const os = require('os'); const ip = pickIPv4Address(); -if (!ip) { +if (!ip) common.skip('No IP address found'); - return; -} function checkListResponse(instance, err, response) { assert.ifError(err); @@ -29,7 +27,7 @@ function checkListResponse(instance, err, response) { function checkError(instance, error) { // Some OSes will not allow us to connect if (error.code === 'EHOSTUNREACH') { - common.skip('Unable to connect to self'); + common.printSkipMessage('Unable to connect to self'); } else { throw error; } diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 79e13924845..0ec4bbd9ce5 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.inFreeBSDJail) + common.skip('in a FreeBSD jail'); + const assert = require('assert'); const dgram = require('dgram'); const util = require('util'); @@ -35,11 +38,6 @@ const messages = [ Buffer.from('Fourth message to send') ]; -if (common.inFreeBSDJail) { - common.skip('in a FreeBSD jail'); - return; -} - let bindAddress = null; // Take the first non-internal interface as the address for binding. diff --git a/test/internet/test-dgram-multicast-multi-process.js b/test/internet/test-dgram-multicast-multi-process.js index dac8abd6a7a..a7854652eab 100644 --- a/test/internet/test-dgram-multicast-multi-process.js +++ b/test/internet/test-dgram-multicast-multi-process.js @@ -21,6 +21,10 @@ 'use strict'; const common = require('../common'); +// Skip test in FreeBSD jails. +if (common.inFreeBSDJail) + common.skip('In a FreeBSD jail'); + const assert = require('assert'); const dgram = require('dgram'); const fork = require('child_process').fork; @@ -37,12 +41,6 @@ const listeners = 3; let listening, sendSocket, done, timer, dead; -// Skip test in FreeBSD jails. -if (common.inFreeBSDJail) { - common.skip('In a FreeBSD jail'); - return; -} - function launchChildProcess() { const worker = fork(__filename, ['child']); workers[worker.pid] = worker; diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js index 31f9df5eab8..9b9360c2a16 100644 --- a/test/internet/test-dns-ipv6.js +++ b/test/internet/test-dns-ipv6.js @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('this test, no IPv6 support'); + const assert = require('assert'); const dns = require('dns'); const net = require('net'); @@ -8,11 +11,6 @@ const isIPv6 = net.isIPv6; let running = false; const queue = []; -if (!common.hasIPv6) { - common.skip('this test, no IPv6 support'); - return; -} - function TEST(f) { function next() { const f = queue.shift(); diff --git a/test/internet/test-http-https-default-ports.js b/test/internet/test-http-https-default-ports.js index b0eb682519b..567b045dc6e 100644 --- a/test/internet/test-http-https-default-ports.js +++ b/test/internet/test-http-https-default-ports.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const http = require('http'); diff --git a/test/internet/test-tls-add-ca-cert.js b/test/internet/test-tls-add-ca-cert.js index 1283230e911..299e01405d7 100644 --- a/test/internet/test-tls-add-ca-cert.js +++ b/test/internet/test-tls-add-ca-cert.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} // Test interaction of compiled-in CAs with user-provided CAs. diff --git a/test/internet/test-tls-connnect-melissadata.js b/test/internet/test-tls-connnect-melissadata.js index f57b897099f..ab5aa395093 100644 --- a/test/internet/test-tls-connnect-melissadata.js +++ b/test/internet/test-tls-connnect-melissadata.js @@ -3,10 +3,8 @@ // certification between Starfield Class 2 and ValiCert Class 2 const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const socket = tls.connect(443, 'address.melissadata.net', function() { diff --git a/test/internet/test-tls-reuse-host-from-socket.js b/test/internet/test-tls-reuse-host-from-socket.js index fda9712156c..73ee91d3b2e 100644 --- a/test/internet/test-tls-reuse-host-from-socket.js +++ b/test/internet/test-tls-reuse-host-from-socket.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); diff --git a/test/known_issues/test-cwd-enoent-file.js b/test/known_issues/test-cwd-enoent-file.js index 9431919804a..b2f59cbca7d 100644 --- a/test/known_issues/test-cwd-enoent-file.js +++ b/test/known_issues/test-cwd-enoent-file.js @@ -9,7 +9,6 @@ if (common.isSunOS || common.isWindows || common.isAix) { // The current working directory cannot be removed on these platforms. // Change this to common.skip() when this is no longer a known issue test. assert.fail('cannot rmdir current working directory'); - return; } const cp = require('child_process'); diff --git a/test/parallel/test-async-wrap-GH13045.js b/test/parallel/test-async-wrap-GH13045.js index 41c6f0cd19e..1382de80608 100644 --- a/test/parallel/test-async-wrap-GH13045.js +++ b/test/parallel/test-async-wrap-GH13045.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} // Refs: https://github.com/nodejs/node/issues/13045 // An HTTP Agent reuses a TLSSocket, and makes a failed call to `asyncReset`. diff --git a/test/parallel/test-async-wrap-uncaughtexception.js b/test/parallel/test-async-wrap-uncaughtexception.js index f5f81f10052..9427e2fb787 100644 --- a/test/parallel/test-async-wrap-uncaughtexception.js +++ b/test/parallel/test-async-wrap-uncaughtexception.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const async_hooks = require('async_hooks'); const call_log = [0, 0, 0, 0]; // [before, callback, exception, after]; diff --git a/test/parallel/test-benchmark-crypto.js b/test/parallel/test-benchmark-crypto.js index 55ab98ee219..e7f99ad29c0 100644 --- a/test/parallel/test-benchmark-crypto.js +++ b/test/parallel/test-benchmark-crypto.js @@ -2,15 +2,11 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (common.hasFipsCrypto) { +if (common.hasFipsCrypto) common.skip('some benchmarks are FIPS-incompatible'); - return; -} // Minimal test for crypto benchmarks. This makes sure the benchmarks aren't // horribly broken but nothing more than that. diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 8edbca3c6ef..2a69d967a51 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -917,7 +917,7 @@ if (common.hasCrypto) { crypto.createHash('sha1').update(b2).digest('hex') ); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } const ps = Buffer.poolSize; diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index be351cced04..4aa36261dbb 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -28,15 +28,13 @@ */ const common = require('../common'); +if (common.isWindows) + common.skip('Sending dgram sockets to child processes is not supported'); + const dgram = require('dgram'); const fork = require('child_process').fork; const assert = require('assert'); -if (common.isWindows) { - common.skip('Sending dgram sockets to child processes is not supported'); - return; -} - if (process.argv[2] === 'child') { let childServer; diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js index 0c39813cf62..8622dafbe10 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); if (process.config.variables.node_without_node_options) - return common.skip('missing NODE_OPTIONS support'); + common.skip('missing NODE_OPTIONS support'); // Test options specified by env variable. diff --git a/test/parallel/test-cluster-bind-privileged-port.js b/test/parallel/test-cluster-bind-privileged-port.js index e726618ffbd..99f7a20c494 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -21,19 +21,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - -if (common.isWindows) { +if (common.isWindows) common.skip('not reliable on Windows.'); - return; -} -if (process.getuid() === 0) { +if (process.getuid() === 0) common.skip('Test is not supposed to be run as root.'); - return; -} + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((exitCode) => { diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js index 9e0ed3dfb9c..3688c67f6c6 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + const NUM_WORKERS = 4; const PACKETS_PER_WORKER = 10; @@ -28,12 +31,6 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); - -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on Windows.'); - return; -} - if (cluster.isMaster) master(); else diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js index 9ae903b6eaf..7c1dae65600 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + const NUM_WORKERS = 4; const PACKETS_PER_WORKER = 10; @@ -28,12 +31,6 @@ const cluster = require('cluster'); const dgram = require('dgram'); const assert = require('assert'); - -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on Windows.'); - return; -} - if (cluster.isMaster) master(); else diff --git a/test/parallel/test-cluster-dgram-reuse.js b/test/parallel/test-cluster-dgram-reuse.js index 1472dcc5238..51a4944e554 100644 --- a/test/parallel/test-cluster-dgram-reuse.js +++ b/test/parallel/test-cluster-dgram-reuse.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on windows.'); + const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on windows.'); - return; -} - if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((code) => { assert.strictEqual(code, 0); diff --git a/test/parallel/test-cluster-disconnect-race.js b/test/parallel/test-cluster-disconnect-race.js index 7bb66ced366..60d8697b671 100644 --- a/test/parallel/test-cluster-disconnect-race.js +++ b/test/parallel/test-cluster-disconnect-race.js @@ -4,15 +4,13 @@ // Ref: https://github.com/nodejs/node/issues/4205 const common = require('../common'); +if (common.isWindows) + common.skip('This test does not apply to Windows.'); + const assert = require('assert'); const net = require('net'); const cluster = require('cluster'); -if (common.isWindows) { - common.skip('This test does not apply to Windows.'); - return; -} - cluster.schedulingPolicy = cluster.SCHED_NONE; if (cluster.isMaster) { diff --git a/test/parallel/test-cluster-disconnect-unshared-udp.js b/test/parallel/test-cluster-disconnect-unshared-udp.js index 653ab6cc9c3..d34ce11b028 100644 --- a/test/parallel/test-cluster-disconnect-unshared-udp.js +++ b/test/parallel/test-cluster-disconnect-unshared-udp.js @@ -23,10 +23,8 @@ const common = require('../common'); -if (common.isWindows) { +if (common.isWindows) common.skip('on windows, because clustered dgram is ENOTSUP'); - return; -} const cluster = require('cluster'); const dgram = require('dgram'); diff --git a/test/parallel/test-cluster-http-pipe.js b/test/parallel/test-cluster-http-pipe.js index 93b457fd808..96f741e8044 100644 --- a/test/parallel/test-cluster-http-pipe.js +++ b/test/parallel/test-cluster-http-pipe.js @@ -22,16 +22,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const http = require('http'); - if (common.isWindows) { common.skip( 'It is not possible to send pipe handles over the IPC pipe on Windows'); - return; } +const assert = require('assert'); +const cluster = require('cluster'); +const http = require('http'); + if (cluster.isMaster) { common.refreshTmpDir(); const worker = cluster.fork(); diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index 419307d52cc..8f05b28fed3 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -21,19 +21,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - -if (common.isWindows) { +if (common.isWindows) common.skip('not reliable on Windows'); - return; -} -if (process.getuid() === 0) { +if (process.getuid() === 0) common.skip('as this test should not be run as `root`'); - return; -} + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (cluster.isMaster) { // Master opens and binds the socket and shares it with the worker. diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 2d5370ba3ea..c03aa0efce5 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; @@ -341,12 +339,12 @@ for (const i in TEST_CASES) { const test = TEST_CASES[i]; if (!ciphers.includes(test.algo)) { - common.skip(`unsupported ${test.algo} test`); + common.printSkipMessage(`unsupported ${test.algo} test`); continue; } if (common.hasFipsCrypto && test.iv.length < 24) { - common.skip('IV len < 12 bytes unsupported in FIPS mode'); + common.printSkipMessage('IV len < 12 bytes unsupported in FIPS mode'); continue; } diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index e92f70035bd..5bb254057b5 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -26,10 +26,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index 831fed0f14e..61d8ea8193d 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index dfb68a7f920..0104341653f 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (common.hasFipsCrypto) { + +if (common.hasFipsCrypto) common.skip('not supported in FIPS mode'); - return; -} + const crypto = require('crypto'); const assert = require('assert'); diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js index 31a79d8bf17..96ca44fec82 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); function testCipher1(key, iv) { diff --git a/test/parallel/test-crypto-deprecated.js b/test/parallel/test-crypto-deprecated.js index 903862d6c8e..84f25316d49 100644 --- a/test/parallel/test-crypto-deprecated.js +++ b/test/parallel/test-crypto-deprecated.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); const tls = require('tls'); diff --git a/test/parallel/test-crypto-dh-odd-key.js b/test/parallel/test-crypto-dh-odd-key.js index 94f3d382655..449c482d351 100644 --- a/test/parallel/test-crypto-dh-odd-key.js +++ b/test/parallel/test-crypto-dh-odd-key.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); function test() { diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 91a066d1bd2..3b51dc55906 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); + const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR; // Test Diffie-Hellman with two parties sharing a secret, diff --git a/test/parallel/test-crypto-domain.js b/test/parallel/test-crypto-domain.js index b41b57e3a25..d579331287c 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const domain = require('domain'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); function test(fn) { diff --git a/test/parallel/test-crypto-domains.js b/test/parallel/test-crypto-domains.js index 23ca991500d..be87cad6ff6 100644 --- a/test/parallel/test-crypto-domains.js +++ b/test/parallel/test-crypto-domains.js @@ -21,17 +21,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const domain = require('domain'); const assert = require('assert'); +const crypto = require('crypto'); + const d = domain.create(); const expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes']; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const crypto = require('crypto'); - d.on('error', common.mustCall(function(e) { assert.strictEqual(e.message, expect.shift()); }, 3)); diff --git a/test/parallel/test-crypto-ecb.js b/test/parallel/test-crypto-ecb.js index d69cb9ea0d2..4faf4af2c57 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -21,16 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (common.hasFipsCrypto) { + +if (common.hasFipsCrypto) common.skip('BF-ECB is not FIPS 140-2 compatible'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-engine.js b/test/parallel/test-crypto-engine.js index 8452087cc50..b2fe154d3c2 100644 --- a/test/parallel/test-crypto-engine.js +++ b/test/parallel/test-crypto-engine.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js index a83170c49ae..f1d81f078bd 100644 --- a/test/parallel/test-crypto-fips.js +++ b/test/parallel/test-crypto-fips.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const spawnSync = require('child_process').spawnSync; const path = require('path'); -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const FIPS_ENABLED = 1; const FIPS_DISABLED = 0; const FIPS_ERROR_STRING = 'Error: Cannot set FIPS mode'; diff --git a/test/parallel/test-crypto-from-binary.js b/test/parallel/test-crypto-from-binary.js index 785fff4388b..ed1be9b3157 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -25,12 +25,10 @@ const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); const EXTERN_APEX = 0xFBEE9; diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/parallel/test-crypto-hash-stream-pipe.js index ee152dc028e..0a240a2abbc 100644 --- a/test/parallel/test-crypto-hash-stream-pipe.js +++ b/test/parallel/test-crypto-hash-stream-pipe.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 28f0f2f3034..f76e4f98c85 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Test hashing diff --git a/test/parallel/test-crypto-hmac.js b/test/parallel/test-crypto-hmac.js index 94c5cefa058..a10e8a731be 100644 --- a/test/parallel/test-crypto-hmac.js +++ b/test/parallel/test-crypto-hmac.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); // Test for binding layer robustness diff --git a/test/parallel/test-crypto-lazy-transform-writable.js b/test/parallel/test-crypto-lazy-transform-writable.js index 9008ebc5f91..f12243b9f4d 100644 --- a/test/parallel/test-crypto-lazy-transform-writable.js +++ b/test/parallel/test-crypto-lazy-transform-writable.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const crypto = require('crypto'); const Stream = require('stream'); diff --git a/test/parallel/test-crypto-padding-aes256.js b/test/parallel/test-crypto-padding-aes256.js index 3e17a3fc3e5..9fb80f3eed7 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index 095f1ba407c..6ad504d12c2 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js index 9ed719c1f68..f8f42865250 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -1,10 +1,7 @@ 'use strict'; const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index c60e3b2681e..eec6f00b542 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js index daa818705b8..813df587325 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const constants = require('crypto').constants; const crypto = require('crypto'); +const constants = crypto.constants; const fixtDir = common.fixturesDir; // Test certificates diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 2a64b6d0724..5d19917c488 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); const exec = require('child_process').exec; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Test certificates @@ -245,10 +243,8 @@ const modSize = 1024; // RSA-PSS Sign test by verifying with 'openssl dgst -verify' { - if (!common.opensslCli) { + if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; - } const pubfile = path.join(common.fixturesDir, 'keys/rsa_public_2048.pem'); const privfile = path.join(common.fixturesDir, 'keys/rsa_private_2048.pem'); diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index e40b36847b5..1c3b8bbcbb1 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const stream = require('stream'); const util = require('util'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Small stream to buffer converter diff --git a/test/parallel/test-crypto-verify-failure.js b/test/parallel/test-crypto-verify-failure.js index 1b3622fe01e..4bd70f388d8 100644 --- a/test/parallel/test-crypto-verify-failure.js +++ b/test/parallel/test-crypto-verify-failure.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); const tls = require('tls'); diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index a7638d3cd89..d45de9979b9 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-cwd-enoent-preload.js b/test/parallel/test-cwd-enoent-preload.js index 5d44814d2fe..8979547c0de 100644 --- a/test/parallel/test-cwd-enoent-preload.js +++ b/test/parallel/test-cwd-enoent-preload.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; const abspathFile = require('path').join(common.fixturesDir, 'a.js'); common.refreshTmpDir(); diff --git a/test/parallel/test-cwd-enoent-repl.js b/test/parallel/test-cwd-enoent-repl.js index c82083668aa..bb41b1fccd8 100644 --- a/test/parallel/test-cwd-enoent-repl.js +++ b/test/parallel/test-cwd-enoent-repl.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; common.refreshTmpDir(); fs.mkdirSync(dirname); diff --git a/test/parallel/test-cwd-enoent.js b/test/parallel/test-cwd-enoent.js index dac23e4084a..27df46acf89 100644 --- a/test/parallel/test-cwd-enoent.js +++ b/test/parallel/test-cwd-enoent.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; common.refreshTmpDir(); fs.mkdirSync(dirname); diff --git a/test/parallel/test-debug-usage.js b/test/parallel/test-debug-usage.js index e01ac8e15b8..a264029f434 100644 --- a/test/parallel/test-debug-usage.js +++ b/test/parallel/test-debug-usage.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const spawn = require('child_process').spawn; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const child = spawn(process.execPath, ['debug']); child.stderr.setEncoding('utf8'); diff --git a/test/parallel/test-dgram-bind-default-address.js b/test/parallel/test-dgram-bind-default-address.js index d0b5b602344..762ead7c869 100755 --- a/test/parallel/test-dgram-bind-default-address.js +++ b/test/parallel/test-dgram-bind-default-address.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const dgram = require('dgram'); - // skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface -if (common.inFreeBSDJail) { +if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); - return; -} + +const assert = require('assert'); +const dgram = require('dgram'); dgram.createSocket('udp4').bind(0, common.mustCall(function() { assert.strictEqual(typeof this.address().port, 'number'); @@ -39,7 +37,7 @@ dgram.createSocket('udp4').bind(0, common.mustCall(function() { })); if (!common.hasIPv6) { - common.skip('udp6 part of test, because no IPv6 support'); + common.printSkipMessage('udp6 part of test, because no IPv6 support'); return; } diff --git a/test/parallel/test-dgram-cluster-close-during-bind.js b/test/parallel/test-dgram-cluster-close-during-bind.js index ec62693abfb..4e8cdbf9d35 100644 --- a/test/parallel/test-dgram-cluster-close-during-bind.js +++ b/test/parallel/test-dgram-cluster-close-during-bind.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on windows.'); + const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on windows.'); - return; -} - if (cluster.isMaster) { cluster.fork(); } else { diff --git a/test/parallel/test-dgram-send-empty-array.js b/test/parallel/test-dgram-send-empty-array.js index 1bfcacd9a40..e6a391de945 100644 --- a/test/parallel/test-dgram-send-empty-array.js +++ b/test/parallel/test-dgram-send-empty-array.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} const assert = require('assert'); const dgram = require('dgram'); diff --git a/test/parallel/test-dgram-send-empty-buffer.js b/test/parallel/test-dgram-send-empty-buffer.js index 16c14909f62..554a3c9185c 100644 --- a/test/parallel/test-dgram-send-empty-buffer.js +++ b/test/parallel/test-dgram-send-empty-buffer.js @@ -21,13 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} +const assert = require('assert'); const dgram = require('dgram'); const client = dgram.createSocket('udp4'); diff --git a/test/parallel/test-dgram-send-empty-packet.js b/test/parallel/test-dgram-send-empty-packet.js index 131e808aec0..b425e9eb158 100644 --- a/test/parallel/test-dgram-send-empty-packet.js +++ b/test/parallel/test-dgram-send-empty-packet.js @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} +const assert = require('assert'); const dgram = require('dgram'); const client = dgram.createSocket('udp4'); diff --git a/test/parallel/test-dgram-udp6-send-default-host.js b/test/parallel/test-dgram-udp6-send-default-host.js index e893f248ecd..d801ca7e8dc 100644 --- a/test/parallel/test-dgram-udp6-send-default-host.js +++ b/test/parallel/test-dgram-udp6-send-default-host.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + const assert = require('assert'); const dgram = require('dgram'); -if (!common.hasIPv6) { - common.skip('no IPv6 support'); - return; -} - const client = dgram.createSocket('udp6'); const toSend = [Buffer.alloc(256, 'x'), diff --git a/test/parallel/test-dh-padding.js b/test/parallel/test-dh-padding.js index 6853533ee4e..311b9d156ff 100644 --- a/test/parallel/test-dh-padding.js +++ b/test/parallel/test-dh-padding.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-domain-crypto.js b/test/parallel/test-domain-crypto.js index d0bdbf4720b..3890a7b4641 100644 --- a/test/parallel/test-domain-crypto.js +++ b/test/parallel/test-domain-crypto.js @@ -23,10 +23,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} const crypto = require('crypto'); diff --git a/test/parallel/test-dsa-fips-invalid-key.js b/test/parallel/test-dsa-fips-invalid-key.js index b22be9d0779..b88c05a87cb 100644 --- a/test/parallel/test-dsa-fips-invalid-key.js +++ b/test/parallel/test-dsa-fips-invalid-key.js @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasFipsCrypto) { +if (!common.hasFipsCrypto) common.skip('node compiled without FIPS OpenSSL.'); - return; -} +const assert = require('assert'); const crypto = require('crypto'); const fs = require('fs'); diff --git a/test/parallel/test-fs-long-path.js b/test/parallel/test-fs-long-path.js index b8aa6a2ac87..ae60b16f1a3 100644 --- a/test/parallel/test-fs-long-path.js +++ b/test/parallel/test-fs-long-path.js @@ -21,15 +21,13 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('this test is Windows-specific.'); + const fs = require('fs'); const path = require('path'); const assert = require('assert'); -if (!common.isWindows) { - common.skip('this test is Windows-specific.'); - return; -} - // make a path that will be at least 260 chars long. const fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1); const fileName = path.join(common.tmpDir, 'x'.repeat(fileNameLen)); diff --git a/test/parallel/test-fs-read-file-sync-hostname.js b/test/parallel/test-fs-read-file-sync-hostname.js index f7a03e55247..599f48b6ccf 100644 --- a/test/parallel/test-fs-read-file-sync-hostname.js +++ b/test/parallel/test-fs-read-file-sync-hostname.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.isLinux) + common.skip('Test is linux specific.'); + const assert = require('assert'); const fs = require('fs'); -if (!common.isLinux) { - common.skip('Test is linux specific.'); - return; -} - // Test to make sure reading a file under the /proc directory works. See: // https://groups.google.com/forum/#!topic/nodejs-dev/rxZ_RoH1Gn0 const hostname = fs.readFileSync('/proc/sys/kernel/hostname'); diff --git a/test/parallel/test-fs-readdir-ucs2.js b/test/parallel/test-fs-readdir-ucs2.js index 4d5f53abd8e..e8e69d6ee2f 100644 --- a/test/parallel/test-fs-readdir-ucs2.js +++ b/test/parallel/test-fs-readdir-ucs2.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.isLinux) + common.skip('Test is linux specific.'); + const path = require('path'); const fs = require('fs'); const assert = require('assert'); -if (!common.isLinux) { - common.skip('Test is linux specific.'); - return; -} - common.refreshTmpDir(); const filename = '\uD83D\uDC04'; const root = Buffer.from(`${common.tmpDir}${path.sep}`); diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js index 208b478c12a..d9ad834afcd 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const exec = require('child_process').exec; -const path = require('path'); - // `fs.readFile('/')` does not fail on FreeBSD, because you can open and read // the directory there. -if (common.isFreeBSD) { +if (common.isFreeBSD) common.skip('platform not supported.'); - return; -} + +const assert = require('assert'); +const exec = require('child_process').exec; +const path = require('path'); function test(env, cb) { const filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js'); diff --git a/test/parallel/test-fs-readfile-pipe-large.js b/test/parallel/test-fs-readfile-pipe-large.js index f0d1dd9c408..46603b14fa0 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const path = require('path'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); +const path = require('path'); const fs = require('fs'); if (process.argv[2] === 'child') { diff --git a/test/parallel/test-fs-readfile-pipe.js b/test/parallel/test-fs-readfile-pipe.js index 10fc6a925af..e15c2c10476 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -21,15 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); const fs = require('fs'); const dataExpected = fs.readFileSync(__filename, 'utf8'); diff --git a/test/parallel/test-fs-readfilesync-pipe-large.js b/test/parallel/test-fs-readfilesync-pipe-large.js index 01e41047774..daa53bf3de0 100644 --- a/test/parallel/test-fs-readfilesync-pipe-large.js +++ b/test/parallel/test-fs-readfilesync-pipe-large.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const path = require('path'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); +const path = require('path'); const fs = require('fs'); if (process.argv[2] === 'child') { diff --git a/test/parallel/test-fs-realpath-on-substed-drive.js b/test/parallel/test-fs-realpath-on-substed-drive.js index f8d9e86de5e..a3d38d9f279 100644 --- a/test/parallel/test-fs-realpath-on-substed-drive.js +++ b/test/parallel/test-fs-realpath-on-substed-drive.js @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('Test for Windows only'); + const assert = require('assert'); const fs = require('fs'); const spawnSync = require('child_process').spawnSync; -if (!common.isWindows) { - common.skip('Test for Windows only'); - return; -} let result; // create a subst drive @@ -21,10 +20,8 @@ for (i = 0; i < driveLetters.length; ++i) { if (result.status === 0) break; } -if (i === driveLetters.length) { +if (i === driveLetters.length) common.skip('Cannot create subst drive'); - return; -} // schedule cleanup (and check if all callbacks where called) process.on('exit', function() { diff --git a/test/parallel/test-fs-realpath-pipe.js b/test/parallel/test-fs-realpath-pipe.js index 89bdc08229a..0f30b07f0a9 100644 --- a/test/parallel/test-fs-realpath-pipe.js +++ b/test/parallel/test-fs-realpath-pipe.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} const assert = require('assert'); diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 1c9f7a7d90e..a9ec65168d0 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -103,7 +103,7 @@ function test_simple_error_callback(cb) { function test_simple_relative_symlink(callback) { console.log('test_simple_relative_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const entry = `${tmpDir}/symlink`; @@ -152,7 +152,7 @@ function test_simple_absolute_symlink(callback) { function test_deep_relative_file_symlink(callback) { console.log('test_deep_relative_file_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -182,7 +182,7 @@ function test_deep_relative_file_symlink(callback) { function test_deep_relative_dir_symlink(callback) { console.log('test_deep_relative_dir_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const expected = path.join(common.fixturesDir, 'cycles', 'folder'); @@ -210,7 +210,7 @@ function test_deep_relative_dir_symlink(callback) { function test_cyclic_link_protection(callback) { console.log('test_cyclic_link_protection'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const entry = path.join(tmpDir, '/cycles/realpath-3a'); @@ -237,7 +237,7 @@ function test_cyclic_link_protection(callback) { function test_cyclic_link_overprotection(callback) { console.log('test_cyclic_link_overprotection'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const cycles = `${tmpDir}/cycles`; @@ -258,7 +258,7 @@ function test_cyclic_link_overprotection(callback) { function test_relative_input_cwd(callback) { console.log('test_relative_input_cwd'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -297,7 +297,7 @@ function test_deep_symlink_mix(callback) { if (common.isWindows) { // This one is a mix of files and directories, and it's quite tricky // to get the file/dir links sorted out correctly. - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -384,7 +384,7 @@ assertEqualPath( function test_up_multiple(cb) { console.error('test_up_multiple'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } function cleanup() { diff --git a/test/parallel/test-fs-symlink.js b/test/parallel/test-fs-symlink.js index 2ceb4d10936..9e19958b628 100644 --- a/test/parallel/test-fs-symlink.js +++ b/test/parallel/test-fs-symlink.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (!common.canCreateSymLink()) + common.skip('insufficient privileges'); + const assert = require('assert'); const path = require('path'); const fs = require('fs'); @@ -28,11 +31,6 @@ const fs = require('fs'); let linkTime; let fileTime; -if (!common.canCreateSymLink()) { - common.skip('insufficient privileges'); - return; -} - common.refreshTmpDir(); // test creating and reading symbolic link diff --git a/test/parallel/test-fs-watch-encoding.js b/test/parallel/test-fs-watch-encoding.js index 04f5ffaad97..b9488f7a7f8 100644 --- a/test/parallel/test-fs-watch-encoding.js +++ b/test/parallel/test-fs-watch-encoding.js @@ -11,17 +11,16 @@ // On SmartOS, the watch events fire but the filename is null. const common = require('../common'); -const fs = require('fs'); -const path = require('path'); // fs-watch on folders have limited capability in AIX. // The testcase makes use of folder watching, and causes // hang. This behavior is documented. Skip this for AIX. -if (common.isAix) { +if (common.isAix) common.skip('folder watch capability is limited in AIX.'); - return; -} + +const fs = require('fs'); +const path = require('path'); common.refreshTmpDir(); diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index 5fb13623dff..8e27abb2517 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!(common.isOSX || common.isWindows)) { +if (!(common.isOSX || common.isWindows)) common.skip('recursive option is darwin/windows specific'); - return; -} const assert = require('assert'); const path = require('path'); diff --git a/test/parallel/test-http-chunk-problem.js b/test/parallel/test-http-chunk-problem.js index 822aab804f0..46a7406e745 100644 --- a/test/parallel/test-http-chunk-problem.js +++ b/test/parallel/test-http-chunk-problem.js @@ -1,11 +1,10 @@ 'use strict'; // http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919 const common = require('../common'); -const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); if (process.argv[2] === 'request') { const http = require('http'); diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js index d53c69c1b0d..beae62d3998 100644 --- a/test/parallel/test-http-default-port.js +++ b/test/parallel/test-http-default-port.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const http = require('http'); const https = require('https'); diff --git a/test/parallel/test-http-dns-error.js b/test/parallel/test-http-dns-error.js index 4a724b0b41a..76634c5a830 100644 --- a/test/parallel/test-http-dns-error.js +++ b/test/parallel/test-http-dns-error.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const http = require('http'); @@ -57,7 +55,7 @@ function test(mod) { if (common.hasCrypto) { test(https); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } test(http); diff --git a/test/parallel/test-http-full-response.js b/test/parallel/test-http-full-response.js index dc52a5bc2f1..42213432090 100644 --- a/test/parallel/test-http-full-response.js +++ b/test/parallel/test-http-full-response.js @@ -43,7 +43,7 @@ function runAb(opts, callback) { exec(command, function(err, stdout, stderr) { if (err) { if (/ab|apr/i.test(stderr)) { - common.skip(`problem spawning \`ab\`.\n${stderr}`); + common.printSkipMessage(`problem spawning \`ab\`.\n${stderr}`); process.reallyExit(0); } process.exit(); diff --git a/test/parallel/test-http-invalid-urls.js b/test/parallel/test-http-invalid-urls.js index 65cca822f9b..039270fe430 100644 --- a/test/parallel/test-http-invalid-urls.js +++ b/test/parallel/test-http-invalid-urls.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const http = require('http'); diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index 35f2c15f8d9..0ed048688ee 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasMultiLocalhost()) + common.skip('platform-specific test.'); + const http = require('http'); const assert = require('assert'); -if (!common.hasMultiLocalhost()) { - common.skip('platform-specific test.'); - return; -} - const server = http.createServer(function(req, res) { console.log(`Connect from: ${req.connection.remoteAddress}`); assert.strictEqual('127.0.0.2', req.connection.remoteAddress); diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js index 5c625cf4475..b644e7530ff 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const url = require('url'); const fs = require('fs'); diff --git a/test/parallel/test-https-agent-constructor.js b/test/parallel/test-https-agent-constructor.js index fe77381c858..29bb9eaa980 100644 --- a/test/parallel/test-https-agent-constructor.js +++ b/test/parallel/test-https-agent-constructor.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-agent-create-connection.js b/test/parallel/test-https-agent-create-connection.js index a1f0c4ace4c..267030232dc 100644 --- a/test/parallel/test-https-agent-create-connection.js +++ b/test/parallel/test-https-agent-create-connection.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-agent-disable-session-reuse.js b/test/parallel/test-https-agent-disable-session-reuse.js index 0331cd4e283..4f92547e999 100644 --- a/test/parallel/test-https-agent-disable-session-reuse.js +++ b/test/parallel/test-https-agent-disable-session-reuse.js @@ -1,18 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} - -const TOTAL_REQS = 2; +const assert = require('assert'); const https = require('https'); - const fs = require('fs'); +const TOTAL_REQS = 2; + const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index 9b4f29602b7..0986f8472de 100644 --- a/test/parallel/test-https-agent-getname.js +++ b/test/parallel/test-https-agent-getname.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-agent-secure-protocol.js b/test/parallel/test-https-agent-secure-protocol.js index c11d9f8ca87..4839dd7c460 100644 --- a/test/parallel/test-https-agent-secure-protocol.js +++ b/test/parallel/test-https-agent-secure-protocol.js @@ -1,12 +1,9 @@ 'use strict'; -const assert = require('assert'); const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const https = require('https'); const fs = require('fs'); diff --git a/test/parallel/test-https-agent-servername.js b/test/parallel/test-https-agent-servername.js index 8562d021c99..625fa45c7c1 100644 --- a/test/parallel/test-https-agent-servername.js +++ b/test/parallel/test-https-agent-servername.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const https = require('https'); const fs = require('fs'); diff --git a/test/parallel/test-https-agent-session-eviction.js b/test/parallel/test-https-agent-session-eviction.js index acead806ed0..567ed809e64 100644 --- a/test/parallel/test-https-agent-session-eviction.js +++ b/test/parallel/test-https-agent-session-eviction.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-agent-session-reuse.js b/test/parallel/test-https-agent-session-reuse.js index a9977d8ce9a..f850144eaab 100644 --- a/test/parallel/test-https-agent-session-reuse.js +++ b/test/parallel/test-https-agent-session-reuse.js @@ -2,10 +2,8 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const https = require('https'); const crypto = require('crypto'); diff --git a/test/parallel/test-https-agent-sni.js b/test/parallel/test-https-agent-sni.js index fb7bee16ec0..a06ce439fa4 100644 --- a/test/parallel/test-https-agent-sni.js +++ b/test/parallel/test-https-agent-sni.js @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-https-agent-sockets-leak.js b/test/parallel/test-https-agent-sockets-leak.js index bc86b9c2412..2fc477c0b33 100644 --- a/test/parallel/test-https-agent-sockets-leak.js +++ b/test/parallel/test-https-agent-sockets-leak.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const fs = require('fs'); const https = require('https'); diff --git a/test/parallel/test-https-agent.js b/test/parallel/test-https-agent.js index add9913358f..e2e71cd31a7 100644 --- a/test/parallel/test-https-agent.js +++ b/test/parallel/test-https-agent.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-https-argument-of-creating.js b/test/parallel/test-https-argument-of-creating.js index 87d934316f8..5a4150eb1cc 100644 --- a/test/parallel/test-https-argument-of-creating.js +++ b/test/parallel/test-https-argument-of-creating.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-byteswritten.js b/test/parallel/test-https-byteswritten.js index cad824c5fed..8f4d761c02b 100644 --- a/test/parallel/test-https-byteswritten.js +++ b/test/parallel/test-https-byteswritten.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff --git a/test/parallel/test-https-client-checkServerIdentity.js b/test/parallel/test-https-client-checkServerIdentity.js index a70af2c4294..9842fc1f357 100644 --- a/test/parallel/test-https-client-checkServerIdentity.js +++ b/test/parallel/test-https-client-checkServerIdentity.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js index 05a3824637a..f0e919ca648 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -21,19 +21,17 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); - const fs = require('fs'); const url = require('url'); + const URL = url.URL; const options = { diff --git a/test/parallel/test-https-client-reject.js b/test/parallel/test-https-client-reject.js index 95c3ca1a3b8..82a7851e4e1 100644 --- a/test/parallel/test-https-client-reject.js +++ b/test/parallel/test-https-client-reject.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js index 95e1da56d0c..d61d91964b0 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -24,14 +24,11 @@ // Cache session and close connection. Use session on second connection. // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-https-close.js b/test/parallel/test-https-close.js index 4c4dea577c0..1590f3cb5b3 100644 --- a/test/parallel/test-https-close.js +++ b/test/parallel/test-https-close.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const fs = require('fs'); const https = require('https'); const options = { diff --git a/test/parallel/test-https-connect-address-family.js b/test/parallel/test-https-connect-address-family.js index e7f41ce861c..76a12ef5d5d 100644 --- a/test/parallel/test-https-connect-address-family.js +++ b/test/parallel/test-https-connect-address-family.js @@ -1,14 +1,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('no IPv6 support'); - return; -} const assert = require('assert'); const https = require('https'); @@ -37,10 +33,9 @@ function runTest() { dns.lookup('localhost', {family: 6, all: true}, (err, addresses) => { if (err) { - if (err.code === 'ENOTFOUND') { + if (err.code === 'ENOTFOUND') common.skip('localhost does not resolve to ::1'); - return; - } + throw err; } diff --git a/test/parallel/test-https-connecting-to-http.js b/test/parallel/test-https-connecting-to-http.js index 168be7c2d98..195ad38ed44 100644 --- a/test/parallel/test-https-connecting-to-http.js +++ b/test/parallel/test-https-connecting-to-http.js @@ -23,14 +23,11 @@ // This tests the situation where you try to connect a https client // to an http server. You should get an error and exit. const common = require('../common'); -const http = require('http'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const http = require('http'); +const https = require('https'); const server = http.createServer(common.mustNotCall()); server.listen(0, common.mustCall(function() { diff --git a/test/parallel/test-https-drain.js b/test/parallel/test-https-drain.js index ed0a11ae832..f9316a261b9 100644 --- a/test/parallel/test-https-drain.js +++ b/test/parallel/test-https-drain.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-https-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js index 3300dabb54a..3c724fe6342 100644 --- a/test/parallel/test-https-eof-for-eom.js +++ b/test/parallel/test-https-eof-for-eom.js @@ -29,15 +29,12 @@ // correctly. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const https = require('https'); const tls = require('tls'); - const fs = require('fs'); const options = { diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js index 9900cf7a643..d8beefc22b2 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -21,22 +21,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} const assert = require('assert'); const join = require('path').join; - const fs = require('fs'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js index adb8952871c..1181d300bf2 100644 --- a/test/parallel/test-https-host-headers.js +++ b/test/parallel/test-https-host-headers.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); + const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) diff --git a/test/parallel/test-https-localaddress-bind-error.js b/test/parallel/test-https-localaddress-bind-error.js index 0b046cfa85c..a22db1e9e61 100644 --- a/test/parallel/test-https-localaddress-bind-error.js +++ b/test/parallel/test-https-localaddress-bind-error.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js index bcd1d6fdbd7..1c5669be30c 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -21,19 +21,15 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); -if (!common.hasMultiLocalhost()) { +if (!common.hasMultiLocalhost()) common.skip('platform-specific test.'); - return; -} + +const fs = require('fs'); +const assert = require('assert'); +const https = require('https'); const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), diff --git a/test/parallel/test-https-pfx.js b/test/parallel/test-https-pfx.js index 9d7a1d888ce..d7561f74246 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const pfx = fs.readFileSync(`${common.fixturesDir}/test_cert.pfx`); diff --git a/test/parallel/test-https-req-split.js b/test/parallel/test-https-req-split.js index 0abd74be617..d0306cb714f 100644 --- a/test/parallel/test-https-req-split.js +++ b/test/parallel/test-https-req-split.js @@ -21,13 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-resume-after-renew.js b/test/parallel/test-https-resume-after-renew.js index c9e208ab971..eb319230371 100644 --- a/test/parallel/test-https-resume-after-renew.js +++ b/test/parallel/test-https-resume-after-renew.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const fs = require('fs'); const https = require('https'); diff --git a/test/parallel/test-https-server-keep-alive-timeout.js b/test/parallel/test-https-server-keep-alive-timeout.js index d1e9ed67889..01d0fa6078b 100644 --- a/test/parallel/test-https-server-keep-alive-timeout.js +++ b/test/parallel/test-https-server-keep-alive-timeout.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js index 3ad2806f6af..b79d1b943f3 100644 --- a/test/parallel/test-https-simple.js +++ b/test/parallel/test-https-simple.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-socket-options.js b/test/parallel/test-https-socket-options.js index d6f6aaae7af..2a6fc8f84f7 100644 --- a/test/parallel/test-https-socket-options.js +++ b/test/parallel/test-https-socket-options.js @@ -22,14 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const https = require('https'); const fs = require('fs'); - const http = require('http'); const options = { diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index f28164a322a..060151332d2 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -21,17 +21,14 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); - const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-https-timeout-server-2.js b/test/parallel/test-https-timeout-server-2.js index 08144f108b2..269c06569f6 100644 --- a/test/parallel/test-https-timeout-server-2.js +++ b/test/parallel/test-https-timeout-server-2.js @@ -22,14 +22,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js index 7d33e552115..17218ba8055 100644 --- a/test/parallel/test-https-timeout-server.js +++ b/test/parallel/test-https-timeout-server.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-timeout.js b/test/parallel/test-https-timeout.js index e75a8566e42..ad1fcb3ed23 100644 --- a/test/parallel/test-https-timeout.js +++ b/test/parallel/test-https-timeout.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const fs = require('fs'); diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js index d15efc9abce..dcefcca104e 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-unix-socket-self-signed.js b/test/parallel/test-https-unix-socket-self-signed.js index f503b84591c..df6773f8390 100644 --- a/test/parallel/test-https-unix-socket-self-signed.js +++ b/test/parallel/test-https-unix-socket-self-signed.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} common.refreshTmpDir(); diff --git a/test/parallel/test-icu-data-dir.js b/test/parallel/test-icu-data-dir.js index 5619d934020..eb9b07e3a49 100644 --- a/test/parallel/test-icu-data-dir.js +++ b/test/parallel/test-icu-data-dir.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!(common.hasIntl && common.hasSmallICU)) { +if (!(common.hasIntl && common.hasSmallICU)) common.skip('missing Intl'); - return; -} + const assert = require('assert'); const { spawnSync } = require('child_process'); diff --git a/test/parallel/test-icu-punycode.js b/test/parallel/test-icu-punycode.js index 9488568267a..7abcae46177 100644 --- a/test/parallel/test-icu-punycode.js +++ b/test/parallel/test-icu-punycode.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const icu = process.binding('icu'); const assert = require('assert'); diff --git a/test/parallel/test-icu-stringwidth.js b/test/parallel/test-icu-stringwidth.js index 7c8c2e948e0..3c8021049c3 100644 --- a/test/parallel/test-icu-stringwidth.js +++ b/test/parallel/test-icu-stringwidth.js @@ -2,10 +2,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const assert = require('assert'); const readline = require('internal/readline'); diff --git a/test/parallel/test-icu-transcode.js b/test/parallel/test-icu-transcode.js index 1c77427b154..d7794c30b7a 100644 --- a/test/parallel/test-icu-transcode.js +++ b/test/parallel/test-icu-transcode.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const buffer = require('buffer'); const assert = require('assert'); diff --git a/test/parallel/test-inspector-open.js b/test/parallel/test-inspector-open.js index bc7d15a554a..346393d6fac 100644 --- a/test/parallel/test-inspector-open.js +++ b/test/parallel/test-inspector-open.js @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); +common.skipIfInspectorDisabled(); // Test inspector open()/close()/url() API. It uses ephemeral ports so can be // run safely in parallel. @@ -9,8 +10,6 @@ const fork = require('child_process').fork; const net = require('net'); const url = require('url'); -common.skipIfInspectorDisabled(); - if (process.env.BE_CHILD) return beChild(); diff --git a/test/parallel/test-intl-v8BreakIterator.js b/test/parallel/test-intl-v8BreakIterator.js index 70f0f782bbc..6e9c9dbe3a1 100644 --- a/test/parallel/test-intl-v8BreakIterator.js +++ b/test/parallel/test-intl-v8BreakIterator.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl || Intl.v8BreakIterator === undefined) { - return common.skip('missing Intl'); -} +if (!common.hasIntl || Intl.v8BreakIterator === undefined) + common.skip('missing Intl'); const assert = require('assert'); const warning = 'Intl.v8BreakIterator is deprecated and will be removed soon.'; diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index 1e061d8f51d..ff9569774d0 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -52,7 +52,6 @@ if (!common.hasIntl) { `"Intl" object is NOT present but v8_enable_i18n_support is ${enablei18n}`; assert.strictEqual(enablei18n, 0, erMsg); common.skip('Intl tests because Intl object not present.'); - } else { const erMsg = `"Intl" object is present but v8_enable_i18n_support is ${ @@ -72,7 +71,7 @@ if (!common.hasIntl) { // If list is specified and doesn't contain 'en' then return. if (process.config.variables.icu_locales && !haveLocale('en')) { - common.skip( + common.printSkipMessage( 'detailed Intl tests because English is not listed as supported.'); // Smoke test. Does it format anything, or fail? console.log(`Date(0) formatted to: ${dtf.format(date0)}`); diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index 688083f2a89..4f74a5b22d6 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); @@ -28,11 +31,6 @@ const cluster = require('cluster'); console.error('Cluster listen fd test', process.argv[2] || 'runner'); -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - // Process relationship is: // // parent: the test main script diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index f3f33055ac7..aad8d663c91 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); case 'parent': return parent(); diff --git a/test/parallel/test-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js index 8a40cce56bc..cc9cb6471e4 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); case 'parent': return parent(); diff --git a/test/parallel/test-listen-fd-server.js b/test/parallel/test-listen-fd-server.js index 3d238a8019a..b21b5ee55d2 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -21,15 +21,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); } diff --git a/test/parallel/test-module-circular-symlinks.js b/test/parallel/test-module-circular-symlinks.js index a04022c6564..b5e04a9c622 100644 --- a/test/parallel/test-module-circular-symlinks.js +++ b/test/parallel/test-module-circular-symlinks.js @@ -50,7 +50,6 @@ try { } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('insufficient privileges for symlinks'); - return; } fs.writeFileSync(path.join(tmpDir, 'index.js'), diff --git a/test/parallel/test-module-symlinked-peer-modules.js b/test/parallel/test-module-symlinked-peer-modules.js index 83aca75ed19..5fe3169ee87 100644 --- a/test/parallel/test-module-symlinked-peer-modules.js +++ b/test/parallel/test-module-symlinked-peer-modules.js @@ -46,7 +46,6 @@ try { } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('insufficient privileges for symlinks'); - return; } fs.writeFileSync(path.join(moduleA, 'package.json'), diff --git a/test/parallel/test-net-access-byteswritten.js b/test/parallel/test-net-access-byteswritten.js index 5b734e7c6dc..c928ab27c6d 100644 --- a/test/parallel/test-net-access-byteswritten.js +++ b/test/parallel/test-net-access-byteswritten.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const net = require('net'); const tls = require('tls'); diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index 9e3859f8431..68e63f0ba4c 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Does not support wrapping sockets with fd on Windows'); + const assert = require('assert'); const net = require('net'); const path = require('path'); const Pipe = process.binding('pipe_wrap').Pipe; -if (common.isWindows) { - common.skip('Does not support wrapping sockets with fd on Windows'); - return; -} - common.refreshTmpDir(); function testClients(getSocketOpt, getConnectOpt, getConnectCb) { diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index 6ac6c29e10f..29b07645c45 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + const assert = require('assert'); const net = require('net'); -if (!common.hasIPv6) { - common.skip('no IPv6 support'); - return; -} - const hosts = common.localIPv6Hosts; let hostIdx = 0; let host = hosts[hostIdx]; @@ -81,8 +79,8 @@ function tryConnect() { if (host) tryConnect(); else { - common.skip('no IPv6 localhost support'); server.close(); + common.skip('no IPv6 localhost support'); } return; } diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index 19749bde955..c4f11db76bc 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - // skip test in FreeBSD jails -if (common.inFreeBSDJail) { +if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); - return; -} + +const assert = require('assert'); +const net = require('net'); let conns = 0; const clientLocalPorts = []; diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index 75e2c92d5a7..1faa698b15f 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const path = require('path'); const spawn = require('child_process').spawn; diff --git a/test/parallel/test-openssl-ca-options.js b/test/parallel/test-openssl-ca-options.js index 144a7dfe3d0..f8f777e2682 100644 --- a/test/parallel/test-openssl-ca-options.js +++ b/test/parallel/test-openssl-ca-options.js @@ -2,10 +2,9 @@ // This test checks the usage of --use-bundled-ca and --use-openssl-ca arguments // to verify that both are not used at the same time. const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const os = require('os'); const childProcess = require('child_process'); diff --git a/test/parallel/test-pipe-writev.js b/test/parallel/test-pipe-writev.js index 6440b5f6237..db95a4b1818 100644 --- a/test/parallel/test-pipe-writev.js +++ b/test/parallel/test-pipe-writev.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Unix-specific test'); + const assert = require('assert'); const net = require('net'); -if (common.isWindows) { - common.skip('Unix-specific test'); - return; -} - common.refreshTmpDir(); const server = net.createServer((connection) => { diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index 9d24fbb3652..a5f8a0c2765 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -1,16 +1,14 @@ 'use strict'; const common = require('../common'); +// Refs: https://github.com/nodejs/node/pull/2253 +if (common.isSunOS) + common.skip('unreliable on SunOS'); + const assert = require('assert'); const path = require('path'); const childProcess = require('child_process'); -// Refs: https://github.com/nodejs/node/pull/2253 -if (common.isSunOS) { - common.skip('unreliable on SunOS'); - return; -} - const nodeBinary = process.argv[0]; const preloadOption = (preloads) => { diff --git a/test/parallel/test-process-execpath.js b/test/parallel/test-process-execpath.js index 5ac8a3f2238..d70d1dfd389 100644 --- a/test/parallel/test-process-execpath.js +++ b/test/parallel/test-process-execpath.js @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('symlinks are weird on windows'); + const assert = require('assert'); const child_process = require('child_process'); const path = require('path'); @@ -7,11 +10,6 @@ const fs = require('fs'); assert.strictEqual(process.execPath, fs.realpathSync(process.execPath)); -if (common.isWindows) { - common.skip('symlinks are weird on windows'); - return; -} - if (process.argv[2] === 'child') { // The console.log() output is part of the test here. console.log(process.execPath); diff --git a/test/parallel/test-process-getgroups.js b/test/parallel/test-process-getgroups.js index 952e0d95ef9..3479cf7028b 100644 --- a/test/parallel/test-process-getgroups.js +++ b/test/parallel/test-process-getgroups.js @@ -24,10 +24,9 @@ const common = require('../common'); // Check `id -G` and `process.getgroups()` return same groups. -if (common.isOSX) { +if (common.isOSX) common.skip('Output of `id -G` is unreliable on Darwin.'); - return; -} + const assert = require('assert'); const exec = require('child_process').exec; diff --git a/test/parallel/test-process-remove-all-signal-listeners.js b/test/parallel/test-process-remove-all-signal-listeners.js index 85db45ff88c..759820c2dc5 100644 --- a/test/parallel/test-process-remove-all-signal-listeners.js +++ b/test/parallel/test-process-remove-all-signal-listeners.js @@ -1,15 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Win32 does not support signals.'); + const assert = require('assert'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('Win32 doesn\'t have signals, just a kind of ' + - 'emulation, insufficient for this test to apply.'); - return; -} - if (process.argv[2] !== '--do-test') { // We are the master, fork a child so we can verify it exits with correct // status. diff --git a/test/parallel/test-regress-GH-1531.js b/test/parallel/test-regress-GH-1531.js index 3cf342b869d..7d1f4a0dbec 100644 --- a/test/parallel/test-regress-GH-1531.js +++ b/test/parallel/test-regress-GH-1531.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const fs = require('fs'); diff --git a/test/parallel/test-regress-GH-3542.js b/test/parallel/test-regress-GH-3542.js index cc0285f7475..b652c95c9ac 100644 --- a/test/parallel/test-regress-GH-3542.js +++ b/test/parallel/test-regress-GH-3542.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// This test is only relevant on Windows. +if (!common.isWindows) + common.skip('Windows specific test.'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); -// This test is only relevant on Windows. -if (!common.isWindows) { - common.skip('Windows specific test.'); - return; -} - function test(p) { const result = fs.realpathSync(p); assert.strictEqual(result.toLowerCase(), path.resolve(p).toLowerCase()); diff --git a/test/parallel/test-regress-GH-9819.js b/test/parallel/test-regress-GH-9819.js index fb9bb489a08..7eed1c512f7 100644 --- a/test/parallel/test-regress-GH-9819.js +++ b/test/parallel/test-regress-GH-9819.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const execFile = require('child_process').execFile; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const setup = 'const enc = { toString: () => { throw new Error("xyz"); } };'; const scripts = [ diff --git a/test/parallel/test-repl-history-perm.js b/test/parallel/test-repl-history-perm.js index 1a98999c3be..259c96fe8aa 100644 --- a/test/parallel/test-repl-history-perm.js +++ b/test/parallel/test-repl-history-perm.js @@ -7,7 +7,6 @@ if (common.isWindows) { common.skip('Win32 uses ACLs for file permissions, ' + 'modes are always 0666 and says nothing about group/other ' + 'read access.'); - return; } const assert = require('assert'); diff --git a/test/parallel/test-repl-sigint-nested-eval.js b/test/parallel/test-repl-sigint-nested-eval.js index 030c86be8e8..7f15b7dfeb8 100644 --- a/test/parallel/test-repl-sigint-nested-eval.js +++ b/test/parallel/test-repl-sigint-nested-eval.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const spawn = require('child_process').spawn; + process.env.REPL_TEST_PPID = process.pid; const child = spawn(process.execPath, [ '-i' ], { stdio: [null, null, 2] diff --git a/test/parallel/test-repl-sigint.js b/test/parallel/test-repl-sigint.js index 61bc75cc6ff..818111c39bf 100644 --- a/test/parallel/test-repl-sigint.js +++ b/test/parallel/test-repl-sigint.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const spawn = require('child_process').spawn; + process.env.REPL_TEST_PPID = process.pid; const child = spawn(process.execPath, [ '-i' ], { stdio: [null, null, 2] diff --git a/test/parallel/test-require-long-path.js b/test/parallel/test-require-long-path.js index 1a8ce1b7dfd..aaaf07d48ae 100644 --- a/test/parallel/test-require-long-path.js +++ b/test/parallel/test-require-long-path.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('this test is Windows-specific.'); + const fs = require('fs'); const path = require('path'); -if (!common.isWindows) { - common.skip('this test is Windows-specific.'); - return; -} - // make a path that is more than 260 chars long. const dirNameLen = Math.max(260 - common.tmpDir.length, 1); const dirName = path.join(common.tmpDir, 'x'.repeat(dirNameLen)); diff --git a/test/parallel/test-require-symlink.js b/test/parallel/test-require-symlink.js index 964f856829a..d5dc03e49df 100644 --- a/test/parallel/test-require-symlink.js +++ b/test/parallel/test-require-symlink.js @@ -27,10 +27,8 @@ if (common.isWindows) { // On Windows, creating symlinks requires admin privileges. // We'll only try to run symlink test if we have enough privileges. exec('whoami /priv', function(err, o) { - if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) { + if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) common.skip('insufficient privileges'); - return; - } test(); }); diff --git a/test/parallel/test-setproctitle.js b/test/parallel/test-setproctitle.js index 672b6f037d8..f4e25a6e8ce 100644 --- a/test/parallel/test-setproctitle.js +++ b/test/parallel/test-setproctitle.js @@ -3,9 +3,8 @@ const common = require('../common'); // FIXME add sunos support -if (common.isSunOS) { - return common.skip(`Unsupported platform [${process.platform}]`); -} +if (common.isSunOS) + common.skip(`Unsupported platform [${process.platform}]`); const assert = require('assert'); const exec = require('child_process').exec; @@ -21,9 +20,8 @@ process.title = title; assert.strictEqual(process.title, title); // Test setting the title but do not try to run `ps` on Windows. -if (common.isWindows) { - return common.skip('Windows does not have "ps" utility'); -} +if (common.isWindows) + common.skip('Windows does not have "ps" utility'); // To pass this test on alpine, since Busybox `ps` does not // support `-p` switch, use `ps -o` and `grep` instead. diff --git a/test/parallel/test-signal-handler.js b/test/parallel/test-signal-handler.js index db34a036e45..a5c900695a5 100644 --- a/test/parallel/test-signal-handler.js +++ b/test/parallel/test-signal-handler.js @@ -23,10 +23,8 @@ const common = require('../common'); -if (common.isWindows) { +if (common.isWindows) common.skip('SIGUSR1 and SIGHUP signals are not supported'); - return; -} console.log(`process.pid: ${process.pid}`); diff --git a/test/parallel/test-spawn-cmd-named-pipe.js b/test/parallel/test-spawn-cmd-named-pipe.js index 94a34b640d1..30d0ec2c263 100644 --- a/test/parallel/test-spawn-cmd-named-pipe.js +++ b/test/parallel/test-spawn-cmd-named-pipe.js @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - // This test is intended for Windows only -if (!common.isWindows) { +if (!common.isWindows) common.skip('this test is Windows-specific.'); - return; -} + +const assert = require('assert'); if (!process.argv[2]) { // parent diff --git a/test/parallel/test-tls-0-dns-altname.js b/test/parallel/test-tls-0-dns-altname.js index 7ac40eeda16..0b1c7f6496c 100644 --- a/test/parallel/test-tls-0-dns-altname.js +++ b/test/parallel/test-tls-0-dns-altname.js @@ -21,16 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); +if (!common.hasCrypto) + common.skip('missing crypto'); // Check getPeerCertificate can properly handle '\0' for fix CVE-2009-2408. -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js index d089ad223b1..0b3447243db 100644 --- a/test/parallel/test-tls-alert-handling.js +++ b/test/parallel/test-tls-alert-handling.js @@ -1,15 +1,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index ef79856108e..8aa56eaf755 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -21,16 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const assert = require('assert'); const { spawn } = require('child_process'); diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js index 3d3453d32fd..56f925b8a97 100644 --- a/test/parallel/test-tls-alpn-server-client.js +++ b/test/parallel/test-tls-alpn-server-client.js @@ -1,15 +1,12 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} if (!process.features.tls_alpn || !process.features.tls_npn) { common.skip( 'Skipping because node compiled without NPN or ALPN feature of OpenSSL.'); - return; } const assert = require('assert'); diff --git a/test/parallel/test-tls-async-cb-after-socket-end.js b/test/parallel/test-tls-async-cb-after-socket-end.js index be499b84503..6b4d2bd9f58 100644 --- a/test/parallel/test-tls-async-cb-after-socket-end.js +++ b/test/parallel/test-tls-async-cb-after-socket-end.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const path = require('path'); const fs = require('fs'); diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js index a6775c06033..1d494b4ed3b 100644 --- a/test/parallel/test-tls-basic-validations.js +++ b/test/parallel/test-tls-basic-validations.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-cert-regression.js b/test/parallel/test-tls-cert-regression.js index 0a128275c38..ab967bb2c6e 100644 --- a/test/parallel/test-tls-cert-regression.js +++ b/test/parallel/test-tls-cert-regression.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js index e608df5a5a1..1623e70a2af 100644 --- a/test/parallel/test-tls-check-server-identity.js +++ b/test/parallel/test-tls-check-server-identity.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const util = require('util'); diff --git a/test/parallel/test-tls-cipher-list.js b/test/parallel/test-tls-cipher-list.js index 912fb641285..4a39ee9391a 100644 --- a/test/parallel/test-tls-cipher-list.js +++ b/test/parallel/test-tls-cipher-list.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const spawn = require('child_process').spawn; diff --git a/test/parallel/test-tls-client-abort.js b/test/parallel/test-tls-client-abort.js index 15928a04f67..14f96104e16 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-client-abort2.js b/test/parallel/test-tls-client-abort2.js index a652edfa8fe..59b592d2556 100644 --- a/test/parallel/test-tls-client-abort2.js +++ b/test/parallel/test-tls-client-abort2.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const conn = tls.connect(0, common.mustNotCall()); diff --git a/test/parallel/test-tls-client-default-ciphers.js b/test/parallel/test-tls-client-default-ciphers.js index 9eefe21e957..0630fe947e7 100644 --- a/test/parallel/test-tls-client-default-ciphers.js +++ b/test/parallel/test-tls-client-default-ciphers.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); function Done() {} diff --git a/test/parallel/test-tls-client-destroy-soon.js b/test/parallel/test-tls-client-destroy-soon.js index 8d1f3e90234..a94e8fbdb98 100644 --- a/test/parallel/test-tls-client-destroy-soon.js +++ b/test/parallel/test-tls-client-destroy-soon.js @@ -25,14 +25,11 @@ // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js index f3da64ed376..53e0144ac73 100644 --- a/test/parallel/test-tls-client-getephemeralkeyinfo.js +++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(); -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); diff --git a/test/parallel/test-tls-client-mindhsize.js b/test/parallel/test-tls-client-mindhsize.js index 10fe196b539..230c6e08458 100644 --- a/test/parallel/test-tls-client-mindhsize.js +++ b/test/parallel/test-tls-client-mindhsize.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(); -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); diff --git a/test/parallel/test-tls-client-reject.js b/test/parallel/test-tls-client-reject.js index 43cf337e672..a11e0fe2802 100644 --- a/test/parallel/test-tls-client-reject.js +++ b/test/parallel/test-tls-client-reject.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-client-resume.js b/test/parallel/test-tls-client-resume.js index aa23f3331b5..fccdf6d930c 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -25,14 +25,11 @@ // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index d713be3b0cf..21718516658 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -21,11 +21,8 @@ 'use strict'; const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-close-error.js b/test/parallel/test-tls-close-error.js index 978f7659508..9973adde122 100644 --- a/test/parallel/test-tls-close-error.js +++ b/test/parallel/test-tls-close-error.js @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-close-notify.js b/test/parallel/test-tls-close-notify.js index 625909c9c5e..500aec26c8d 100644 --- a/test/parallel/test-tls-close-notify.js +++ b/test/parallel/test-tls-close-notify.js @@ -22,12 +22,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-cnnic-whitelist.js b/test/parallel/test-tls-cnnic-whitelist.js index 08453174865..84b71c7e64b 100644 --- a/test/parallel/test-tls-cnnic-whitelist.js +++ b/test/parallel/test-tls-cnnic-whitelist.js @@ -2,10 +2,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-connect-address-family.js b/test/parallel/test-tls-connect-address-family.js index f22831f395a..afacd5a3902 100644 --- a/test/parallel/test-tls-connect-address-family.js +++ b/test/parallel/test-tls-connect-address-family.js @@ -1,14 +1,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('no IPv6 support'); - return; -} const assert = require('assert'); const tls = require('tls'); @@ -36,10 +32,9 @@ function runTest() { dns.lookup('localhost', {family: 6, all: true}, (err, addresses) => { if (err) { - if (err.code === 'ENOTFOUND') { + if (err.code === 'ENOTFOUND') common.skip('localhost does not resolve to ::1'); - return; - } + throw err; } diff --git a/test/parallel/test-tls-connect-given-socket.js b/test/parallel/test-tls-connect-given-socket.js index 08553916194..d922d7d4d53 100644 --- a/test/parallel/test-tls-connect-given-socket.js +++ b/test/parallel/test-tls-connect-given-socket.js @@ -21,17 +21,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const net = require('net'); const fs = require('fs'); const path = require('path'); + const options = { key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')), cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) diff --git a/test/parallel/test-tls-connect-no-host.js b/test/parallel/test-tls-connect-no-host.js index 2e4bcfbc6d4..f63c821a7f6 100644 --- a/test/parallel/test-tls-connect-no-host.js +++ b/test/parallel/test-tls-connect-no-host.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const assert = require('assert'); diff --git a/test/parallel/test-tls-connect-pipe.js b/test/parallel/test-tls-connect-pipe.js index 836471a0c50..8a3abe3312e 100644 --- a/test/parallel/test-tls-connect-pipe.js +++ b/test/parallel/test-tls-connect-pipe.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-connect-simple.js b/test/parallel/test-tls-connect-simple.js index 7e0d1b462bf..d6211d05c8c 100644 --- a/test/parallel/test-tls-connect-simple.js +++ b/test/parallel/test-tls-connect-simple.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-connect-stream-writes.js b/test/parallel/test-tls-connect-stream-writes.js index 637e54f535d..4a8b53b4de1 100644 --- a/test/parallel/test-tls-connect-stream-writes.js +++ b/test/parallel/test-tls-connect-stream-writes.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-connect.js b/test/parallel/test-tls-connect.js index 1908dba6574..5e73196bc1f 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -22,12 +22,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-delayed-attach-error.js b/test/parallel/test-tls-delayed-attach-error.js index 35da6d0e42e..9d37f15efe4 100644 --- a/test/parallel/test-tls-delayed-attach-error.js +++ b/test/parallel/test-tls-delayed-attach-error.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-delayed-attach.js b/test/parallel/test-tls-delayed-attach.js index fa8baa81f85..9ab61156658 100644 --- a/test/parallel/test-tls-delayed-attach.js +++ b/test/parallel/test-tls-delayed-attach.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-destroy-whilst-write.js b/test/parallel/test-tls-destroy-whilst-write.js index b4f9766d998..d157c7bf3f8 100644 --- a/test/parallel/test-tls-destroy-whilst-write.js +++ b/test/parallel/test-tls-destroy-whilst-write.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const stream = require('stream'); diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js index 2f86e82be7f..fe17206fdcd 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -22,22 +22,17 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const spawn = require('child_process').spawn; const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); let nsuccess = 0; diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js index 732ebe4d1bd..65ee8fd6919 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -21,20 +21,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const exec = require('child_process').exec; const fs = require('fs'); diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index 32e77456bdc..856c1a96fb8 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-econnreset.js b/test/parallel/test-tls-econnreset.js index 798c10ca4c1..8a6536890e8 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const cacert = diff --git a/test/parallel/test-tls-empty-sni-context.js b/test/parallel/test-tls-empty-sni-context.js index 4974e6323e8..9a8e3449f0c 100644 --- a/test/parallel/test-tls-empty-sni-context.js +++ b/test/parallel/test-tls-empty-sni-context.js @@ -1,18 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!process.features.tls_sni) { +if (!process.features.tls_sni) common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} const assert = require('assert'); - -if (!common.hasCrypto) { - return common.skip('missing crypto'); -} - const tls = require('tls'); const options = { diff --git a/test/parallel/test-tls-env-bad-extra-ca.js b/test/parallel/test-tls-env-bad-extra-ca.js index 57e4c1cfaf3..ece93f33539 100644 --- a/test/parallel/test-tls-env-bad-extra-ca.js +++ b/test/parallel/test-tls-env-bad-extra-ca.js @@ -3,10 +3,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-env-extra-ca.js b/test/parallel/test-tls-env-extra-ca.js index e2de272184e..be7c826b85c 100644 --- a/test/parallel/test-tls-env-extra-ca.js +++ b/test/parallel/test-tls-env-extra-ca.js @@ -3,10 +3,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-external-accessor.js b/test/parallel/test-tls-external-accessor.js index 08a4ad16e8b..2d7b1f62b98 100644 --- a/test/parallel/test-tls-external-accessor.js +++ b/test/parallel/test-tls-external-accessor.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -// Ensure accessing ._external doesn't hit an assert in the accessor method. +const assert = require('assert'); const tls = require('tls'); + +// Ensure accessing ._external doesn't hit an assert in the accessor method. { const pctx = tls.createSecureContext().context; const cctx = Object.create(pctx); diff --git a/test/parallel/test-tls-fast-writing.js b/test/parallel/test-tls-fast-writing.js index 05722d89594..b846f732d2f 100644 --- a/test/parallel/test-tls-fast-writing.js +++ b/test/parallel/test-tls-fast-writing.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const dir = common.fixturesDir; diff --git a/test/parallel/test-tls-friendly-error-message.js b/test/parallel/test-tls-friendly-error-message.js index c476fb20fe4..644b298fb9a 100644 --- a/test/parallel/test-tls-friendly-error-message.js +++ b/test/parallel/test-tls-friendly-error-message.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`); diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js index d2c5b9eab4d..acf07ef0a03 100644 --- a/test/parallel/test-tls-getcipher.js +++ b/test/parallel/test-tls-getcipher.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-getprotocol.js b/test/parallel/test-tls-getprotocol.js index 393b8fb3fe0..dd96aa6f749 100644 --- a/test/parallel/test-tls-getprotocol.js +++ b/test/parallel/test-tls-getprotocol.js @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-handshake-error.js b/test/parallel/test-tls-handshake-error.js index 3bd74baa977..e4a4addd37b 100644 --- a/test/parallel/test-tls-handshake-error.js +++ b/test/parallel/test-tls-handshake-error.js @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-handshake-nohang.js b/test/parallel/test-tls-handshake-nohang.js index 791ba8df84b..e724fcd3422 100644 --- a/test/parallel/test-tls-handshake-nohang.js +++ b/test/parallel/test-tls-handshake-nohang.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); // neither should hang diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index a6e272aa2aa..ed4c4f7b991 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.js @@ -23,10 +23,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-honorcipherorder.js b/test/parallel/test-tls-honorcipherorder.js index a6d51d5dfee..a9d35a01bac 100644 --- a/test/parallel/test-tls-honorcipherorder.js +++ b/test/parallel/test-tls-honorcipherorder.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + let nconns = 0; // We explicitly set TLS version to 1.2 so as to be safe when the diff --git a/test/parallel/test-tls-inception.js b/test/parallel/test-tls-inception.js index 38f922107b0..267fa391a73 100644 --- a/test/parallel/test-tls-inception.js +++ b/test/parallel/test-tls-inception.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-interleave.js b/test/parallel/test-tls-interleave.js index 131915911fb..d704a35e688 100644 --- a/test/parallel/test-tls-interleave.js +++ b/test/parallel/test-tls-interleave.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js index 4437507516b..b1027dd9433 100644 --- a/test/parallel/test-tls-invoke-queued.js +++ b/test/parallel/test-tls-invoke-queued.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js index 6553d6862dd..f535a46cce5 100644 --- a/test/parallel/test-tls-js-stream.js +++ b/test/parallel/test-tls-js-stream.js @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const stream = require('stream'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-junk-closes-server.js b/test/parallel/test-tls-junk-closes-server.js index a1ffb32c240..b0e29ec9f8c 100644 --- a/test/parallel/test-tls-junk-closes-server.js +++ b/test/parallel/test-tls-junk-closes-server.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-junk-server.js b/test/parallel/test-tls-junk-server.js index 9b5ab6fdcc6..3270dec745c 100644 --- a/test/parallel/test-tls-junk-server.js +++ b/test/parallel/test-tls-junk-server.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-tls-key-mismatch.js b/test/parallel/test-tls-key-mismatch.js index ac261122ea6..ed5a15c258a 100644 --- a/test/parallel/test-tls-key-mismatch.js +++ b/test/parallel/test-tls-key-mismatch.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-legacy-deprecated.js b/test/parallel/test-tls-legacy-deprecated.js index b50c63e7763..4a6120c71b1 100644 --- a/test/parallel/test-tls-legacy-deprecated.js +++ b/test/parallel/test-tls-legacy-deprecated.js @@ -1,10 +1,9 @@ // Flags: --no-warnings 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-legacy-onselect.js b/test/parallel/test-tls-legacy-onselect.js index 9af65c43a06..efcc5c2c92b 100644 --- a/test/parallel/test-tls-legacy-onselect.js +++ b/test/parallel/test-tls-legacy-onselect.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); diff --git a/test/parallel/test-tls-lookup.js b/test/parallel/test-tls-lookup.js index cebb85c4b2a..4656d3e5cc6 100644 --- a/test/parallel/test-tls-lookup.js +++ b/test/parallel/test-tls-lookup.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js index 86ee1a4f14a..1cbcb8e272d 100644 --- a/test/parallel/test-tls-max-send-fragment.js +++ b/test/parallel/test-tls-max-send-fragment.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const buf = Buffer.allocUnsafe(10000); diff --git a/test/parallel/test-tls-multi-key.js b/test/parallel/test-tls-multi-key.js index 6158f7d4057..6e1a3c8777e 100644 --- a/test/parallel/test-tls-multi-key.js +++ b/test/parallel/test-tls-multi-key.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js index 06139307c43..11c86efa08e 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -20,13 +20,11 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const assert = require('assert'); const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); // Omitting the cert or pfx option to tls.createServer() should not throw. diff --git a/test/parallel/test-tls-no-rsa-key.js b/test/parallel/test-tls-no-rsa-key.js index 60ac0ab148b..4551928acdc 100644 --- a/test/parallel/test-tls-no-rsa-key.js +++ b/test/parallel/test-tls-no-rsa-key.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-no-sslv23.js b/test/parallel/test-tls-no-sslv23.js index 564efab26da..737f42b530d 100644 --- a/test/parallel/test-tls-no-sslv23.js +++ b/test/parallel/test-tls-no-sslv23.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); assert.throws(function() { diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index 2c2c51eb9be..0a118dbe7e9 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -1,21 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +if (common.opensslCli === false) + common.skip('node compiled without OpenSSL CLI.'); + +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const spawn = require('child_process').spawn; -if (common.opensslCli === false) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - const cert = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`); const key = fs.readFileSync(`${common.fixturesDir}/test_key.pem`); const server = tls.createServer({ cert: cert, key: key }, common.mustNotCall()); @@ -48,7 +43,7 @@ server.on('tlsClientError', (err) => errors.push(err)); process.on('exit', function() { if (/unknown option -ssl3/.test(stderr)) { - common.skip('`openssl s_client -ssl3` not supported.'); + common.printSkipMessage('`openssl s_client -ssl3` not supported.'); } else { assert.strictEqual(errors.length, 1); assert(/:wrong version number/.test(errors[0].message)); diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js index ffaf61b633b..6a528732a32 100644 --- a/test/parallel/test-tls-npn-server-client.js +++ b/test/parallel/test-tls-npn-server-client.js @@ -21,15 +21,11 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_npn) { - common.skip('Skipping because node compiled without NPN feature of OpenSSL.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!process.features.tls_npn) + common.skip('Skipping because node compiled without NPN feature of OpenSSL.'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-ocsp-callback.js b/test/parallel/test-tls-ocsp-callback.js index a839384925c..b4437c6a9b3 100644 --- a/test/parallel/test-tls-ocsp-callback.js +++ b/test/parallel/test-tls-ocsp-callback.js @@ -22,19 +22,15 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_ocsp) { +if (!process.features.tls_ocsp) common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} -if (!common.opensslCli) { + +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const assert = require('assert'); diff --git a/test/parallel/test-tls-on-empty-socket.js b/test/parallel/test-tls-on-empty-socket.js index 38537fd640c..5b66edd0c20 100644 --- a/test/parallel/test-tls-on-empty-socket.js +++ b/test/parallel/test-tls-on-empty-socket.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-over-http-tunnel.js b/test/parallel/test-tls-over-http-tunnel.js index 638886e92e9..5ff05b8504f 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const net = require('net'); const http = require('http'); diff --git a/test/parallel/test-tls-parse-cert-string.js b/test/parallel/test-tls-parse-cert-string.js index c6cdbf2e36e..2e940805c0b 100644 --- a/test/parallel/test-tls-parse-cert-string.js +++ b/test/parallel/test-tls-parse-cert-string.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-passphrase.js b/test/parallel/test-tls-passphrase.js index 20b5961fb47..c8cc06d35e4 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-pause.js b/test/parallel/test-tls-pause.js index a08b435f678..647b13c62a2 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-peer-certificate-encoding.js b/test/parallel/test-tls-peer-certificate-encoding.js index 95f14c7b8ee..76781e09534 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const util = require('util'); const join = require('path').join; diff --git a/test/parallel/test-tls-peer-certificate-multi-keys.js b/test/parallel/test-tls-peer-certificate-multi-keys.js index a58c747bd41..22677238625 100644 --- a/test/parallel/test-tls-peer-certificate-multi-keys.js +++ b/test/parallel/test-tls-peer-certificate-multi-keys.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const util = require('util'); const join = require('path').join; diff --git a/test/parallel/test-tls-pfx-gh-5100-regr.js b/test/parallel/test-tls-pfx-gh-5100-regr.js index 142a7de10b8..c47ad5f89d4 100644 --- a/test/parallel/test-tls-pfx-gh-5100-regr.js +++ b/test/parallel/test-tls-pfx-gh-5100-regr.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('node compiled without crypto.'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-regr-gh-5108.js b/test/parallel/test-tls-regr-gh-5108.js index 6f4392007bc..9bb07fe7ca3 100644 --- a/test/parallel/test-tls-regr-gh-5108.js +++ b/test/parallel/test-tls-regr-gh-5108.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-request-timeout.js b/test/parallel/test-tls-request-timeout.js index c529d972d21..216b69bb212 100644 --- a/test/parallel/test-tls-request-timeout.js +++ b/test/parallel/test-tls-request-timeout.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-retain-handle-no-abort.js b/test/parallel/test-tls-retain-handle-no-abort.js index a3a2aebcd6a..4be64c15969 100644 --- a/test/parallel/test-tls-retain-handle-no-abort.js +++ b/test/parallel/test-tls-retain-handle-no-abort.js @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); const util = require('util'); diff --git a/test/parallel/test-tls-securepair-fiftharg.js b/test/parallel/test-tls-securepair-fiftharg.js index 2b69ce88f4f..236f719157f 100644 --- a/test/parallel/test-tls-securepair-fiftharg.js +++ b/test/parallel/test-tls-securepair-fiftharg.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-securepair-leak.js b/test/parallel/test-tls-securepair-leak.js index b513bcd4c7c..cbc7c7daddd 100644 --- a/test/parallel/test-tls-securepair-leak.js +++ b/test/parallel/test-tls-securepair-leak.js @@ -2,13 +2,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const { createSecureContext } = require('tls'); const { createSecurePair } = require('_tls_legacy'); diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index 00e8cd591ff..6aebc807221 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -21,20 +21,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const join = require('path').join; const net = require('net'); const fs = require('fs'); diff --git a/test/parallel/test-tls-server-connection-server.js b/test/parallel/test-tls-server-connection-server.js index 1c54eb635ad..7eef14d23b5 100644 --- a/test/parallel/test-tls-server-connection-server.js +++ b/test/parallel/test-tls-server-connection-server.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js b/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js index 0290bcc629a..8efb4ec5386 100644 --- a/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js +++ b/test/parallel/test-tls-server-failed-handshake-emits-clienterror.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); const assert = require('assert'); diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index 86a735f64c9..dcae05eb968 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); // This is a rather complex test which sets up various TLS servers with node // and connects to them using the 'openssl s_client' command line utility diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index e87c62d3ed9..805c21b3ade 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} doTest({ tickets: false }, function() { doTest({ tickets: true }, function() { diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index 4b7923891bd..2c7177389b1 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const exec = require('child_process').exec; diff --git a/test/parallel/test-tls-set-encoding.js b/test/parallel/test-tls-set-encoding.js index 7023132d737..c9ff52b9b2f 100644 --- a/test/parallel/test-tls-set-encoding.js +++ b/test/parallel/test-tls-set-encoding.js @@ -21,17 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); - const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`) diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js index ad7410b1631..f744b6db54c 100644 --- a/test/parallel/test-tls-sni-option.js +++ b/test/parallel/test-tls-sni-option.js @@ -21,15 +21,11 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_sni) { - common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!process.features.tls_sni) + common.skip('node compiled without OpenSSL or with old OpenSSL version.'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js index 300010cfa13..83fd50c0660 100644 --- a/test/parallel/test-tls-sni-server-client.js +++ b/test/parallel/test-tls-sni-server-client.js @@ -21,15 +21,11 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_sni) { - common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!process.features.tls_sni) + common.skip('node compiled without OpenSSL or with old OpenSSL version.'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-socket-close.js b/test/parallel/test-tls-socket-close.js index 25282ada9ed..f9a77bf4648 100644 --- a/test/parallel/test-tls-socket-close.js +++ b/test/parallel/test-tls-socket-close.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const assert = require('assert'); +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-socket-destroy.js b/test/parallel/test-tls-socket-destroy.js index 0a72ac6232e..b101a872c23 100644 --- a/test/parallel/test-tls-socket-destroy.js +++ b/test/parallel/test-tls-socket-destroy.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-socket-failed-handshake-emits-error.js b/test/parallel/test-tls-socket-failed-handshake-emits-error.js index 106a14a7df8..16175b88981 100644 --- a/test/parallel/test-tls-socket-failed-handshake-emits-error.js +++ b/test/parallel/test-tls-socket-failed-handshake-emits-error.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); const assert = require('assert'); diff --git a/test/parallel/test-tls-startcom-wosign-whitelist.js b/test/parallel/test-tls-startcom-wosign-whitelist.js index 601c0e4393c..92d595e80cf 100644 --- a/test/parallel/test-tls-startcom-wosign-whitelist.js +++ b/test/parallel/test-tls-startcom-wosign-whitelist.js @@ -1,10 +1,7 @@ 'use strict'; const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-starttls-server.js b/test/parallel/test-tls-starttls-server.js index d588fee34d5..28d1db88598 100644 --- a/test/parallel/test-tls-starttls-server.js +++ b/test/parallel/test-tls-starttls-server.js @@ -5,10 +5,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-ticket-cluster.js b/test/parallel/test-tls-ticket-cluster.js index 8654dd9ceb3..486aef83587 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const cluster = require('cluster'); const fs = require('fs'); const join = require('path').join; diff --git a/test/parallel/test-tls-ticket.js b/test/parallel/test-tls-ticket.js index b2541e06ab8..bf1ce0d5eb4 100644 --- a/test/parallel/test-tls-ticket.js +++ b/test/parallel/test-tls-ticket.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const net = require('net'); const crypto = require('crypto'); diff --git a/test/parallel/test-tls-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js index bf6dcc385bc..8513b29f2e9 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js index b43bb169f34..a3d9a816470 100644 --- a/test/parallel/test-tls-timeout-server.js +++ b/test/parallel/test-tls-timeout-server.js @@ -22,12 +22,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const tls = require('tls'); const net = require('net'); const fs = require('fs'); diff --git a/test/parallel/test-tls-two-cas-one-string.js b/test/parallel/test-tls-two-cas-one-string.js index 3f948b86a58..897635d7b18 100644 --- a/test/parallel/test-tls-two-cas-one-string.js +++ b/test/parallel/test-tls-two-cas-one-string.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const fs = require('fs'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-econnreset-localaddress.js b/test/parallel/test-tls-wrap-econnreset-localaddress.js index 5052d4377a4..9df145ac374 100644 --- a/test/parallel/test-tls-wrap-econnreset-localaddress.js +++ b/test/parallel/test-tls-wrap-econnreset-localaddress.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const net = require('net'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-econnreset-pipe.js b/test/parallel/test-tls-wrap-econnreset-pipe.js index f31e058e6aa..ef6efaedc34 100644 --- a/test/parallel/test-tls-wrap-econnreset-pipe.js +++ b/test/parallel/test-tls-wrap-econnreset-pipe.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); const net = require('net'); diff --git a/test/parallel/test-tls-wrap-econnreset-socket.js b/test/parallel/test-tls-wrap-econnreset-socket.js index 479d7524aa3..672da9876fd 100644 --- a/test/parallel/test-tls-wrap-econnreset-socket.js +++ b/test/parallel/test-tls-wrap-econnreset-socket.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const net = require('net'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-econnreset.js b/test/parallel/test-tls-wrap-econnreset.js index ed0fe9b1a31..5c6db86b75e 100644 --- a/test/parallel/test-tls-wrap-econnreset.js +++ b/test/parallel/test-tls-wrap-econnreset.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const net = require('net'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-event-emmiter.js b/test/parallel/test-tls-wrap-event-emmiter.js index 417b21804a4..82953f1333e 100644 --- a/test/parallel/test-tls-wrap-event-emmiter.js +++ b/test/parallel/test-tls-wrap-event-emmiter.js @@ -6,10 +6,9 @@ */ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const TlsSocket = require('tls').TLSSocket; diff --git a/test/parallel/test-tls-wrap-no-abort.js b/test/parallel/test-tls-wrap-no-abort.js index c18b17a6406..21a472ee3bc 100644 --- a/test/parallel/test-tls-wrap-no-abort.js +++ b/test/parallel/test-tls-wrap-no-abort.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const util = require('util'); const TLSWrap = process.binding('tls_wrap').TLSWrap; diff --git a/test/parallel/test-tls-wrap-timeout.js b/test/parallel/test-tls-wrap-timeout.js index 64fbcc7fc7f..b4cff368182 100644 --- a/test/parallel/test-tls-wrap-timeout.js +++ b/test/parallel/test-tls-wrap-timeout.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-writewrap-leak.js b/test/parallel/test-tls-writewrap-leak.js index 0d61f279312..7035764cba5 100644 --- a/test/parallel/test-tls-writewrap-leak.js +++ b/test/parallel/test-tls-writewrap-leak.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const net = require('net'); diff --git a/test/parallel/test-tls-zero-clear-in.js b/test/parallel/test-tls-zero-clear-in.js index 10d0efaf0b4..84c03d292c1 100644 --- a/test/parallel/test-tls-zero-clear-in.js +++ b/test/parallel/test-tls-zero-clear-in.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-url-domain-ascii-unicode.js b/test/parallel/test-url-domain-ascii-unicode.js index 2be8ac7f5fe..49259a7ab0f 100644 --- a/test/parallel/test-url-domain-ascii-unicode.js +++ b/test/parallel/test-url-domain-ascii-unicode.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} + const strictEqual = require('assert').strictEqual; const url = require('url'); diff --git a/test/parallel/test-url-format-whatwg.js b/test/parallel/test-url-format-whatwg.js index f7363fdbb99..d484760c808 100644 --- a/test/parallel/test-url-format-whatwg.js +++ b/test/parallel/test-url-format-whatwg.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} + const assert = require('assert'); const url = require('url'); const URL = url.URL; diff --git a/test/parallel/test-util-sigint-watchdog.js b/test/parallel/test-util-sigint-watchdog.js index 207f44b011c..6debd18d050 100644 --- a/test/parallel/test-util-sigint-watchdog.js +++ b/test/parallel/test-util-sigint-watchdog.js @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const binding = process.binding('util'); - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const binding = process.binding('util'); + [(next) => { // Test with no signal observed. binding.startSigintWatchdog(); diff --git a/test/parallel/test-vm-sigint-existing-handler.js b/test/parallel/test-vm-sigint-existing-handler.js index cbd91bef06c..eb67820ff20 100644 --- a/test/parallel/test-vm-sigint-existing-handler.js +++ b/test/parallel/test-vm-sigint-existing-handler.js @@ -1,8 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) { + // No way to send CTRL_C_EVENT to processes from JS right now. + common.skip('platform not supported'); +} + const assert = require('assert'); const vm = require('vm'); - const spawn = require('child_process').spawn; const methods = [ @@ -10,12 +14,6 @@ const methods = [ 'runInContext' ]; -if (common.isWindows) { - // No way to send CTRL_C_EVENT to processes from JS right now. - common.skip('platform not supported'); - return; -} - if (process.argv[2] === 'child') { const method = process.argv[3]; assert.ok(method); diff --git a/test/parallel/test-vm-sigint.js b/test/parallel/test-vm-sigint.js index b1ad6164054..ae205edb3d0 100644 --- a/test/parallel/test-vm-sigint.js +++ b/test/parallel/test-vm-sigint.js @@ -1,17 +1,14 @@ 'use strict'; const common = require('../common'); - -const assert = require('assert'); -const vm = require('vm'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const vm = require('vm'); +const spawn = require('child_process').spawn; + if (process.argv[2] === 'child') { const method = process.argv[3]; const listeners = +process.argv[4]; diff --git a/test/parallel/test-warn-sigprof.js b/test/parallel/test-warn-sigprof.js index eedbe33d84f..3404490c2a1 100644 --- a/test/parallel/test-warn-sigprof.js +++ b/test/parallel/test-warn-sigprof.js @@ -6,10 +6,8 @@ const common = require('../common'); common.skipIfInspectorDisabled(); -if (common.isWindows) { +if (common.isWindows) common.skip('test does not apply to Windows'); - return; -} common.expectWarning('Warning', 'process.on(SIGPROF) is reserved while debugging'); diff --git a/test/parallel/test-whatwg-url-constructor.js b/test/parallel/test-whatwg-url-constructor.js index b67f63baf13..290f9266b54 100644 --- a/test/parallel/test-whatwg-url-constructor.js +++ b/test/parallel/test-whatwg-url-constructor.js @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const { URL, URLSearchParams } = require('url'); -const { test, assert_equals, assert_true, assert_throws } = - require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const path = require('path'); +const { URL, URLSearchParams } = require('url'); +const { test, assert_equals, assert_true, assert_throws } = + require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-tests')) }; diff --git a/test/parallel/test-whatwg-url-domainto.js b/test/parallel/test-whatwg-url-domainto.js index b399f24136e..bfd5e94d2e5 100644 --- a/test/parallel/test-whatwg-url-domainto.js +++ b/test/parallel/test-whatwg-url-domainto.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const assert = require('assert'); const { domainToASCII, domainToUnicode } = require('url'); diff --git a/test/parallel/test-whatwg-url-historical.js b/test/parallel/test-whatwg-url-historical.js index 0f7c0e70cd6..7848b1c1873 100644 --- a/test/parallel/test-whatwg-url-historical.js +++ b/test/parallel/test-whatwg-url-historical.js @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); -const URL = require('url').URL; -const { test, assert_equals, assert_throws } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const URL = require('url').URL; +const { test, assert_equals, assert_throws } = require('../common/wpt'); + /* eslint-disable */ /* WPT Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/historical.html diff --git a/test/parallel/test-whatwg-url-inspect.js b/test/parallel/test-whatwg-url-inspect.js index 8db1a20e5be..5758b39b8af 100644 --- a/test/parallel/test-whatwg-url-inspect.js +++ b/test/parallel/test-whatwg-url-inspect.js @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const util = require('util'); -const URL = require('url').URL; -const assert = require('assert'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const util = require('util'); +const URL = require('url').URL; +const assert = require('assert'); + // Tests below are not from WPT. const url = new URL('https://username:password@host.name:8080/path/name/?que=ry#hash'); diff --git a/test/parallel/test-whatwg-url-origin.js b/test/parallel/test-whatwg-url-origin.js index b5b54f887f0..732100e142a 100644 --- a/test/parallel/test-whatwg-url-origin.js +++ b/test/parallel/test-whatwg-url-origin.js @@ -1,15 +1,14 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const URL = require('url').URL; -const { test, assert_equals } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const path = require('path'); +const URL = require('url').URL; +const { test, assert_equals } = require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-tests')) }; diff --git a/test/parallel/test-whatwg-url-parsing.js b/test/parallel/test-whatwg-url-parsing.js index 6c95a5e9139..39756449c08 100644 --- a/test/parallel/test-whatwg-url-parsing.js +++ b/test/parallel/test-whatwg-url-parsing.js @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const URL = require('url').URL; -const path = require('path'); -const assert = require('assert'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const URL = require('url').URL; +const path = require('path'); +const assert = require('assert'); + // Tests below are not from WPT. const tests = require(path.join(common.fixturesDir, 'url-tests')); const failureTests = tests.filter((test) => test.failure).concat([ diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index 60a482decc3..938c2aa2538 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -1,6 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasIntl) { + // A handful of the tests fail when ICU is not included. + common.skip('missing Intl'); +} + const assert = require('assert'); const path = require('path'); const URL = require('url').URL; @@ -8,12 +13,6 @@ const { test, assert_equals } = require('../common/wpt'); const additionalTestCases = require( path.join(common.fixturesDir, 'url-setter-tests-additional.js')); -if (!common.hasIntl) { - // A handful of the tests fail when ICU is not included. - common.skip('missing Intl'); - return; -} - const request = { response: require(path.join(common.fixturesDir, 'url-setter-tests')) }; diff --git a/test/parallel/test-whatwg-url-toascii.js b/test/parallel/test-whatwg-url-toascii.js index bd986c96a47..851240ce650 100644 --- a/test/parallel/test-whatwg-url-toascii.js +++ b/test/parallel/test-whatwg-url-toascii.js @@ -1,15 +1,14 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const { URL } = require('url'); -const { test, assert_equals, assert_throws } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const path = require('path'); +const { URL } = require('url'); +const { test, assert_equals, assert_throws } = require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-toascii')) }; diff --git a/test/parallel/test-windows-abort-exitcode.js b/test/parallel/test-windows-abort-exitcode.js index c5c5fa6f3a5..d61a91315bb 100644 --- a/test/parallel/test-windows-abort-exitcode.js +++ b/test/parallel/test-windows-abort-exitcode.js @@ -1,17 +1,16 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('test is windows specific'); + const assert = require('assert'); +const spawn = require('child_process').spawn; // This test makes sure that an aborted node process // exits with code 3 on Windows. // Spawn a child, force an abort, and then check the // exit code in the parent. -const spawn = require('child_process').spawn; -if (!common.isWindows) { - common.skip('test is windows specific'); - return; -} if (process.argv[2] === 'child') { process.abort(); } else { diff --git a/test/parallel/test-zlib-random-byte-pipes.js b/test/parallel/test-zlib-random-byte-pipes.js index 4ccfd2dc228..f15b31c2f42 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -21,19 +21,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const crypto = require('crypto'); +const assert = require('assert'); +const crypto = require('crypto'); const stream = require('stream'); -const Stream = stream.Stream; const util = require('util'); const zlib = require('zlib'); +const Stream = stream.Stream; // emit random bytes, and keep a shasum function RandomReadStream(opt) { diff --git a/test/pummel/test-abort-fatal-error.js b/test/pummel/test-abort-fatal-error.js index 6208a13261b..176a16c9eac 100644 --- a/test/pummel/test-abort-fatal-error.js +++ b/test/pummel/test-abort-fatal-error.js @@ -21,13 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (common.isWindows) { +if (common.isWindows) common.skip('no RLIMIT_NOFILE on Windows'); - return; -} +const assert = require('assert'); const exec = require('child_process').exec; let cmdline = `ulimit -c 0; ${process.execPath}`; diff --git a/test/pummel/test-crypto-dh.js b/test/pummel/test-crypto-dh.js index 2268994b4d2..f64f982c0e1 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('node compiled without OpenSSL.'); + const assert = require('assert'); const crypto = require('crypto'); -if (!common.hasCrypto) { - common.skip('node compiled without OpenSSL.'); - return; -} - assert.throws( function() { crypto.getDiffieHellman('unknown-group'); diff --git a/test/pummel/test-crypto-timing-safe-equal-benchmarks.js b/test/pummel/test-crypto-timing-safe-equal-benchmarks.js index 5560a4a256b..4aad5ed20cb 100644 --- a/test/pummel/test-crypto-timing-safe-equal-benchmarks.js +++ b/test/pummel/test-crypto-timing-safe-equal-benchmarks.js @@ -1,17 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip('memory-intensive test'); - return; -} +const assert = require('assert'); const crypto = require('crypto'); const BENCHMARK_FUNC_PATH = diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js index 092d91428eb..b8e0ca3f1f8 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); const p = crypto.createDiffieHellman(1024).getPrime(); diff --git a/test/pummel/test-dtrace-jsstack.js b/test/pummel/test-dtrace-jsstack.js index d69e96b2511..41d10bf1d84 100644 --- a/test/pummel/test-dtrace-jsstack.js +++ b/test/pummel/test-dtrace-jsstack.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.isSunOS) + common.skip('no DTRACE support'); + const assert = require('assert'); const os = require('os'); -if (!common.isSunOS) { - common.skip('no DTRACE support'); - return; -} - /* * Some functions to create a recognizable stack. */ diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js index 6cc8c51fe21..fbe0e37873c 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -21,23 +21,18 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); + const assert = require('assert'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const tls = require('tls'); const https = require('https'); - const fs = require('fs'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - // renegotiation limits to test const LIMITS = [0, 1, 2, 3, 5, 10, 16]; diff --git a/test/pummel/test-https-large-response.js b/test/pummel/test-https-large-response.js index 17038bf7bde..7775ccca63e 100644 --- a/test/pummel/test-https-large-response.js +++ b/test/pummel/test-https-large-response.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff --git a/test/pummel/test-https-no-reader.js b/test/pummel/test-https-no-reader.js index cc77993a731..b8071b9ba97 100644 --- a/test/pummel/test-https-no-reader.js +++ b/test/pummel/test-https-no-reader.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index 26e19786913..d2387495c1c 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -23,16 +23,14 @@ // This test requires the program 'wrk' const common = require('../common'); +if (common.isWindows) + common.skip('no `wrk` on windows'); + const assert = require('assert'); const spawn = require('child_process').spawn; const http = require('http'); const url = require('url'); -if (common.isWindows) { - common.skip('no `wrk` on windows'); - return; -} - const body = 'hello world\n'; const server = http.createServer(function(req, res) { res.writeHead(200, { diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js index 1a7e3ad1cb0..b1d46adbabb 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -27,15 +27,12 @@ // TLS server causes the child process to exit cleanly before having sent // the entire buffer. const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); - const fs = require('fs'); const bytesExpected = 1024 * 1024 * 32; diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js index 4bbaacebf4b..905d922db3a 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -21,22 +21,17 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); + const assert = require('assert'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const tls = require('tls'); - const fs = require('fs'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - // renegotiation limits to test const LIMITS = [0, 1, 2, 3, 5, 10, 16]; diff --git a/test/pummel/test-tls-connect-memleak.js b/test/pummel/test-tls-connect-memleak.js index d4797e19402..c086933a3e0 100644 --- a/test/pummel/test-tls-connect-memleak.js +++ b/test/pummel/test-tls-connect-memleak.js @@ -23,14 +23,11 @@ // Flags: --expose-gc const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); assert.strictEqual( diff --git a/test/pummel/test-tls-securepair-client.js b/test/pummel/test-tls-securepair-client.js index f147d019c93..e9bae682d72 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -20,19 +20,14 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const join = require('path').join; const net = require('net'); diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js index 021fb7913b5..3255633ec7c 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const stream = require('stream'); const util = require('util'); diff --git a/test/pummel/test-tls-session-timeout.js b/test/pummel/test-tls-session-timeout.js index 1bb35920422..9b175da77e6 100644 --- a/test/pummel/test-tls-session-timeout.js +++ b/test/pummel/test-tls-session-timeout.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} doTest(); diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js index a9e2442ef2b..2d0ea1c673a 100644 --- a/test/pummel/test-tls-throttle.js +++ b/test/pummel/test-tls-throttle.js @@ -24,12 +24,10 @@ // seconds. Makes sure that pause and resume work properly. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/sequential/test-benchmark-http.js b/test/sequential/test-benchmark-http.js index ce3d58e5d8d..34fbc3732b2 100644 --- a/test/sequential/test-benchmark-http.js +++ b/test/sequential/test-benchmark-http.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip('Insufficient memory for HTTP benchmark test'); - return; -} // Minimal test for http benchmarks. This makes sure the benchmarks aren't // horribly broken but nothing more than that. diff --git a/test/sequential/test-buffer-creation-regression.js b/test/sequential/test-buffer-creation-regression.js index 8137e4830a9..8c3a09848c9 100644 --- a/test/sequential/test-buffer-creation-regression.js +++ b/test/sequential/test-buffer-creation-regression.js @@ -29,7 +29,8 @@ try { arrayBuffer = new ArrayBuffer(size); } catch (e) { if (e instanceof RangeError && acceptableOOMErrors.includes(e.message)) - return common.skip(`Unable to allocate ${size} bytes for ArrayBuffer`); + common.skip(`Unable to allocate ${size} bytes for ArrayBuffer`); + throw e; } diff --git a/test/sequential/test-child-process-emfile.js b/test/sequential/test-child-process-emfile.js index 59756e4c7b2..e81b3a0ffec 100644 --- a/test/sequential/test-child-process-emfile.js +++ b/test/sequential/test-child-process-emfile.js @@ -21,15 +21,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('no RLIMIT_NOFILE on Windows'); + const assert = require('assert'); const child_process = require('child_process'); const fs = require('fs'); -if (common.isWindows) { - common.skip('no RLIMIT_NOFILE on Windows'); - return; -} - const ulimit = Number(child_process.execSync('ulimit -Hn')); if (ulimit > 64 || Number.isNaN(ulimit)) { // Sorry about this nonsense. It can be replaced if diff --git a/test/sequential/test-child-process-pass-fd.js b/test/sequential/test-child-process-pass-fd.js index b2481270faf..8cc11f6c11f 100644 --- a/test/sequential/test-child-process-pass-fd.js +++ b/test/sequential/test-child-process-pass-fd.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) + common.skip('Too slow for armv6 and armv7 bots'); + const assert = require('assert'); const fork = require('child_process').fork; const net = require('net'); -if ((process.config.variables.arm_version === '6') || - (process.config.variables.arm_version === '7')) { - common.skip('Too slow for armv6 and armv7 bots'); - return; -} - const N = 80; if (process.argv[2] !== 'child') { diff --git a/test/sequential/test-crypto-timing-safe-equal.js b/test/sequential/test-crypto-timing-safe-equal.js index 7a1f8d29936..2847af9ef8b 100644 --- a/test/sequential/test-crypto-timing-safe-equal.js +++ b/test/sequential/test-crypto-timing-safe-equal.js @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const crypto = require('crypto'); assert.strictEqual( diff --git a/test/sequential/test-fs-readfile-tostring-fail.js b/test/sequential/test-fs-readfile-tostring-fail.js index ee962652fc1..2eb6ce0732d 100644 --- a/test/sequential/test-fs-readfile-tostring-fail.js +++ b/test/sequential/test-fs-readfile-tostring-fail.js @@ -2,11 +2,8 @@ const common = require('../common'); -if (!common.enoughTestMem) { - const skipMessage = 'intensive toString tests due to memory confinements'; - common.skip(skipMessage); - return; -} +if (!common.enoughTestMem) + common.skip('intensive toString tests due to memory confinements'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/sequential/test-https-set-timeout-server.js b/test/sequential/test-https-set-timeout-server.js index aa4eb5714ff..e1b9430583f 100644 --- a/test/sequential/test-https-set-timeout-server.js +++ b/test/sequential/test-https-set-timeout-server.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/sequential/test-net-server-address.js b/test/sequential/test-net-server-address.js index a6e09a86532..52a8c1ac820 100644 --- a/test/sequential/test-net-server-address.js +++ b/test/sequential/test-net-server-address.js @@ -40,7 +40,7 @@ server_ipv4 })); if (!common.hasIPv6) { - common.skip('ipv6 part of test, no IPv6 support'); + common.printSkipMessage('ipv6 part of test, no IPv6 support'); return; } diff --git a/test/tick-processor/test-tick-processor-builtin.js b/test/tick-processor/test-tick-processor-builtin.js index afe08bdb0b6..0fb839f8d13 100644 --- a/test/tick-processor/test-tick-processor-builtin.js +++ b/test/tick-processor/test-tick-processor-builtin.js @@ -1,19 +1,15 @@ 'use strict'; const common = require('../common'); +if (!common.enoughTestCpu) + common.skip('test is CPU-intensive'); + if (common.isWindows || common.isSunOS || common.isAix || common.isLinuxPPCBE || - common.isFreeBSD) { + common.isFreeBSD) common.skip('C++ symbols are not mapped for this os.'); - return; -} - -if (!common.enoughTestCpu) { - common.skip('test is CPU-intensive'); - return; -} const base = require('./tick-processor-base.js'); diff --git a/test/tick-processor/test-tick-processor-cpp-core.js b/test/tick-processor/test-tick-processor-cpp-core.js index 72eb25e91c3..dc1aed41a79 100644 --- a/test/tick-processor/test-tick-processor-cpp-core.js +++ b/test/tick-processor/test-tick-processor-cpp-core.js @@ -1,19 +1,15 @@ 'use strict'; const common = require('../common'); +if (!common.enoughTestCpu) + common.skip('test is CPU-intensive'); + if (common.isWindows || common.isSunOS || common.isAix || common.isLinuxPPCBE || - common.isFreeBSD) { + common.isFreeBSD) common.skip('C++ symbols are not mapped for this os.'); - return; -} - -if (!common.enoughTestCpu) { - common.skip('test is CPU-intensive'); - return; -} const base = require('./tick-processor-base.js'); diff --git a/test/tick-processor/test-tick-processor-unknown.js b/test/tick-processor/test-tick-processor-unknown.js index ab3d110ccff..c0f5f332b26 100644 --- a/test/tick-processor/test-tick-processor-unknown.js +++ b/test/tick-processor/test-tick-processor-unknown.js @@ -6,15 +6,11 @@ const common = require('../common'); // the full 64 bits and the result is that it does not process the // addresses correctly and runs out of memory // Disabling until we get a fix upstreamed into V8 -if (common.isAix) { +if (common.isAix) common.skip('AIX address range too big for scripts.'); - return; -} -if (!common.enoughTestCpu) { +if (!common.enoughTestCpu) common.skip('test is CPU-intensive'); - return; -} const base = require('./tick-processor-base.js'); From 4dd7d09723aa29ae164cf37031ed08dc6b532c0e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 1 Jul 2017 08:14:28 -0700 Subject: [PATCH 08/13] test: skip test-fs-readdir-ucs2 if no support If the filesystem does not support UCS2, do not run the test. PR-URL: https://github.com/nodejs/node/pull/14029 Fixes: https://github.com/nodejs/node/issues/14028 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Refael Ackermann Reviewed-By: Richard Lau --- test/parallel/parallel.status | 1 - test/parallel/test-fs-readdir-ucs2.js | 16 +++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 5a0e7735b62..fda5e01e500 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -13,7 +13,6 @@ prefix parallel [$system==macos] [$arch==arm || $arch==arm64] -test-fs-readdir-ucs2 : PASS,FLAKY test-npm-install: PASS,FLAKY [$system==solaris] # Also applies to SmartOS diff --git a/test/parallel/test-fs-readdir-ucs2.js b/test/parallel/test-fs-readdir-ucs2.js index e8e69d6ee2f..debcfb7750b 100644 --- a/test/parallel/test-fs-readdir-ucs2.js +++ b/test/parallel/test-fs-readdir-ucs2.js @@ -14,16 +14,18 @@ const root = Buffer.from(`${common.tmpDir}${path.sep}`); const filebuff = Buffer.from(filename, 'ucs2'); const fullpath = Buffer.concat([root, filebuff]); -fs.closeSync(fs.openSync(fullpath, 'w+')); +try { + fs.closeSync(fs.openSync(fullpath, 'w+')); +} catch (e) { + if (e.code === 'EINVAL') + common.skip('test requires filesystem that supports UCS2'); + throw e; +} -fs.readdir(common.tmpDir, 'ucs2', (err, list) => { +fs.readdir(common.tmpDir, 'ucs2', common.mustCall((err, list) => { assert.ifError(err); assert.strictEqual(1, list.length); const fn = list[0]; assert.deepStrictEqual(filebuff, Buffer.from(fn, 'ucs2')); assert.strictEqual(fn, filename); -}); - -process.on('exit', () => { - fs.unlinkSync(fullpath); -}); +})); From a577bde917c5cbc20c15972b9fe50a8c0adf5e94 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 3 Jul 2017 13:21:33 -0700 Subject: [PATCH 09/13] lib: fix off-by-one indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation for more robust indentation linting, fix an off-by-one indentation in lib/http_server.js. PR-URL: https://github.com/nodejs/node/pull/14064 Reviewed-By: Tobias Nießen Reviewed-By: Anna Henningsen Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca --- lib/_http_server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_http_server.js b/lib/_http_server.js index 34e7b6d29c2..25567381fe4 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -187,7 +187,7 @@ function writeHead(statusCode, reason, obj) { statusCode |= 0; if (statusCode < 100 || statusCode > 999) { throw new errors.RangeError('ERR_HTTP_INVALID_STATUS_CODE', - originalStatusCode); + originalStatusCode); } From 5b1d12a092c2c38ecb3da0d9b59c702c625e7ae3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 3 Jul 2017 14:00:41 -0700 Subject: [PATCH 10/13] test: restore no-op function in test Remove common.mustCall() in test that might connect to a server already running on the local host. PR-URL: https://github.com/nodejs/node/pull/14065 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Reviewed-By: Yuta Hiroto Reviewed-By: Luigi Pinca --- test/parallel/test-http-hostname-typechecking.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-http-hostname-typechecking.js b/test/parallel/test-http-hostname-typechecking.js index d1a407cf28d..74813e0582d 100644 --- a/test/parallel/test-http-hostname-typechecking.js +++ b/test/parallel/test-http-hostname-typechecking.js @@ -1,5 +1,5 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const http = require('http'); @@ -21,7 +21,7 @@ vals.forEach((v) => { // These values are OK and should not throw synchronously ['', undefined, null].forEach((v) => { assert.doesNotThrow(() => { - http.request({hostname: v}).on('error', common.mustCall()).end(); - http.request({host: v}).on('error', common.mustCall()).end(); + http.request({hostname: v}).on('error', () => {}).end(); + http.request({host: v}).on('error', () => {}).end(); }); }); From f2149d4ea44c56cb9d7458b7b3c83b838f96c72f Mon Sep 17 00:00:00 2001 From: Natanael Log Date: Sat, 1 Jul 2017 15:10:36 +0200 Subject: [PATCH 11/13] doc, util, console: clarify ambiguous docs Add clarification to the documentation on util.format() and console.log() regarding how excessive arguments are treated when the first argument is a non-format string compared to when it is not a string at all. PR-URL: https://github.com/nodejs/node/pull/14027 Fixes: https://github.com/nodejs/node/issues/13908 Reviewed-By: Vse Mozhet Byt Reviewed-By: Luigi Pinca Reviewed-By: Franziska Hinkelmann Reviewed-By: Colin Ihrig --- doc/api/console.md | 4 +--- doc/api/util.md | 11 ++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/doc/api/console.md b/doc/api/console.md index 3411d3ce0af..4939ed77bef 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -246,9 +246,7 @@ console.log('count:', count); // Prints: count: 5, to stdout ``` -If formatting elements (e.g. `%d`) are not found in the first string then -[`util.inspect()`][] is called on each argument and the resulting string -values are concatenated. See [`util.format()`][] for more information. +See [`util.format()`][] for more information. ### console.time(label)