From 44d3047981dd71e1a9d43f976a7a55e5eceab768 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 1 Jul 2017 02:29:09 +0300 Subject: [PATCH] test: simplify test skipping * Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip Backport-PR-URL: https://github.com/nodejs/node/pull/14838 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-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/common/README.md | 7 ++++++- test/common/index.js | 7 ++++++- test/doctool/test-doctool-html.js | 9 ++++----- test/doctool/test-doctool-json.js | 9 ++++----- test/fixtures/tls-connect.js | 5 ++--- .../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/parallel/test-buffer-alloc.js | 2 +- test/parallel/test-buffer.js | 2 +- .../parallel/test-child-process-fork-dgram.js | 8 +++----- .../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-cluster-disconnect-handles.js | 9 ++++----- 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 | 7 +++---- test/parallel/test-crypto-random.js | 5 ++--- test/parallel/test-crypto-rsa-dsa.js | 11 +++++------ test/parallel/test-crypto-sign-verify.js | 8 +++----- 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/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 | 11 ++++------- test/parallel/test-domain-crypto.js | 9 +++------ test/parallel/test-dsa-fips-invalid-key.js | 7 ++----- test/parallel/test-fs-long-path.js | 8 +++----- .../test-fs-read-buffer-tostring-fail.js | 1 - .../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.js | 16 ++++++++-------- test/parallel/test-fs-symlink.js | 2 +- 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 | 2 +- test/parallel/test-http-dns-error.js | 4 ++-- test/parallel/test-http-full-response.js | 2 +- .../test-http-host-header-ipv6-fail.js | 9 ++++----- test/parallel/test-http-localaddress.js | 8 +++----- .../test-http-url.parse-https.request.js | 9 +++------ .../test-https-agent-create-connection.js | 4 +--- .../test-https-agent-disable-session-reuse.js | 12 ++++-------- 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/parallel/test-https-byteswritten.js | 8 +++----- .../test-https-client-checkServerIdentity.js | 9 +++------ test/parallel/test-https-client-get-url.js | 9 +++------ 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 | 7 +++---- 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-set-timeout-server.js | 4 +--- 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-punycode.js | 4 +--- 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/parallel/test-module-loading-error.js | 4 +--- .../test-module-symlinked-peer-modules.js | 1 - .../parallel/test-net-connect-options-ipv6.js | 10 ++++------ .../parallel/test-net-socket-local-address.js | 10 ++++------ 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 | 5 ++--- 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 | 8 +++----- 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/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-onselect.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-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-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-tls-socket-default-options.js | 4 +--- 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-wrap-timeout.js | 5 ++--- test/parallel/test-tls-writewrap-leak.js | 4 +--- test/parallel/test-tls-zero-clear-in.js | 5 ++--- test/parallel/test-util-sigint-watchdog.js | 7 +++---- .../test-vm-sigint-existing-handler.js | 12 +++++------- test/parallel/test-vm-sigint.js | 13 ++++++------- 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-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/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 ++------ 278 files changed, 775 insertions(+), 1408 deletions(-) diff --git a/test/abort/test-abort-backtrace.js b/test/abort/test-abort-backtrace.js index 7f72ee8e71c6a5..dd108171684018 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 73d85a75a097a2..accb90d2638274 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/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js index 5dd727f8ffddd3..4c074773a21fc2 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 2466c8ec42ed57..43b8c63f1e466e 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 16f0f5392e5206..a94a57e18037fd 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 1028706b1d1aa9..996c01752da7c6 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 caf6112011e2a8..17d9ae5d68f033 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 4d3199a033e6d5..d3368ca7b2ea6b 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 786d0b679895e1..db007a53a44f3b 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 36b0d4174a030b..319a8a93558c45 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 d2025c54e4360b..d9455c027bd36b 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/common/README.md b/test/common/README.md index 01d19116bdac29..61802f9c70eaf9 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -251,6 +251,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) @@ -264,7 +269,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 ec889b4aff2dc5..a256a6afb17b64 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -493,10 +493,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) { diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 35fa921a3e9971..f726c06867c3dd 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 ae7b2007b7d2ef..67010c3fe48410 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 72f83736bf370e..28608ca5ce6aea 100644 --- a/test/fixtures/tls-connect.js +++ b/test/fixtures/tls-connect.js @@ -12,10 +12,9 @@ const util = require('util'); module.exports = exports = checkCrypto; function checkCrypto() { - if (!common.hasCrypto) { + if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(0); - } + return exports; } diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 392ded3a710c29..2c6a43de6860ec 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -1,5 +1,8 @@ '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'); @@ -14,11 +17,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 13141a9d44fb04..ee383f995e6715 100644 --- a/test/internet/test-dgram-multicast-multi-process.js +++ b/test/internet/test-dgram-multicast-multi-process.js @@ -1,5 +1,9 @@ '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; @@ -15,12 +19,6 @@ const workers = {}; const listeners = 3; let dead, listening, sendSocket, done, timer; -// 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 f6e8aacdbcf02f..c790b743f25aab 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 c7e6b3baf7ccdc..77fad9286f89e8 100644 --- a/test/internet/test-http-https-default-ports.js +++ b/test/internet/test-http-https-default-ports.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 http = require('http'); diff --git a/test/internet/test-tls-add-ca-cert.js b/test/internet/test-tls-add-ca-cert.js index f57f1617ef83d9..a3b6c72d10dd80 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 f57b897099fc2d..ab5aa3950938b3 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 22af92e2769715..62010b88ff4ed3 100644 --- a/test/internet/test-tls-reuse-host-from-socket.js +++ b/test/internet/test-tls-reuse-host-from-socket.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-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 57271ed0f60a95..6db742e9561ca8 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -971,7 +971,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-buffer.js b/test/parallel/test-buffer.js index c2d1be0dd49042..6b1848c48bb9cb 100644 --- a/test/parallel/test-buffer.js +++ b/test/parallel/test-buffer.js @@ -1404,7 +1404,7 @@ if (common.hasCrypto) { crypto.createHash('sha1').update(b2).digest('hex') ); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } // Test Compare diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index 4516f3cc7b8f81..8ddce9b8e1ff2f 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -7,15 +7,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-cluster-bind-privileged-port.js b/test/parallel/test-cluster-bind-privileged-port.js index af461bee4f9ee2..64f72925caf0cc 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -1,18 +1,14 @@ '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 7acd3a77fe2415..e494c890988aa4 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -1,5 +1,8 @@ '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; @@ -7,12 +10,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 a4ee9fb12b20de..0f16c0f35db986 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -1,5 +1,8 @@ '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; @@ -7,12 +10,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 1472dcc5238a63..51a4944e554856 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-handles.js b/test/parallel/test-cluster-disconnect-handles.js index 680e316cf0ba92..1486e5229827a7 100644 --- a/test/parallel/test-cluster-disconnect-handles.js +++ b/test/parallel/test-cluster-disconnect-handles.js @@ -3,17 +3,16 @@ 'use strict'; const common = require('../common'); + +if (common.isWindows) + common.skip('SCHED_RR not reliable on Windows'); + const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); const Protocol = require('_debugger').Protocol; -if (common.isWindows) { - common.skip('SCHED_RR not reliable on Windows'); - return; -} - cluster.schedulingPolicy = cluster.SCHED_RR; // Worker sends back a "I'm here" message, then immediately suspends diff --git a/test/parallel/test-cluster-disconnect-race.js b/test/parallel/test-cluster-disconnect-race.js index 7bb66ced3663ef..60d8697b671b84 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 85a87f3fa449eb..f3ecfa59bca65b 100644 --- a/test/parallel/test-cluster-disconnect-unshared-udp.js +++ b/test/parallel/test-cluster-disconnect-unshared-udp.js @@ -2,10 +2,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 bfea393b375666..57afb3b5421120 100644 --- a/test/parallel/test-cluster-http-pipe.js +++ b/test/parallel/test-cluster-http-pipe.js @@ -1,16 +1,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 b6800b12110d0b..f23280f455c7fc 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -1,18 +1,14 @@ '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 b92d6d681d55c8..6d3b3d8c624c12 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.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'); crypto.DEFAULT_ENCODING = 'buffer'; @@ -320,12 +318,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 987fdbc046d940..4f42c76f0ee7fd 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.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 crypto = require('crypto'); diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index fe47b3ff49455e..a8b8cc66b2504d 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.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'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index e53f02edfa0c86..8b1b0051d34962 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 b6b2978973412b..2ee8e813233e77 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 903862d6c8ed27..84f25316d49b61 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 f6bfcf72c0fd7e..52d633937f7c1b 100644 --- a/test/parallel/test-crypto-dh-odd-key.js +++ b/test/parallel/test-crypto-dh-odd-key.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 test() { diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index ccc30353af6867..547629ed4dc2e8 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 6586f7d48a94ce..eda01b95b562e4 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -1,12 +1,10 @@ '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 d0dcf7f2107f77..a992e6aade9f34 100644 --- a/test/parallel/test-crypto-domains.js +++ b/test/parallel/test-crypto-domains.js @@ -1,16 +1,15 @@ '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 655246d0586cbf..fa9d18ec831d87 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -1,15 +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.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 8452087cc50c93..b2fe154d3c228f 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 eaeda15ba98044..e3f49e61672bb7 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 485735e83ce5cc..bf9d6b924d36a2 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -4,12 +4,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 33aa0f74566be0..f1fab005442c59 100644 --- a/test/parallel/test-crypto-hash-stream-pipe.js +++ b/test/parallel/test-crypto-hash-stream-pipe.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-hash.js b/test/parallel/test-crypto-hash.js index 16cc9c9fc5e41c..1d36753738e95f 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 94c5cefa058d02..a10e8a731be023 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 9008ebc5f910a6..f12243b9f4d17c 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 0e302f22e06fbd..dd74afc54761aa 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.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'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index 7dbccdcf8639f7..c6ca8481642804 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.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'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js index 16d3cbab289c8f..f3afdd768e9898 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -1,11 +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 crypto = require('crypto'); // diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index 29928ad6e18a82..0a9c594654b9ee 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.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'); diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js index 5189da15174aa7..96bf9de3b4dc94 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -1,15 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -const constants = require('crypto').constants; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); +const fs = require('fs'); 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 3fe98647a7776a..a9a2cac78828ab 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -1,12 +1,10 @@ '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 crypto = require('crypto'); // Test certificates diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index f558851b7940a0..fe218504267538 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -1,13 +1,11 @@ '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 c21858b16a1fb1..dd7923dce74885 100644 --- a/test/parallel/test-crypto-verify-failure.js +++ b/test/parallel/test-crypto-verify-failure.js @@ -1,10 +1,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 a923694f3d7b61..f1acae97e1f284 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.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-cwd-enoent-preload.js b/test/parallel/test-cwd-enoent-preload.js index 5d44814d2fe430..8979547c0dea94 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 c82083668aab43..bb41b1fccd8bf6 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 dac23e4084aaf5..27df46acf89ea4 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 9d84486a0b08d2..ac5030fee38580 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 142a5134c013c3..e6d73bdc9d4a2c 100755 --- a/test/parallel/test-dgram-bind-default-address.js +++ b/test/parallel/test-dgram-bind-default-address.js @@ -1,13 +1,11 @@ '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'); @@ -18,7 +16,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-send-empty-array.js b/test/parallel/test-dgram-send-empty-array.js index 1bfcacd9a40497..e6a391de945d07 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 0486b2bdbe3959..e3a5096c1290d8 100644 --- a/test/parallel/test-dgram-send-empty-buffer.js +++ b/test/parallel/test-dgram-send-empty-buffer.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-send-empty-packet.js b/test/parallel/test-dgram-send-empty-packet.js index 131e808aec0b72..b425e9eb1582cb 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 e893f248ecd87b..d801ca7e8dcd08 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 f0b7bfd95354ca..9972e23011ef6f 100644 --- a/test/parallel/test-dh-padding.js +++ b/test/parallel/test-dh-padding.js @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -let crypto; -try { - crypto = require('crypto'); -} catch (e) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} + +const assert = require('assert'); +const crypto = require('crypto'); /* This test verifies padding with leading zeroes for shared * secrets that are strictly smaller than the modulus (prime). diff --git a/test/parallel/test-domain-crypto.js b/test/parallel/test-domain-crypto.js index 7f009b45df5639..f0995a75c05fdd 100644 --- a/test/parallel/test-domain-crypto.js +++ b/test/parallel/test-domain-crypto.js @@ -2,13 +2,10 @@ const common = require('../common'); -let crypto; -try { - crypto = require('crypto'); -} catch (e) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} + +const crypto = require('crypto'); // Pollution of global is intentional as part of test. common.globalCheck = false; diff --git a/test/parallel/test-dsa-fips-invalid-key.js b/test/parallel/test-dsa-fips-invalid-key.js index b22be9d077922b..b88c05a87cbf85 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 7082e740ed47c9..ed485dc4f15759 100644 --- a/test/parallel/test-fs-long-path.js +++ b/test/parallel/test-fs-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 will be at least 260 chars long. const fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1); const fileName = path.join(common.tmpDir, new Array(fileNameLen + 1).join('x')); diff --git a/test/parallel/test-fs-read-buffer-tostring-fail.js b/test/parallel/test-fs-read-buffer-tostring-fail.js index 3ef058e4aa031e..f796e4f6a6975b 100644 --- a/test/parallel/test-fs-read-buffer-tostring-fail.js +++ b/test/parallel/test-fs-read-buffer-tostring-fail.js @@ -5,7 +5,6 @@ const common = require('../common'); if (!common.enoughTestMem) { const skipMessage = 'intensive toString tests due to memory confinements'; common.skip(skipMessage); - return; } const assert = require('assert'); diff --git a/test/parallel/test-fs-read-file-sync-hostname.js b/test/parallel/test-fs-read-file-sync-hostname.js index ca300819e704c6..2751f5384f6d02 100644 --- a/test/parallel/test-fs-read-file-sync-hostname.js +++ b/test/parallel/test-fs-read-file-sync-hostname.js @@ -1,13 +1,11 @@ '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 4f9964333929c1..debcfb7750becd 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 9c1f6527e9b5c6..b3997f7a7d619a 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -1,15 +1,13 @@ '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 1b1523cb132e4c..6f8960f779a69c 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 54fb1fbe104fae..04064de015cc05 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -1,14 +1,12 @@ '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 9108118b87e2e6..8107498cf9cceb 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 a5c542162c3b65..7a871b7e59807c 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.js b/test/parallel/test-fs-realpath.js index 5edbf47dddaf02..f5ac4e9beadae3 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -81,7 +81,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`; @@ -130,7 +130,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(); } @@ -160,7 +160,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'); @@ -188,7 +188,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'); @@ -215,7 +215,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`; @@ -236,7 +236,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(); } @@ -275,7 +275,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(); } @@ -362,7 +362,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 8200254031c0a6..6a4bfd5a9efd0d 100644 --- a/test/parallel/test-fs-symlink.js +++ b/test/parallel/test-fs-symlink.js @@ -13,7 +13,7 @@ if (common.isWindows) { // We'll only try to run symlink test if we have enough privileges. exec('whoami /priv', function(err, o) { if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) { - common.skip('insufficient privileges'); + common.printSkipMessage('insufficient privileges'); } }); } diff --git a/test/parallel/test-fs-watch-encoding.js b/test/parallel/test-fs-watch-encoding.js index 04f5ffaad97a97..b9488f7a7f8421 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 5fb13623dff543..8e27abb2517692 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 a2b5dccf16c6b6..abc8d19ec7e03c 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 981288ecf20dde..55ad7d7dfa1955 100644 --- a/test/parallel/test-http-default-port.js +++ b/test/parallel/test-http-default-port.js @@ -17,7 +17,7 @@ let https; if (common.hasCrypto) { https = require('https'); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } process.on('exit', function() { diff --git a/test/parallel/test-http-dns-error.js b/test/parallel/test-http-dns-error.js index 6dad7322ed45a0..bb736c5b6686e2 100644 --- a/test/parallel/test-http-dns-error.js +++ b/test/parallel/test-http-dns-error.js @@ -8,7 +8,7 @@ let https; if (common.hasCrypto) { https = require('https'); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } const host = '*'.repeat(256); @@ -37,7 +37,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 292368ae16662c..8d4b5ec14523a0 100644 --- a/test/parallel/test-http-full-response.js +++ b/test/parallel/test-http-full-response.js @@ -22,7 +22,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-host-header-ipv6-fail.js b/test/parallel/test-http-host-header-ipv6-fail.js index 94351bc5c167e4..007520f5535a94 100644 --- a/test/parallel/test-http-host-header-ipv6-fail.js +++ b/test/parallel/test-http-host-header-ipv6-fail.js @@ -10,6 +10,10 @@ */ const common = require('../common'); + +if (!common.hasIPv6) + common.skip('Skipping test, no IPv6 support'); + const assert = require('assert'); const http = require('http'); @@ -25,11 +29,6 @@ function httpreq() { req.end(); } -if (!common.hasIPv6) { - console.error('Skipping test, no IPv6 support'); - return; -} - const server = http.createServer(common.mustCall(function(req, res) { assert.ok(req.headers.host, `[${hostname}]`); res.end(); diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index a815e6a3ac9a39..6462f58ca41afd 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -1,13 +1,11 @@ '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 069322288a4cde..ee426fe683493d 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.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 url = require('url'); const fs = require('fs'); diff --git a/test/parallel/test-https-agent-create-connection.js b/test/parallel/test-https-agent-create-connection.js index faaa8ef78f5e46..a7c329bd5373ca 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 0331cd4e283c17..4f92547e999ac2 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-servername.js b/test/parallel/test-https-agent-servername.js index 8562d021c997ad..625fa45c7c1d67 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 acead806ed066e..567ed809e646c3 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 a9977d8ce9a915..f850144eaab169 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 fb7bee16ec004a..a06ce439fa43d9 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 bc86b9c24128b3..2fc477c0b33c7b 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 b32cd15bd2e7e5..24086d1f34568d 100644 --- a/test/parallel/test-https-agent.js +++ b/test/parallel/test-https-agent.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-byteswritten.js b/test/parallel/test-https-byteswritten.js index dcff869078ccae..53a341959c4c0e 100644 --- a/test/parallel/test-https-byteswritten.js +++ b/test/parallel/test-https-byteswritten.js @@ -1,12 +1,10 @@ '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 08add334872bfb..5bfcb774c8f0e2 100644 --- a/test/parallel/test-https-client-checkServerIdentity.js +++ b/test/parallel/test-https-client-checkServerIdentity.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 path = require('path'); diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js index fe7723ac229535..3ca048f5c8c931 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -1,16 +1,13 @@ '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 options = { diff --git a/test/parallel/test-https-client-reject.js b/test/parallel/test-https-client-reject.js index c81c7f646dde01..8369e9ad21beb2 100644 --- a/test/parallel/test-https-client-reject.js +++ b/test/parallel/test-https-client-reject.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 path = require('path'); diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js index f788c61e2e25b4..6ba40dc66bba0f 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -3,14 +3,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 20f03a591cd992..797ca6041e49a9 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 e7f41ce861cb27..76a12ef5d5dc0e 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 caeeca5d542430..e25f8cc28c0faf 100644 --- a/test/parallel/test-https-connecting-to-http.js +++ b/test/parallel/test-https-connecting-to-http.js @@ -2,14 +2,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 410c673dccbdd6..77cf56c0d51bda 100644 --- a/test/parallel/test-https-drain.js +++ b/test/parallel/test-https-drain.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 path = require('path'); diff --git a/test/parallel/test-https-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js index 6ab0cc7162c554..eba3c00fa5eaa2 100644 --- a/test/parallel/test-https-eof-for-eom.js +++ b/test/parallel/test-https-eof-for-eom.js @@ -8,15 +8,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 1772fe5577a232..06ef1e1bd52fb4 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -1,21 +1,15 @@ '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 6ea1c642420ada..c8afa61cd12614 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 406625aa4fbc62..30fe4860e4004f 100644 --- a/test/parallel/test-https-localaddress-bind-error.js +++ b/test/parallel/test-https-localaddress-bind-error.js @@ -1,11 +1,10 @@ '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-localaddress.js b/test/parallel/test-https-localaddress.js index d660019951118e..5fab51e80c9872 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -1,18 +1,14 @@ '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 f771555ed79969..4f10b907fc4b1f 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -1,12 +1,10 @@ '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 b7acc41521c76a..b16824ad1e7185 100644 --- a/test/parallel/test-https-req-split.js +++ b/test/parallel/test-https-req-split.js @@ -1,12 +1,11 @@ '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-set-timeout-server.js b/test/parallel/test-https-set-timeout-server.js index 95ce93cdc2bae5..dfa880f9108890 100644 --- a/test/parallel/test-https-set-timeout-server.js +++ b/test/parallel/test-https-set-timeout-server.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 http = require('http'); diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js index b161d78afabaaf..9184430888960d 100644 --- a/test/parallel/test-https-simple.js +++ b/test/parallel/test-https-simple.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-socket-options.js b/test/parallel/test-https-socket-options.js index a9b01b375da61a..824c0f3a5ae06a 100644 --- a/test/parallel/test-https-socket-options.js +++ b/test/parallel/test-https-socket-options.js @@ -1,14 +1,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 8d14d903941c77..1cb49fc64bfcc7 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -1,16 +1,13 @@ '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 20156207404022..e8606c37eca232 100644 --- a/test/parallel/test-https-timeout-server-2.js +++ b/test/parallel/test-https-timeout-server-2.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 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 b1c53319166395..8b6411e04b093d 100644 --- a/test/parallel/test-https-timeout-server.js +++ b/test/parallel/test-https-timeout-server.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'); diff --git a/test/parallel/test-https-timeout.js b/test/parallel/test-https-timeout.js index fddaea576d864a..eb5a17477c57fc 100644 --- a/test/parallel/test-https-timeout.js +++ b/test/parallel/test-https-timeout.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-https-truncate.js b/test/parallel/test-https-truncate.js index d526148f9b0cf4..3bc28825edf90f 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.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-unix-socket-self-signed.js b/test/parallel/test-https-unix-socket-self-signed.js index f503b84591cad7..df6773f8390675 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-punycode.js b/test/parallel/test-icu-punycode.js index d9b36e7df78882..cf83ac66206806 100644 --- a/test/parallel/test-icu-punycode.js +++ b/test/parallel/test-icu-punycode.js @@ -12,10 +12,8 @@ function getPunycode() { } } -if (!icu) { +if (!icu) common.skip('icu punycode tests because ICU is not present.'); - return; -} // Credit for list: http://www.i18nguy.com/markup/idna-examples.html const tests = [ diff --git a/test/parallel/test-intl-v8BreakIterator.js b/test/parallel/test-intl-v8BreakIterator.js index 91717d139466a2..03e0712ba3ece2 100644 --- a/test/parallel/test-intl-v8BreakIterator.js +++ b/test/parallel/test-intl-v8BreakIterator.js @@ -2,9 +2,8 @@ const common = require('../common'); const assert = require('assert'); -if (global.Intl === undefined || Intl.v8BreakIterator === undefined) { - return common.skip('no Intl'); -} +if (global.Intl === undefined || Intl.v8BreakIterator === undefined) + common.skip('no Intl'); try { new Intl.v8BreakIterator(); diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index d9543904c32c6c..a5b76538a2e722 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -24,7 +24,6 @@ if (!haveIntl) { `"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 ${ @@ -44,7 +43,7 @@ if (!haveIntl) { // 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 98810a39335acc..10f8128938a188 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -1,5 +1,8 @@ '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'); @@ -7,11 +10,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 f921ba0bbf8d6d..d875425f933db0 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -1,15 +1,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'); 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 de878726af5761..86d866afd13483 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -1,15 +1,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'); 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 5a1ffbb989cf8d..39410660a77ec6 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -1,14 +1,12 @@ '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 a04022c6564bbd..b5e04a9c622da8 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-loading-error.js b/test/parallel/test-module-loading-error.js index 44806fceb7904b..cf6ce7e4bdeee8 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -12,10 +12,8 @@ const error_desc = { }; const dlerror_msg = error_desc[process.platform]; -if (!dlerror_msg) { +if (!dlerror_msg) common.skip('platform not supported.'); - return; -} try { require('../fixtures/module-loading-error.node'); diff --git a/test/parallel/test-module-symlinked-peer-modules.js b/test/parallel/test-module-symlinked-peer-modules.js index 83aca75ed197a8..5fe3169ee87382 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-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index 2164f550ce941f..414b7dd1ce4634 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -1,13 +1,11 @@ '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]; @@ -60,8 +58,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 19749bde9552b6..c4f11db76bc4f2 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-pipe-writev.js b/test/parallel/test-pipe-writev.js index 6440b5f623761d..db95a4b181849f 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 95d41d36323178..92e3df3b57df47 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 5ac8a3f2238a7c..d70d1dfd389875 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 fae363e2196628..13caf8fba3e8cc 100644 --- a/test/parallel/test-process-getgroups.js +++ b/test/parallel/test-process-getgroups.js @@ -3,10 +3,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 85db45ff88c7c8..759820c2dc56d4 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 3cf342b869d418..7d1f4a0dbec4c1 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 cc0285f7475697..b652c95c9ac881 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 fb9bb489a081cf..7eed1c512f7942 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 4ccb139f6da738..76e371ab51c120 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 030c86be8e8dd4..7f15b7dfeb8b9d 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 61bc75cc6ffe67..818111c39bf578 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 1a8ce1b7dfd2c3..aaaf07d48ae897 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 a44a0633e6e8a7..85fcb2d2d16f9d 100644 --- a/test/parallel/test-require-symlink.js +++ b/test/parallel/test-require-symlink.js @@ -26,10 +26,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 cb82dfd9530379..12aea32ba306c7 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.isFreeBSD || common.isOSX || common.isLinux)) { - return common.skip(`Unsupported platform [${process.platform}]`); -} +if (!(common.isFreeBSD || common.isOSX || common.isLinux)) + common.skip(`Unsupported platform [${process.platform}]`); const assert = require('assert'); const exec = require('child_process').exec; diff --git a/test/parallel/test-signal-handler.js b/test/parallel/test-signal-handler.js index a040d7cc4c2145..6db40c75d232d1 100644 --- a/test/parallel/test-signal-handler.js +++ b/test/parallel/test-signal-handler.js @@ -2,10 +2,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 7ff4b33b77207b..f586d5be0c81fd 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 cba0cb0cf98ebc..85ddb7d902ba57 100644 --- a/test/parallel/test-tls-0-dns-altname.js +++ b/test/parallel/test-tls-0-dns-altname.js @@ -1,15 +1,12 @@ '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 d089ad223b1fd8..0b3447243db7f3 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 2b762b6cc48fc7..a48002d65a1efe 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -1,15 +1,10 @@ '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 3d3453d32fdb82..56f925b8a97945 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 7e24835ee689e9..a49b44d592b3a4 100644 --- a/test/parallel/test-tls-async-cb-after-socket-end.js +++ b/test/parallel/test-tls-async-cb-after-socket-end.js @@ -2,15 +2,13 @@ const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const path = require('path'); const fs = require('fs'); const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const tls = require('tls'); const options = { diff --git a/test/parallel/test-tls-cert-regression.js b/test/parallel/test-tls-cert-regression.js index 3cf7423b7d9807..20cfff5ef00eea 100644 --- a/test/parallel/test-tls-cert-regression.js +++ b/test/parallel/test-tls-cert-regression.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'); diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js index 5c89ef8bf4d425..0cc55d60040332 100644 --- a/test/parallel/test-tls-check-server-identity.js +++ b/test/parallel/test-tls-check-server-identity.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 util = require('util'); diff --git a/test/parallel/test-tls-cipher-list.js b/test/parallel/test-tls-cipher-list.js index 912fb6412859bf..4a39ee9391a7c1 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 bd5db779785de1..4216e344c56276 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.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 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 521ef6bee782e5..f3d84a5efd5dd6 100644 --- a/test/parallel/test-tls-client-abort2.js +++ b/test/parallel/test-tls-client-abort2.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'); 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 30095197b1c807..91a0a86b1b7c53 100644 --- a/test/parallel/test-tls-client-default-ciphers.js +++ b/test/parallel/test-tls-client-default-ciphers.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'); function Done() {} diff --git a/test/parallel/test-tls-client-destroy-soon.js b/test/parallel/test-tls-client-destroy-soon.js index 15b7ade2932528..94a49568f3d8f2 100644 --- a/test/parallel/test-tls-client-destroy-soon.js +++ b/test/parallel/test-tls-client-destroy-soon.js @@ -4,14 +4,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 00defd5ae5a197..7d93dcbedf8e53 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 f68134d76025d2..685d790f8dc393 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 003de4b8a38241..be3233dbbcc2a7 100644 --- a/test/parallel/test-tls-client-reject.js +++ b/test/parallel/test-tls-client-reject.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 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 111c8ce34d7d25..211d086d2b8ad2 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -4,14 +4,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 9ec23d206855ca..565b3917b28368 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.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-close-error.js b/test/parallel/test-tls-close-error.js index 60290989f8e2c7..e7e48cdc05c8a3 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 2a6776b0b18710..15f9f36d2ab1f5 100644 --- a/test/parallel/test-tls-close-notify.js +++ b/test/parallel/test-tls-close-notify.js @@ -1,12 +1,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 084531748656e2..84b71c7e64b1be 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 f22831f395a8dd..afacd5a39027a0 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 2fa12aedc4979b..b69e0b94a3c598 100644 --- a/test/parallel/test-tls-connect-given-socket.js +++ b/test/parallel/test-tls-connect-given-socket.js @@ -1,16 +1,14 @@ '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 2e4bcfbc6d4787..f63c821a7f6a35 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 55295eb9997410..2467a9196abaa4 100644 --- a/test/parallel/test-tls-connect-pipe.js +++ b/test/parallel/test-tls-connect-pipe.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'); diff --git a/test/parallel/test-tls-connect-simple.js b/test/parallel/test-tls-connect-simple.js index 84cbe633eda7c8..aa59f059f6ddf2 100644 --- a/test/parallel/test-tls-connect-simple.js +++ b/test/parallel/test-tls-connect-simple.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'); diff --git a/test/parallel/test-tls-connect.js b/test/parallel/test-tls-connect.js index 0a6af35e7d1f5a..b410f86180e00b 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -2,12 +2,10 @@ const common = require('../common'); const assert = require('assert'); -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 35da6d0e42efed..9d37f15efe4846 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 655da22ac836fc..12ebb912460582 100644 --- a/test/parallel/test-tls-delayed-attach.js +++ b/test/parallel/test-tls-delayed-attach.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 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 b4f9766d998630..d157c7bf3f82b5 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 3d9a7ef5277676..3e43fd29a0e333 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.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; -} -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 43dcfe58f804b7..a44ce2cedbe6b1 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -1,19 +1,13 @@ '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 ee1e7a3a884a04..32df9c1d3a8544 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -1,15 +1,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 e54c48a46b7888..fb3cb2f7001693 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.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'); const cacert = diff --git a/test/parallel/test-tls-empty-sni-context.js b/test/parallel/test-tls-empty-sni-context.js index e68378fb4eac50..3f39d6e8c1091a 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 57e4c1cfaf3af6..ece93f33539d71 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 e2de272184e5f4..be7c826b85cc1f 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 08a4ad16e8b4d4..2d7b1f62b98977 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 5b11375809aca8..b8605ca00bb4ea 100644 --- a/test/parallel/test-tls-fast-writing.js +++ b/test/parallel/test-tls-fast-writing.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 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 62dfc81eccfe4c..51ce0d0dae4547 100644 --- a/test/parallel/test-tls-friendly-error-message.js +++ b/test/parallel/test-tls-friendly-error-message.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 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 52f898ef145da1..dc3ff1bb39d5b7 100644 --- a/test/parallel/test-tls-getcipher.js +++ b/test/parallel/test-tls-getcipher.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-getprotocol.js b/test/parallel/test-tls-getprotocol.js index 393b8fb3fe028a..dd96aa6f7494a6 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 e3cbb39be01a57..9ae1f31dfd6ba1 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 039c55b486d6a2..5c65ca4af611fd 100644 --- a/test/parallel/test-tls-handshake-nohang.js +++ b/test/parallel/test-tls-handshake-nohang.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'); // neither should hang diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index 295cfaba25f4c7..a6659d4578bc9b 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.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 tls = require('tls'); diff --git a/test/parallel/test-tls-honorcipherorder.js b/test/parallel/test-tls-honorcipherorder.js index a6d51d5dfeea6d..a9d35a01baca51 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 183fbe587b366c..50debbc75fcd00 100644 --- a/test/parallel/test-tls-inception.js +++ b/test/parallel/test-tls-inception.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-interleave.js b/test/parallel/test-tls-interleave.js index 1bbba9aff73d44..15d617c57b0158 100644 --- a/test/parallel/test-tls-interleave.js +++ b/test/parallel/test-tls-interleave.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-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js index 6bbf2369ff18a0..3d4cb8b00f3af0 100644 --- a/test/parallel/test-tls-invoke-queued.js +++ b/test/parallel/test-tls-invoke-queued.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-js-stream.js b/test/parallel/test-tls-js-stream.js index c97cbfb9cb148e..56f62aecfa450f 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 ff4d0b3ae39a5d..33b0583869a9ea 100644 --- a/test/parallel/test-tls-junk-closes-server.js +++ b/test/parallel/test-tls-junk-closes-server.js @@ -1,10 +1,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 9b5ab6fdcc649d..3270dec745c1ba 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 4c755afa935534..c30164652511a9 100644 --- a/test/parallel/test-tls-key-mismatch.js +++ b/test/parallel/test-tls-key-mismatch.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 fs = require('fs'); diff --git a/test/parallel/test-tls-legacy-onselect.js b/test/parallel/test-tls-legacy-onselect.js index 6540639cc93e7c..e66e0dd4b4ad69 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-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js index 6d7d9009e9a72e..1f9dd336d447de 100644 --- a/test/parallel/test-tls-max-send-fragment.js +++ b/test/parallel/test-tls-max-send-fragment.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 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 d78e617977d72d..ca2517c481f327 100644 --- a/test/parallel/test-tls-multi-key.js +++ b/test/parallel/test-tls-multi-key.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'); 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 001f6443c1b026..7f3d1b8d48db45 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -1,11 +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 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 8f05fcd514d0c5..07a3ea434a085a 100644 --- a/test/parallel/test-tls-no-rsa-key.js +++ b/test/parallel/test-tls-no-rsa-key.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 fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-no-sslv23.js b/test/parallel/test-tls-no-sslv23.js index 564efab26da22c..737f42b530d93a 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 2c2c51eb9be5fd..0a118dbe7e9d49 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 7cb8723ff5f9e6..22491c10d5ce55 100644 --- a/test/parallel/test-tls-npn-server-client.js +++ b/test/parallel/test-tls-npn-server-client.js @@ -2,15 +2,11 @@ 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 1a97f701780dbf..673b69eccbad9e 100644 --- a/test/parallel/test-tls-ocsp-callback.js +++ b/test/parallel/test-tls-ocsp-callback.js @@ -1,19 +1,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 38537fd640c71a..5b66edd0c2076a 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 741d351f47e753..ae9c8e0cc8aa0a 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.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 net = require('net'); const http = require('http'); diff --git a/test/parallel/test-tls-passphrase.js b/test/parallel/test-tls-passphrase.js index f8fc4c9313d9da..0092dbd84d8586 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.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 fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-pause.js b/test/parallel/test-tls-pause.js index 239720f1e9dbb3..4aded19d5c5b17 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.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 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 1ae30974aeda83..d6e920a0703dd5 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.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 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 693bb4cb3fa812..ed5566f8e7c91f 100644 --- a/test/parallel/test-tls-peer-certificate-multi-keys.js +++ b/test/parallel/test-tls-peer-certificate-multi-keys.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 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 83847fd8bb57d8..ba38f02cdcf540 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 6f4392007bc856..9bb07fe7ca3b3e 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 ab30bf94ee0e96..3989e40f18d9ea 100644 --- a/test/parallel/test-tls-request-timeout.js +++ b/test/parallel/test-tls-request-timeout.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 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 a3a2aebcd6ab2c..4be64c15969f22 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-server.js b/test/parallel/test-tls-securepair-server.js index 8f6efbb677a500..d335bb29948084 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -1,19 +1,13 @@ '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 1c54eb635ad449..7eef14d23b5371 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 0290bcc629a3e3..8efb4ec53866d5 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 836f5ff6e54ebc..7a106f694b9484 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.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.'); // 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 0b2942215141e3..326e760f495e82 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -1,15 +1,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 f62657077f2a2f..d53029e4cc9511 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -1,15 +1,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 3ef06d4747a129..4114ee593783a6 100644 --- a/test/parallel/test-tls-set-encoding.js +++ b/test/parallel/test-tls-set-encoding.js @@ -1,16 +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'); - 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 9181705f6b7460..ff3e2ef05c3a47 100644 --- a/test/parallel/test-tls-sni-option.js +++ b/test/parallel/test-tls-sni-option.js @@ -2,15 +2,11 @@ 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 4e1ab6484c0eec..ebe51f23138c75 100644 --- a/test/parallel/test-tls-sni-server-client.js +++ b/test/parallel/test-tls-sni-server-client.js @@ -1,15 +1,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 25282ada9ed31a..f9a77bf4648b46 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-default-options.js b/test/parallel/test-tls-socket-default-options.js index 8114574437c560..66f26897182f31 100644 --- a/test/parallel/test-tls-socket-default-options.js +++ b/test/parallel/test-tls-socket-default-options.js @@ -9,10 +9,8 @@ const { connect, keys, tls } = require(join(common.fixturesDir, 'tls-connect')); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(0); -} test(undefined, (err) => { assert.strictEqual(err.message, 'unable to verify the first certificate'); diff --git a/test/parallel/test-tls-socket-destroy.js b/test/parallel/test-tls-socket-destroy.js index 0a72ac6232e865..b101a872c23422 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 106a14a7df8ec6..16175b8898115e 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 601c0e4393c2eb..92d595e80cfae6 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 d588fee34d5feb..28d1db88598cfd 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 4c534ca2481e74..49c4c3414be8b3 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.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 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 116cdc0c2c4f0c..3d6f7a43061c4f 100644 --- a/test/parallel/test-tls-ticket.js +++ b/test/parallel/test-tls-ticket.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 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 b4dceb60711ab4..a462750759723b 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.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 fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js index 6424b5bc13ca01..b983e2c5b9219c 100644 --- a/test/parallel/test-tls-timeout-server.js +++ b/test/parallel/test-tls-timeout-server.js @@ -1,12 +1,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-wrap-timeout.js b/test/parallel/test-tls-wrap-timeout.js index 64fbcc7fc7f270..b4cff368182fa3 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 b1a6d6a1058a65..bc09044ae8054f 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 c738a0afce988b..81926608421906 100644 --- a/test/parallel/test-tls-zero-clear-in.js +++ b/test/parallel/test-tls-zero-clear-in.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'); diff --git a/test/parallel/test-util-sigint-watchdog.js b/test/parallel/test-util-sigint-watchdog.js index fdf8dc160c2ed6..16bc6d37651710 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 834367a871bce0..79a4d556ac05d6 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 3fd338edf25eae..b35591cb75fbca 100644 --- a/test/parallel/test-vm-sigint.js +++ b/test/parallel/test-vm-sigint.js @@ -1,8 +1,13 @@ '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 +15,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-windows-abort-exitcode.js b/test/parallel/test-windows-abort-exitcode.js index c5c5fa6f3a5e78..d61a91315bb679 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 d4cd4319f93c21..143ab526f70a49 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -1,18 +1,15 @@ '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 c82e46f139382e..22b52b1483d92e 100644 --- a/test/pummel/test-abort-fatal-error.js +++ b/test/pummel/test-abort-fatal-error.js @@ -1,12 +1,9 @@ '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 03be3ab7ad48e2..5ebd133793d6a4 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -1,13 +1,11 @@ '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 5560a4a256b5fe..4aad5ed20cbe39 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 5be6abb9a8b29c..ce4ced41b632e1 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.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 p = crypto.createDiffieHellman(1024).getPrime(); diff --git a/test/pummel/test-dtrace-jsstack.js b/test/pummel/test-dtrace-jsstack.js index 81ffdf0039e307..0e6f5776446ace 100644 --- a/test/pummel/test-dtrace-jsstack.js +++ b/test/pummel/test-dtrace-jsstack.js @@ -1,13 +1,11 @@ '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 d84989238dee3a..edc040d81eeab1 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -1,22 +1,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 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 f098e86dafa0af..24fb07078f92e5 100644 --- a/test/pummel/test-https-large-response.js +++ b/test/pummel/test-https-large-response.js @@ -1,13 +1,10 @@ '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 437b4e3c4acefe..03888073fc1e91 100644 --- a/test/pummel/test-https-no-reader.js +++ b/test/pummel/test-https-no-reader.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 path = require('path'); diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index f8ea1e8d4d79ab..94f653509ab929 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -2,16 +2,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 9258d9032bdc9d..34414672218b4b 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -6,15 +6,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 5d2815aa96fad5..45fd47f42e181b 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -1,21 +1,16 @@ '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 c1637776116573..9d483aa3c54d92 100644 --- a/test/pummel/test-tls-connect-memleak.js +++ b/test/pummel/test-tls-connect-memleak.js @@ -2,14 +2,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 234ee6a09117b0..6d3bcb67356e03 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -1,17 +1,12 @@ '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 4d1065a790df8b..e048defe39155c 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.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 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 c202586a107ab7..e92befc928b2ad 100644 --- a/test/pummel/test-tls-session-timeout.js +++ b/test/pummel/test-tls-session-timeout.js @@ -1,15 +1,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 a4784f8eab0426..502b7306766264 100644 --- a/test/pummel/test-tls-throttle.js +++ b/test/pummel/test-tls-throttle.js @@ -3,12 +3,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-buffer-creation-regression.js b/test/sequential/test-buffer-creation-regression.js index 8137e4830a9cb0..8c3a09848c9fa9 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 ff141bdf4bfcf0..6e63faad43cabd 100644 --- a/test/sequential/test-child-process-emfile.js +++ b/test/sequential/test-child-process-emfile.js @@ -1,14 +1,12 @@ '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 b2481270faf065..8cc11f6c11f5b4 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 7a1f8d2993669b..2847af9ef8bdb5 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 593b8da0fd8afa..9740cdde02166c 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-net-server-address.js b/test/sequential/test-net-server-address.js index 75fe14812962ea..c401137a4b52eb 100644 --- a/test/sequential/test-net-server-address.js +++ b/test/sequential/test-net-server-address.js @@ -19,7 +19,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 afe08bdb0b672b..0fb839f8d1321c 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 72eb25e91c394a..dc1aed41a79ea6 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 ab3d110ccff012..c0f5f332b260fe 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');