From ab91eb8aadecc7af5c2ec61b3a4e96a4f0acb3ec Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 1 Jul 2017 02:29:09 +0300 Subject: [PATCH 1/2] test: make common.skip() exit Also add common.printSkipMessage() for partial skips. Fixes: https://github.com/nodejs/node/issues/14016 --- test/abort/test-abort-backtrace.js | 4 +--- test/addons/load-long-path/test.js | 4 +--- test/addons/openssl-binding/test.js | 5 ++--- .../test-stringbytes-external-at-max.js | 9 ++------- ...stringbytes-external-exceed-max-by-1-ascii.js | 9 ++------- ...tringbytes-external-exceed-max-by-1-base64.js | 9 ++------- ...tringbytes-external-exceed-max-by-1-binary.js | 9 ++------- ...t-stringbytes-external-exceed-max-by-1-hex.js | 9 ++------- ...-stringbytes-external-exceed-max-by-1-utf8.js | 9 ++------- .../test-stringbytes-external-exceed-max-by-2.js | 9 ++------- .../test-stringbytes-external-exceed-max.js | 9 ++------- test/addons/symlinked-module/test.js | 1 - test/async-hooks/test-connection.ssl.js | 4 +--- test/async-hooks/test-crypto-pbkdf2.js | 5 ++--- test/async-hooks/test-crypto-randomBytes.js | 5 ++--- test/async-hooks/test-graph.connection.js | 4 +--- test/async-hooks/test-graph.shutdown.js | 4 +--- test/async-hooks/test-graph.tcp.js | 4 +--- test/async-hooks/test-graph.tls-write.js | 8 ++------ test/async-hooks/test-tcpwrap.js | 4 +--- test/async-hooks/test-tlswrap.js | 4 +--- test/async-hooks/test-ttywrap.writestream.js | 5 +++-- test/async-hooks/test-writewrap.js | 4 +--- test/common/README.md | 7 ++++++- test/common/index.js | 8 ++++++-- test/doctool/test-doctool-html.js | 2 +- test/doctool/test-doctool-json.js | 2 +- test/fixtures/tls-connect.js | 5 ++--- test/inspector/test-inspector-ip-detection.js | 6 ++---- .../test-dgram-broadcast-multi-process.js | 4 +--- .../test-dgram-multicast-multi-process.js | 4 +--- test/internet/test-dns-ipv6.js | 4 +--- test/internet/test-http-https-default-ports.js | 5 ++--- test/internet/test-tls-add-ca-cert.js | 4 +--- test/internet/test-tls-connnect-melissadata.js | 4 +--- test/internet/test-tls-reuse-host-from-socket.js | 5 ++--- test/known_issues/test-cwd-enoent-file.js | 1 - test/parallel/test-async-wrap-GH13045.js | 4 +--- .../test-async-wrap-uncaughtexception.js | 5 ++--- test/parallel/test-benchmark-crypto.js | 8 ++------ test/parallel/test-buffer-alloc.js | 2 +- test/parallel/test-child-process-fork-dgram.js | 4 +--- test/parallel/test-cli-node-options.js | 2 +- .../test-cluster-bind-privileged-port.js | 8 ++------ test/parallel/test-cluster-dgram-1.js | 4 +--- test/parallel/test-cluster-dgram-2.js | 4 +--- test/parallel/test-cluster-dgram-reuse.js | 4 +--- test/parallel/test-cluster-disconnect-race.js | 4 +--- .../test-cluster-disconnect-unshared-udp.js | 4 +--- test/parallel/test-cluster-http-pipe.js | 1 - ...cluster-shared-handle-bind-privileged-port.js | 8 ++------ test/parallel/test-crypto-authenticated.js | 9 ++++----- test/parallel/test-crypto-binary-default.js | 4 +--- test/parallel/test-crypto-certificate.js | 5 ++--- test/parallel/test-crypto-cipher-decipher.js | 10 ++++------ test/parallel/test-crypto-cipheriv-decipheriv.js | 5 ++--- test/parallel/test-crypto-deprecated.js | 5 ++--- test/parallel/test-crypto-dh-odd-key.js | 5 ++--- test/parallel/test-crypto-dh.js | 5 ++--- test/parallel/test-crypto-domain.js | 5 ++--- test/parallel/test-crypto-domains.js | 5 ++--- test/parallel/test-crypto-ecb.js | 10 ++++------ test/parallel/test-crypto-engine.js | 4 +--- test/parallel/test-crypto-fips.js | 4 +--- test/parallel/test-crypto-from-binary.js | 5 ++--- test/parallel/test-crypto-hash-stream-pipe.js | 4 +--- test/parallel/test-crypto-hash.js | 5 ++--- test/parallel/test-crypto-hmac.js | 5 ++--- .../test-crypto-lazy-transform-writable.js | 5 ++--- test/parallel/test-crypto-padding-aes256.js | 5 ++--- test/parallel/test-crypto-padding.js | 5 ++--- test/parallel/test-crypto-pbkdf2.js | 6 ++---- test/parallel/test-crypto-random.js | 5 ++--- test/parallel/test-crypto-rsa-dsa.js | 5 ++--- test/parallel/test-crypto-sign-verify.js | 9 +++------ test/parallel/test-crypto-stream.js | 5 ++--- test/parallel/test-crypto-verify-failure.js | 5 ++--- test/parallel/test-crypto.js | 4 +--- test/parallel/test-cwd-enoent-preload.js | 4 +--- test/parallel/test-cwd-enoent-repl.js | 4 +--- test/parallel/test-cwd-enoent.js | 4 +--- test/parallel/test-debug-usage.js | 4 +--- test/parallel/test-dgram-bind-default-address.js | 6 ++---- .../test-dgram-cluster-close-during-bind.js | 4 +--- test/parallel/test-dgram-send-empty-array.js | 4 +--- test/parallel/test-dgram-send-empty-buffer.js | 4 +--- test/parallel/test-dgram-send-empty-packet.js | 4 +--- .../test-dgram-udp6-send-default-host.js | 4 +--- test/parallel/test-dh-padding.js | 4 +--- test/parallel/test-domain-crypto.js | 4 +--- test/parallel/test-dsa-fips-invalid-key.js | 4 +--- test/parallel/test-fs-long-path.js | 4 +--- test/parallel/test-fs-read-file-sync-hostname.js | 4 +--- test/parallel/test-fs-readdir-ucs2.js | 4 +--- test/parallel/test-fs-readfile-error.js | 4 +--- test/parallel/test-fs-readfile-pipe-large.js | 4 +--- test/parallel/test-fs-readfile-pipe.js | 4 +--- test/parallel/test-fs-readfilesync-pipe-large.js | 4 +--- .../test-fs-realpath-on-substed-drive.js | 9 +++------ test/parallel/test-fs-realpath-pipe.js | 4 +--- test/parallel/test-fs-realpath.js | 16 ++++++++-------- test/parallel/test-fs-symlink.js | 4 +--- test/parallel/test-fs-watch-encoding.js | 4 +--- test/parallel/test-fs-watch-recursive.js | 4 +--- test/parallel/test-http-chunk-problem.js | 4 +--- test/parallel/test-http-default-port.js | 4 +--- test/parallel/test-http-dns-error.js | 6 ++---- test/parallel/test-http-full-response.js | 2 +- test/parallel/test-http-invalid-urls.js | 4 +--- test/parallel/test-http-localaddress.js | 4 +--- .../test-http-url.parse-https.request.js | 5 ++--- test/parallel/test-https-agent-constructor.js | 5 ++--- .../test-https-agent-create-connection.js | 4 +--- .../test-https-agent-disable-session-reuse.js | 4 +--- test/parallel/test-https-agent-getname.js | 4 +--- .../parallel/test-https-agent-secure-protocol.js | 4 +--- test/parallel/test-https-agent-servername.js | 4 +--- .../test-https-agent-session-eviction.js | 4 +--- test/parallel/test-https-agent-session-reuse.js | 4 +--- test/parallel/test-https-agent-sni.js | 5 ++--- test/parallel/test-https-agent-sockets-leak.js | 4 +--- test/parallel/test-https-agent.js | 5 ++--- test/parallel/test-https-argument-of-creating.js | 4 +--- test/parallel/test-https-byteswritten.js | 5 ++--- .../test-https-client-checkServerIdentity.js | 5 ++--- test/parallel/test-https-client-get-url.js | 5 ++--- test/parallel/test-https-client-reject.js | 5 ++--- test/parallel/test-https-client-resume.js | 5 ++--- test/parallel/test-https-close.js | 5 ++--- .../test-https-connect-address-family.js | 13 ++++--------- test/parallel/test-https-connecting-to-http.js | 5 ++--- test/parallel/test-https-drain.js | 5 ++--- test/parallel/test-https-eof-for-eom.js | 5 ++--- test/parallel/test-https-foafssl.js | 9 +++------ test/parallel/test-https-host-headers.js | 5 ++--- .../test-https-localaddress-bind-error.js | 5 ++--- test/parallel/test-https-localaddress.js | 9 +++------ test/parallel/test-https-pfx.js | 5 ++--- test/parallel/test-https-req-split.js | 5 ++--- test/parallel/test-https-resume-after-renew.js | 4 +--- .../test-https-server-keep-alive-timeout.js | 5 ++--- test/parallel/test-https-simple.js | 4 +--- test/parallel/test-https-socket-options.js | 5 ++--- test/parallel/test-https-strict.js | 5 ++--- test/parallel/test-https-timeout-server-2.js | 5 ++--- test/parallel/test-https-timeout-server.js | 5 ++--- test/parallel/test-https-timeout.js | 5 ++--- test/parallel/test-https-truncate.js | 4 +--- .../test-https-unix-socket-self-signed.js | 4 +--- test/parallel/test-icu-data-dir.js | 5 ++--- test/parallel/test-icu-punycode.js | 4 +--- test/parallel/test-icu-stringwidth.js | 4 +--- test/parallel/test-icu-transcode.js | 4 +--- test/parallel/test-intl-v8BreakIterator.js | 5 ++--- test/parallel/test-intl.js | 3 +-- test/parallel/test-listen-fd-cluster.js | 4 +--- test/parallel/test-listen-fd-detached-inherit.js | 4 +--- test/parallel/test-listen-fd-detached.js | 4 +--- test/parallel/test-listen-fd-server.js | 4 +--- test/parallel/test-module-circular-symlinks.js | 1 - .../test-module-symlinked-peer-modules.js | 1 - test/parallel/test-net-access-byteswritten.js | 5 ++--- test/parallel/test-net-connect-options-fd.js | 4 +--- test/parallel/test-net-connect-options-ipv6.js | 6 ++---- test/parallel/test-net-socket-local-address.js | 4 +--- test/parallel/test-npm-install.js | 4 +--- test/parallel/test-openssl-ca-options.js | 5 ++--- test/parallel/test-pipe-writev.js | 4 +--- test/parallel/test-preload.js | 4 +--- test/parallel/test-process-execpath.js | 4 +--- test/parallel/test-process-getgroups.js | 5 ++--- .../test-process-remove-all-signal-listeners.js | 7 ++----- test/parallel/test-regress-GH-1531.js | 5 ++--- test/parallel/test-regress-GH-3542.js | 4 +--- test/parallel/test-regress-GH-9819.js | 4 +--- test/parallel/test-repl-history-perm.js | 1 - test/parallel/test-repl-sigint-nested-eval.js | 1 - test/parallel/test-repl-sigint.js | 1 - test/parallel/test-require-long-path.js | 4 +--- test/parallel/test-require-symlink.js | 4 +--- test/parallel/test-setproctitle.js | 10 ++++------ test/parallel/test-signal-handler.js | 4 +--- test/parallel/test-spawn-cmd-named-pipe.js | 4 +--- test/parallel/test-tls-0-dns-altname.js | 5 ++--- test/parallel/test-tls-alert-handling.js | 8 ++------ test/parallel/test-tls-alert.js | 9 ++------- test/parallel/test-tls-alpn-server-client.js | 5 +---- .../test-tls-async-cb-after-socket-end.js | 4 +--- test/parallel/test-tls-basic-validations.js | 4 +--- test/parallel/test-tls-cert-regression.js | 5 ++--- test/parallel/test-tls-check-server-identity.js | 4 +--- test/parallel/test-tls-cipher-list.js | 4 +--- test/parallel/test-tls-client-abort.js | 5 ++--- test/parallel/test-tls-client-abort2.js | 5 ++--- test/parallel/test-tls-client-default-ciphers.js | 5 ++--- test/parallel/test-tls-client-destroy-soon.js | 5 ++--- .../test-tls-client-getephemeralkeyinfo.js | 5 ++--- test/parallel/test-tls-client-mindhsize.js | 5 ++--- test/parallel/test-tls-client-reject.js | 5 ++--- test/parallel/test-tls-client-resume.js | 5 ++--- test/parallel/test-tls-client-verify.js | 5 +---- test/parallel/test-tls-close-error.js | 5 ++--- test/parallel/test-tls-close-notify.js | 5 ++--- test/parallel/test-tls-cnnic-whitelist.js | 4 +--- test/parallel/test-tls-connect-address-family.js | 13 ++++--------- test/parallel/test-tls-connect-given-socket.js | 5 ++--- 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-stream-writes.js | 4 +--- test/parallel/test-tls-connect.js | 5 ++--- test/parallel/test-tls-delayed-attach-error.js | 5 ++--- test/parallel/test-tls-delayed-attach.js | 5 ++--- test/parallel/test-tls-destroy-whilst-write.js | 5 ++--- test/parallel/test-tls-dhe.js | 8 ++------ test/parallel/test-tls-ecdh-disable.js | 8 ++------ test/parallel/test-tls-ecdh.js | 8 ++------ test/parallel/test-tls-econnreset.js | 5 ++--- test/parallel/test-tls-empty-sni-context.js | 9 +++------ 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 | 4 +--- test/parallel/test-tls-fast-writing.js | 5 ++--- test/parallel/test-tls-friendly-error-message.js | 5 ++--- test/parallel/test-tls-getcipher.js | 5 ++--- test/parallel/test-tls-getprotocol.js | 4 +--- test/parallel/test-tls-handshake-error.js | 5 ++--- test/parallel/test-tls-handshake-nohang.js | 5 ++--- test/parallel/test-tls-hello-parser-failure.js | 4 +--- test/parallel/test-tls-honorcipherorder.js | 5 ++--- 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 | 5 ++--- test/parallel/test-tls-junk-closes-server.js | 4 +--- test/parallel/test-tls-junk-server.js | 4 +--- test/parallel/test-tls-key-mismatch.js | 5 ++--- test/parallel/test-tls-legacy-deprecated.js | 5 ++--- test/parallel/test-tls-legacy-onselect.js | 5 ++--- test/parallel/test-tls-lookup.js | 5 ++--- test/parallel/test-tls-max-send-fragment.js | 5 ++--- test/parallel/test-tls-multi-key.js | 5 ++--- test/parallel/test-tls-no-cert-required.js | 5 ++--- test/parallel/test-tls-no-rsa-key.js | 5 ++--- test/parallel/test-tls-no-sslv23.js | 5 ++--- test/parallel/test-tls-no-sslv3.js | 11 ++++------- 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 | 5 ++--- test/parallel/test-tls-parse-cert-string.js | 4 +--- test/parallel/test-tls-passphrase.js | 5 ++--- test/parallel/test-tls-pause.js | 5 ++--- .../test-tls-peer-certificate-encoding.js | 5 ++--- .../test-tls-peer-certificate-multi-keys.js | 5 ++--- 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 | 5 ++--- test/parallel/test-tls-retain-handle-no-abort.js | 5 ++--- test/parallel/test-tls-securepair-fiftharg.js | 4 +--- test/parallel/test-tls-securepair-leak.js | 4 +--- test/parallel/test-tls-securepair-server.js | 8 ++------ .../test-tls-server-connection-server.js | 4 +--- ...-server-failed-handshake-emits-clienterror.js | 5 ++--- test/parallel/test-tls-server-verify.js | 13 ++++--------- test/parallel/test-tls-session-cache.js | 8 ++------ test/parallel/test-tls-set-ciphers.js | 8 ++------ test/parallel/test-tls-set-encoding.js | 5 ++--- test/parallel/test-tls-sni-option.js | 12 ++++-------- test/parallel/test-tls-sni-server-client.js | 12 ++++-------- test/parallel/test-tls-socket-close.js | 5 ++--- test/parallel/test-tls-socket-destroy.js | 4 +--- ...st-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 | 5 ++--- test/parallel/test-tls-ticket.js | 5 ++--- test/parallel/test-tls-timeout-server-2.js | 5 ++--- test/parallel/test-tls-timeout-server.js | 5 ++--- test/parallel/test-tls-two-cas-one-string.js | 4 +--- .../test-tls-wrap-econnreset-localaddress.js | 5 ++--- test/parallel/test-tls-wrap-econnreset-pipe.js | 5 ++--- test/parallel/test-tls-wrap-econnreset-socket.js | 5 ++--- test/parallel/test-tls-wrap-econnreset.js | 5 ++--- test/parallel/test-tls-wrap-event-emmiter.js | 5 ++--- test/parallel/test-tls-wrap-no-abort.js | 4 +--- test/parallel/test-tls-wrap-timeout.js | 5 ++--- test/parallel/test-tls-writewrap-leak.js | 4 +--- test/parallel/test-tls-zero-clear-in.js | 5 ++--- test/parallel/test-url-domain-ascii-unicode.js | 5 ++--- test/parallel/test-url-format-whatwg.js | 5 ++--- test/parallel/test-util-sigint-watchdog.js | 1 - test/parallel/test-vm-sigint-existing-handler.js | 1 - test/parallel/test-vm-sigint.js | 1 - test/parallel/test-warn-sigprof.js | 4 +--- test/parallel/test-whatwg-url-constructor.js | 1 - test/parallel/test-whatwg-url-domainto.js | 4 +--- test/parallel/test-whatwg-url-historical.js | 1 - test/parallel/test-whatwg-url-inspect.js | 1 - test/parallel/test-whatwg-url-origin.js | 1 - test/parallel/test-whatwg-url-parsing.js | 1 - test/parallel/test-whatwg-url-setters.js | 1 - test/parallel/test-whatwg-url-toascii.js | 1 - test/parallel/test-windows-abort-exitcode.js | 5 ++--- test/parallel/test-zlib-random-byte-pipes.js | 5 ++--- test/pummel/test-abort-fatal-error.js | 4 +--- test/pummel/test-crypto-dh.js | 4 +--- .../test-crypto-timing-safe-equal-benchmarks.js | 8 ++------ test/pummel/test-dh-regr.js | 5 ++--- test/pummel/test-dtrace-jsstack.js | 4 +--- test/pummel/test-https-ci-reneg-attack.js | 9 +++------ test/pummel/test-https-large-response.js | 5 ++--- test/pummel/test-https-no-reader.js | 5 ++--- test/pummel/test-keep-alive.js | 4 +--- test/pummel/test-regress-GH-892.js | 5 ++--- test/pummel/test-tls-ci-reneg-attack.js | 9 +++------ test/pummel/test-tls-connect-memleak.js | 5 ++--- test/pummel/test-tls-securepair-client.js | 8 ++------ test/pummel/test-tls-server-large-request.js | 5 ++--- test/pummel/test-tls-session-timeout.js | 8 ++------ test/pummel/test-tls-throttle.js | 5 ++--- test/sequential/test-benchmark-http.js | 4 +--- .../test-buffer-creation-regression.js | 3 ++- test/sequential/test-child-process-emfile.js | 4 +--- test/sequential/test-child-process-pass-fd.js | 4 +--- test/sequential/test-crypto-timing-safe-equal.js | 4 +--- .../sequential/test-fs-readfile-tostring-fail.js | 7 ++----- test/sequential/test-https-set-timeout-server.js | 4 +--- test/sequential/test-net-server-address.js | 2 +- .../test-tick-processor-builtin.js | 8 ++------ .../test-tick-processor-cpp-core.js | 8 ++------ .../test-tick-processor-unknown.js | 8 ++------ 332 files changed, 543 insertions(+), 1120 deletions(-) diff --git a/test/abort/test-abort-backtrace.js b/test/abort/test-abort-backtrace.js index 7f72ee8e71c6..2ea1179a77a6 100644 --- a/test/abort/test-abort-backtrace.js +++ b/test/abort/test-abort-backtrace.js @@ -3,10 +3,8 @@ const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); -if (common.isWindows) { +if (common.isWindows) common.skip('Backtraces unimplemented on Windows.'); - return; -} if (process.argv[2] === 'child') { process.abort(); diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index 73d85a75a097..b1b8c4e2980f 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -4,10 +4,8 @@ const fs = require('fs'); const path = require('path'); const assert = require('assert'); -if (common.isWOW64) { +if (common.isWOW64) common.skip('doesn\'t work on WOW64'); - return; -} common.refreshTmpDir(); diff --git a/test/addons/openssl-binding/test.js b/test/addons/openssl-binding/test.js index 452f59f752f5..1e6c57ffd1e0 100644 --- a/test/addons/openssl-binding/test.js +++ b/test/addons/openssl-binding/test.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(0); -} + const assert = require('assert'); const binding = require(`./build/${common.buildType}/binding`); const bytes = new Uint8Array(1024); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js index 5dd727f8ffdd..4b98e85dd111 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 @@ -9,10 +9,8 @@ const assert = require('assert'); const kStringMaxLength = process.binding('buffer').kStringMaxLength; const skipMessage = 'intensive toString tests due to memory confinements'; -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip(skipMessage); - return; -} let buf; try { @@ -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 2466c8ec42ed..11a85bfab039 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 @@ -5,10 +5,8 @@ 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; -} // 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 16f0f5392e52..3088712bb912 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 @@ -5,10 +5,8 @@ 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; -} // 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 1028706b1d1a..67690a1d0d5e 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 @@ -5,10 +5,8 @@ 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; -} // 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 caf6112011e2..ab36c660d024 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 @@ -5,10 +5,8 @@ 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; -} // 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 4d3199a033e6..7666081191cf 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 @@ -5,10 +5,8 @@ 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; -} // 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 786d0b679895..999971a0a4f8 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 @@ -5,10 +5,8 @@ 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; -} // 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 36b0d4174a03..397ba5d9ca58 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 @@ -5,10 +5,8 @@ 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; -} // 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 d2025c54e436..d9455c027bd3 100644 --- a/test/addons/symlinked-module/test.js +++ b/test/addons/symlinked-module/test.js @@ -22,7 +22,6 @@ try { } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('module identity test (no privs for symlinks)'); - return; } const sub = require('./submodule'); diff --git a/test/async-hooks/test-connection.ssl.js b/test/async-hooks/test-connection.ssl.js index ac3e069fb8a2..2c0a2772b4d9 100644 --- a/test/async-hooks/test-connection.ssl.js +++ b/test/async-hooks/test-connection.ssl.js @@ -6,10 +6,8 @@ const common = require('../common'); const assert = require('assert'); const { checkInvocations } = require('./hook-checks'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const Connection = process.binding('crypto').Connection; diff --git a/test/async-hooks/test-crypto-pbkdf2.js b/test/async-hooks/test-crypto-pbkdf2.js index 3023101f0b66..2a0b44db8ce7 100644 --- a/test/async-hooks/test-crypto-pbkdf2.js +++ b/test/async-hooks/test-crypto-pbkdf2.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); diff --git a/test/async-hooks/test-crypto-randomBytes.js b/test/async-hooks/test-crypto-randomBytes.js index 49ffc6fdb612..76f8f7759503 100644 --- a/test/async-hooks/test-crypto-randomBytes.js +++ b/test/async-hooks/test-crypto-randomBytes.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); diff --git a/test/async-hooks/test-graph.connection.js b/test/async-hooks/test-graph.connection.js index 37ecc79bb069..e2a80523bc16 100644 --- a/test/async-hooks/test-graph.connection.js +++ b/test/async-hooks/test-graph.connection.js @@ -4,10 +4,8 @@ const initHooks = require('./init-hooks'); const common = require('../common'); const verifyGraph = require('./verify-graph'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const Connection = process.binding('crypto').Connection; diff --git a/test/async-hooks/test-graph.shutdown.js b/test/async-hooks/test-graph.shutdown.js index 029a9c86b667..f58474cb3fe3 100644 --- a/test/async-hooks/test-graph.shutdown.js +++ b/test/async-hooks/test-graph.shutdown.js @@ -4,10 +4,8 @@ const common = require('../common'); const initHooks = require('./init-hooks'); const verifyGraph = require('./verify-graph'); -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('IPv6 support required'); - return; -} const net = require('net'); diff --git a/test/async-hooks/test-graph.tcp.js b/test/async-hooks/test-graph.tcp.js index f9703769b831..f640b9215e5f 100644 --- a/test/async-hooks/test-graph.tcp.js +++ b/test/async-hooks/test-graph.tcp.js @@ -4,10 +4,8 @@ const common = require('../common'); const initHooks = require('./init-hooks'); const verifyGraph = require('./verify-graph'); -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('IPv6 support required'); - return; -} const net = require('net'); diff --git a/test/async-hooks/test-graph.tls-write.js b/test/async-hooks/test-graph.tls-write.js index 77a97bedbc54..6bcac46cf87e 100644 --- a/test/async-hooks/test-graph.tls-write.js +++ b/test/async-hooks/test-graph.tls-write.js @@ -5,15 +5,11 @@ const initHooks = require('./init-hooks'); const verifyGraph = require('./verify-graph'); const fs = require('fs'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('IPv6 support required'); - return; -} const tls = require('tls'); const hooks = initHooks(); diff --git a/test/async-hooks/test-tcpwrap.js b/test/async-hooks/test-tcpwrap.js index 0dce8c7d9f0b..e69d79d3fa1f 100644 --- a/test/async-hooks/test-tcpwrap.js +++ b/test/async-hooks/test-tcpwrap.js @@ -7,10 +7,8 @@ const tick = require('./tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('IPv6 support required'); - return; -} const net = require('net'); diff --git a/test/async-hooks/test-tlswrap.js b/test/async-hooks/test-tlswrap.js index 47cca62c182a..6e7942a1bf91 100644 --- a/test/async-hooks/test-tlswrap.js +++ b/test/async-hooks/test-tlswrap.js @@ -7,10 +7,8 @@ const initHooks = require('./init-hooks'); const fs = require('fs'); const { checkInvocations } = require('./hook-checks'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const hooks = initHooks(); diff --git a/test/async-hooks/test-ttywrap.writestream.js b/test/async-hooks/test-ttywrap.writestream.js index b1cc768877d9..2345cac8586e 100644 --- a/test/async-hooks/test-ttywrap.writestream.js +++ b/test/async-hooks/test-ttywrap.writestream.js @@ -8,7 +8,8 @@ const { checkInvocations } = require('./hook-checks'); const tty_fd = common.getTTYfd(); if (tty_fd < 0) - return common.skip('no valid TTY fd available'); + common.skip('no valid TTY fd available'); + const ttyStream = (() => { try { return new (require('tty').WriteStream)(tty_fd); @@ -17,7 +18,7 @@ const ttyStream = (() => { } })(); if (ttyStream === null) - return common.skip('no valid TTY fd available'); + common.skip('no valid TTY fd available'); const hooks = initHooks(); hooks.enable(); diff --git a/test/async-hooks/test-writewrap.js b/test/async-hooks/test-writewrap.js index 6253b09d4adc..b842236c9dab 100644 --- a/test/async-hooks/test-writewrap.js +++ b/test/async-hooks/test-writewrap.js @@ -6,10 +6,8 @@ const initHooks = require('./init-hooks'); const fs = require('fs'); const { checkInvocations } = require('./hook-checks'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const hooks = initHooks(); diff --git a/test/common/README.md b/test/common/README.md index 0502cacaf601..07f9bc6583d9 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -264,6 +264,11 @@ Path to the test sock. Port tests are running on. +### printSkipMessage(msg) +* `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Logs '1..0 # Skipped: ' + `msg` + ### refreshTmpDir * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) @@ -285,7 +290,7 @@ Path to the 'root' directory. either `/` or `c:\\` (windows) ### skip(msg) * `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) -Logs '1..0 # Skipped: ' + `msg` +Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`. ### spawnPwd(options) * `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) diff --git a/test/common/index.js b/test/common/index.js index e3e53f4574a9..3caed88e2031 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -570,10 +570,15 @@ exports.mustNotCall = function(msg) { }; }; -exports.skip = function(msg) { +exports.printSkipMessage = function(msg) { console.log(`1..0 # Skipped: ${msg}`); }; +exports.skip = function(msg) { + exports.printSkipMessage(msg); + process.exit(0); +}; + // A stream to push an array into a REPL function ArrayStream() { this.run = function(data) { @@ -717,7 +722,6 @@ exports.expectsError = function expectsError({code, type, message}) { exports.skipIfInspectorDisabled = function skipIfInspectorDisabled() { if (process.config.variables.v8_enable_inspector === 0) { exports.skip('V8 inspector is disabled'); - process.exit(0); } }; diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 3af5a5409db1..53dd0f22441d 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -9,7 +9,7 @@ const path = require('path'); 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 processIncludes = require('../../tools/doc/preprocess.js'); diff --git a/test/doctool/test-doctool-json.js b/test/doctool/test-doctool-json.js index 346a7f331e9d..d8885b26d65c 100644 --- a/test/doctool/test-doctool-json.js +++ b/test/doctool/test-doctool-json.js @@ -9,7 +9,7 @@ const path = require('path'); 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 json = require('../../tools/doc/json.js'); diff --git a/test/fixtures/tls-connect.js b/test/fixtures/tls-connect.js index a434a0316d6f..4670e5aa1ed8 100644 --- a/test/fixtures/tls-connect.js +++ b/test/fixtures/tls-connect.js @@ -8,10 +8,9 @@ const fs = require('fs'); const join = require('path').join; // Check if Node was compiled --without-ssl and if so exit early // as the require of tls will otherwise throw an Error. -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(0); -} + const tls = require('tls'); const util = require('util'); diff --git a/test/inspector/test-inspector-ip-detection.js b/test/inspector/test-inspector-ip-detection.js index ad51c631645e..be5e34a977eb 100644 --- a/test/inspector/test-inspector-ip-detection.js +++ b/test/inspector/test-inspector-ip-detection.js @@ -9,10 +9,8 @@ const os = require('os'); const ip = pickIPv4Address(); -if (!ip) { +if (!ip) common.skip('No IP address found'); - return; -} function checkListResponse(instance, err, response) { assert.ifError(err); @@ -29,7 +27,7 @@ function checkListResponse(instance, err, response) { function checkError(instance, error) { // Some OSes will not allow us to connect if (error.code === 'EHOSTUNREACH') { - common.skip('Unable to connect to self'); + common.printSkipMessage('Unable to connect to self'); } else { throw error; } diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 79e139248454..a7567d6e16cf 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -35,10 +35,8 @@ const messages = [ Buffer.from('Fourth message to send') ]; -if (common.inFreeBSDJail) { +if (common.inFreeBSDJail) common.skip('in a FreeBSD jail'); - return; -} let bindAddress = null; diff --git a/test/internet/test-dgram-multicast-multi-process.js b/test/internet/test-dgram-multicast-multi-process.js index dac8abd6a7a4..d970cfc27274 100644 --- a/test/internet/test-dgram-multicast-multi-process.js +++ b/test/internet/test-dgram-multicast-multi-process.js @@ -38,10 +38,8 @@ let listening, sendSocket, done, timer, dead; // Skip test in FreeBSD jails. -if (common.inFreeBSDJail) { +if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); - return; -} function launchChildProcess() { const worker = fork(__filename, ['child']); diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js index 31f9df5eab8a..edaba545f9a5 100644 --- a/test/internet/test-dns-ipv6.js +++ b/test/internet/test-dns-ipv6.js @@ -8,10 +8,8 @@ const isIPv6 = net.isIPv6; let running = false; const queue = []; -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('this test, no IPv6 support'); - return; -} function TEST(f) { function next() { diff --git a/test/internet/test-http-https-default-ports.js b/test/internet/test-http-https-default-ports.js index b0eb682519ba..567b045dc6ea 100644 --- a/test/internet/test-http-https-default-ports.js +++ b/test/internet/test-http-https-default-ports.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const http = require('http'); diff --git a/test/internet/test-tls-add-ca-cert.js b/test/internet/test-tls-add-ca-cert.js index 1283230e911b..299e01405d7d 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 f57b897099fc..ab5aa3950938 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 fda9712156cb..73ee91d3b2ea 100644 --- a/test/internet/test-tls-reuse-host-from-socket.js +++ b/test/internet/test-tls-reuse-host-from-socket.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); diff --git a/test/known_issues/test-cwd-enoent-file.js b/test/known_issues/test-cwd-enoent-file.js index 9431919804af..b2f59cbca7d4 100644 --- a/test/known_issues/test-cwd-enoent-file.js +++ b/test/known_issues/test-cwd-enoent-file.js @@ -9,7 +9,6 @@ if (common.isSunOS || common.isWindows || common.isAix) { // The current working directory cannot be removed on these platforms. // Change this to common.skip() when this is no longer a known issue test. assert.fail('cannot rmdir current working directory'); - return; } const cp = require('child_process'); diff --git a/test/parallel/test-async-wrap-GH13045.js b/test/parallel/test-async-wrap-GH13045.js index 41c6f0cd19eb..1382de806081 100644 --- a/test/parallel/test-async-wrap-GH13045.js +++ b/test/parallel/test-async-wrap-GH13045.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} // Refs: https://github.com/nodejs/node/issues/13045 // An HTTP Agent reuses a TLSSocket, and makes a failed call to `asyncReset`. diff --git a/test/parallel/test-async-wrap-uncaughtexception.js b/test/parallel/test-async-wrap-uncaughtexception.js index f5f81f100529..9427e2fb787a 100644 --- a/test/parallel/test-async-wrap-uncaughtexception.js +++ b/test/parallel/test-async-wrap-uncaughtexception.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const async_hooks = require('async_hooks'); const call_log = [0, 0, 0, 0]; // [before, callback, exception, after]; diff --git a/test/parallel/test-benchmark-crypto.js b/test/parallel/test-benchmark-crypto.js index 55ab98ee2199..e7f99ad29c05 100644 --- a/test/parallel/test-benchmark-crypto.js +++ b/test/parallel/test-benchmark-crypto.js @@ -2,15 +2,11 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (common.hasFipsCrypto) { +if (common.hasFipsCrypto) common.skip('some benchmarks are FIPS-incompatible'); - return; -} // Minimal test for crypto benchmarks. This makes sure the benchmarks aren't // horribly broken but nothing more than that. diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 8edbca3c6efe..2a69d967a51a 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -917,7 +917,7 @@ if (common.hasCrypto) { crypto.createHash('sha1').update(b2).digest('hex') ); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } const ps = Buffer.poolSize; diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index be351cced04f..b833e8e5dfdd 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -32,10 +32,8 @@ const dgram = require('dgram'); const fork = require('child_process').fork; const assert = require('assert'); -if (common.isWindows) { +if (common.isWindows) common.skip('Sending dgram sockets to child processes is not supported'); - return; -} if (process.argv[2] === 'child') { let childServer; diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js index 0c39813cf62c..8622dafbe10a 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../common'); if (process.config.variables.node_without_node_options) - return common.skip('missing NODE_OPTIONS support'); + common.skip('missing NODE_OPTIONS support'); // Test options specified by env variable. diff --git a/test/parallel/test-cluster-bind-privileged-port.js b/test/parallel/test-cluster-bind-privileged-port.js index e726618ffbd3..6679cad2b7ce 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -25,15 +25,11 @@ 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; -} 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 9e0ed3dfb9c7..955f0649975c 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -29,10 +29,8 @@ const cluster = require('cluster'); const dgram = require('dgram'); -if (common.isWindows) { +if (common.isWindows) common.skip('dgram clustering is currently not supported on Windows.'); - return; -} if (cluster.isMaster) master(); diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js index 9ae903b6eaf2..5b3743757211 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -29,10 +29,8 @@ const dgram = require('dgram'); const assert = require('assert'); -if (common.isWindows) { +if (common.isWindows) common.skip('dgram clustering is currently not supported on Windows.'); - return; -} if (cluster.isMaster) master(); diff --git a/test/parallel/test-cluster-dgram-reuse.js b/test/parallel/test-cluster-dgram-reuse.js index 1472dcc5238a..7d76a3426874 100644 --- a/test/parallel/test-cluster-dgram-reuse.js +++ b/test/parallel/test-cluster-dgram-reuse.js @@ -4,10 +4,8 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (common.isWindows) { +if (common.isWindows) common.skip('dgram clustering is currently not supported on windows.'); - return; -} if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((code) => { diff --git a/test/parallel/test-cluster-disconnect-race.js b/test/parallel/test-cluster-disconnect-race.js index 7bb66ced3663..3afed91c8158 100644 --- a/test/parallel/test-cluster-disconnect-race.js +++ b/test/parallel/test-cluster-disconnect-race.js @@ -8,10 +8,8 @@ const assert = require('assert'); const net = require('net'); const cluster = require('cluster'); -if (common.isWindows) { +if (common.isWindows) common.skip('This test does not apply to Windows.'); - return; -} cluster.schedulingPolicy = cluster.SCHED_NONE; diff --git a/test/parallel/test-cluster-disconnect-unshared-udp.js b/test/parallel/test-cluster-disconnect-unshared-udp.js index 653ab6cc9c3b..d34ce11b0285 100644 --- a/test/parallel/test-cluster-disconnect-unshared-udp.js +++ b/test/parallel/test-cluster-disconnect-unshared-udp.js @@ -23,10 +23,8 @@ const common = require('../common'); -if (common.isWindows) { +if (common.isWindows) common.skip('on windows, because clustered dgram is ENOTSUP'); - return; -} const cluster = require('cluster'); const dgram = require('dgram'); diff --git a/test/parallel/test-cluster-http-pipe.js b/test/parallel/test-cluster-http-pipe.js index 93b457fd8080..2ae7433d60b1 100644 --- a/test/parallel/test-cluster-http-pipe.js +++ b/test/parallel/test-cluster-http-pipe.js @@ -29,7 +29,6 @@ const http = require('http'); if (common.isWindows) { common.skip( 'It is not possible to send pipe handles over the IPC pipe on Windows'); - return; } if (cluster.isMaster) { 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 419307d52ccf..f89bea585f2f 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -25,15 +25,11 @@ 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; -} 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 2d5370ba3eac..c26c161570ec 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; @@ -341,12 +340,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 e92f70035bde..5bb254057b5a 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -26,10 +26,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index 831fed0f14e9..1438b4a3b6c4 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 dfb68a7f9208..0104341653f7 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 31a79d8bf175..7fbf6f968570 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 903862d6c8ed..87153f012123 100644 --- a/test/parallel/test-crypto-deprecated.js +++ b/test/parallel/test-crypto-deprecated.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -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-dh-odd-key.js b/test/parallel/test-crypto-dh-odd-key.js index 94f3d382655a..20afc178dc66 100644 --- a/test/parallel/test-crypto-dh-odd-key.js +++ b/test/parallel/test-crypto-dh-odd-key.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); function test() { diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 91a066d1bd22..82a07026eaf3 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR; diff --git a/test/parallel/test-crypto-domain.js b/test/parallel/test-crypto-domain.js index b41b57e3a258..4924c21177b1 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -24,10 +24,9 @@ const common = require('../common'); const assert = require('assert'); const domain = require('domain'); -if (!common.hasCrypto) { +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 23ca991500d7..4e84f2407c67 100644 --- a/test/parallel/test-crypto-domains.js +++ b/test/parallel/test-crypto-domains.js @@ -26,10 +26,9 @@ const assert = require('assert'); const d = domain.create(); const expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes']; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); d.on('error', common.mustCall(function(e) { diff --git a/test/parallel/test-crypto-ecb.js b/test/parallel/test-crypto-ecb.js index d69cb9ea0d27..f444a3711e97 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -23,14 +23,12 @@ 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 crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-engine.js b/test/parallel/test-crypto-engine.js index 8452087cc50c..b2fe154d3c22 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 a83170c49ae4..0c71af412440 100644 --- a/test/parallel/test-crypto-fips.js +++ b/test/parallel/test-crypto-fips.js @@ -4,10 +4,8 @@ const assert = require('assert'); const spawnSync = require('child_process').spawnSync; const path = require('path'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const FIPS_ENABLED = 1; const FIPS_DISABLED = 0; diff --git a/test/parallel/test-crypto-from-binary.js b/test/parallel/test-crypto-from-binary.js index 785fff4388b4..9a4df572b84c 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -27,10 +27,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 ee152dc028e2..0a240a2abbc7 100644 --- a/test/parallel/test-crypto-hash-stream-pipe.js +++ b/test/parallel/test-crypto-hash-stream-pipe.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 28f0f2f30349..3fbc8731fcb8 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -4,10 +4,9 @@ const assert = require('assert'); const fs = require('fs'); const path = require('path'); -if (!common.hasCrypto) { +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 94c5cefa058d..d14a89a6fd21 100644 --- a/test/parallel/test-crypto-hmac.js +++ b/test/parallel/test-crypto-hmac.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 9008ebc5f910..f12243b9f4d1 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 3e17a3fc3e5f..77fb89e1e832 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 095f1ba407ca..b00f464cca74 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 9ed719c1f683..ceb311e89863 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.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 crypto = require('crypto'); // diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index c60e3b2681e1..eec6f00b5426 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js index daa818705b84..d506f69ca999 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -3,10 +3,9 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const constants = require('crypto').constants; const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 2a64b6d07248..ca38d8889547 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -5,10 +5,9 @@ const fs = require('fs'); const path = require('path'); const exec = require('child_process').exec; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); // Test certificates @@ -245,10 +244,8 @@ const modSize = 1024; // RSA-PSS Sign test by verifying with 'openssl dgst -verify' { - if (!common.opensslCli) { + if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; - } const pubfile = path.join(common.fixturesDir, 'keys/rsa_public_2048.pem'); const privfile = path.join(common.fixturesDir, 'keys/rsa_private_2048.pem'); diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index e40b36847b56..bc2a400ab900 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -25,10 +25,9 @@ const assert = require('assert'); const stream = require('stream'); const util = require('util'); -if (!common.hasCrypto) { +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 1b3622fe01ee..4bd70f388d87 100644 --- a/test/parallel/test-crypto-verify-failure.js +++ b/test/parallel/test-crypto-verify-failure.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); const tls = require('tls'); diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index a7638d3cd899..d45de9979b96 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-cwd-enoent-preload.js b/test/parallel/test-cwd-enoent-preload.js index 5d44814d2fe4..479c2b5888ff 100644 --- a/test/parallel/test-cwd-enoent-preload.js +++ b/test/parallel/test-cwd-enoent-preload.js @@ -5,10 +5,8 @@ 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) { +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'); diff --git a/test/parallel/test-cwd-enoent-repl.js b/test/parallel/test-cwd-enoent-repl.js index c82083668aab..ac44d9277be6 100644 --- a/test/parallel/test-cwd-enoent-repl.js +++ b/test/parallel/test-cwd-enoent-repl.js @@ -5,10 +5,8 @@ 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) { +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(); diff --git a/test/parallel/test-cwd-enoent.js b/test/parallel/test-cwd-enoent.js index dac23e4084aa..cce3c697eee6 100644 --- a/test/parallel/test-cwd-enoent.js +++ b/test/parallel/test-cwd-enoent.js @@ -5,10 +5,8 @@ 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) { +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(); diff --git a/test/parallel/test-debug-usage.js b/test/parallel/test-debug-usage.js index e01ac8e15b89..481d674bfc81 100644 --- a/test/parallel/test-debug-usage.js +++ b/test/parallel/test-debug-usage.js @@ -3,10 +3,8 @@ const common = require('../common'); const assert = require('assert'); const spawn = require('child_process').spawn; -if (!common.hasCrypto) { +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 d0b5b6023445..93284569a770 100755 --- a/test/parallel/test-dgram-bind-default-address.js +++ b/test/parallel/test-dgram-bind-default-address.js @@ -25,10 +25,8 @@ 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; -} dgram.createSocket('udp4').bind(0, common.mustCall(function() { assert.strictEqual(typeof this.address().port, 'number'); @@ -39,7 +37,7 @@ dgram.createSocket('udp4').bind(0, common.mustCall(function() { })); if (!common.hasIPv6) { - common.skip('udp6 part of test, because no IPv6 support'); + common.printSkipMessage('udp6 part of test, because no IPv6 support'); return; } diff --git a/test/parallel/test-dgram-cluster-close-during-bind.js b/test/parallel/test-dgram-cluster-close-during-bind.js index ec62693abfb6..882c33a09888 100644 --- a/test/parallel/test-dgram-cluster-close-during-bind.js +++ b/test/parallel/test-dgram-cluster-close-during-bind.js @@ -4,10 +4,8 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (common.isWindows) { +if (common.isWindows) common.skip('dgram clustering is currently not supported on windows.'); - return; -} if (cluster.isMaster) { cluster.fork(); diff --git a/test/parallel/test-dgram-send-empty-array.js b/test/parallel/test-dgram-send-empty-array.js index 1bfcacd9a404..e6a391de945d 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 16c14909f62d..98a092325cef 100644 --- a/test/parallel/test-dgram-send-empty-buffer.js +++ b/test/parallel/test-dgram-send-empty-buffer.js @@ -23,10 +23,8 @@ const common = require('../common'); const assert = require('assert'); -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} const dgram = require('dgram'); diff --git a/test/parallel/test-dgram-send-empty-packet.js b/test/parallel/test-dgram-send-empty-packet.js index 131e808aec0b..94fd987dc168 100644 --- a/test/parallel/test-dgram-send-empty-packet.js +++ b/test/parallel/test-dgram-send-empty-packet.js @@ -2,10 +2,8 @@ const common = require('../common'); const assert = require('assert'); -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} const dgram = require('dgram'); diff --git a/test/parallel/test-dgram-udp6-send-default-host.js b/test/parallel/test-dgram-udp6-send-default-host.js index e893f248ecd8..5434dcd15154 100644 --- a/test/parallel/test-dgram-udp6-send-default-host.js +++ b/test/parallel/test-dgram-udp6-send-default-host.js @@ -4,10 +4,8 @@ const common = require('../common'); const assert = require('assert'); const dgram = require('dgram'); -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('no IPv6 support'); - return; -} const client = dgram.createSocket('udp6'); diff --git a/test/parallel/test-dh-padding.js b/test/parallel/test-dh-padding.js index 6853533ee4e4..311b9d156ff1 100644 --- a/test/parallel/test-dh-padding.js +++ b/test/parallel/test-dh-padding.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-domain-crypto.js b/test/parallel/test-domain-crypto.js index d0bdbf4720b9..3890a7b4641a 100644 --- a/test/parallel/test-domain-crypto.js +++ b/test/parallel/test-domain-crypto.js @@ -23,10 +23,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} const crypto = require('crypto'); diff --git a/test/parallel/test-dsa-fips-invalid-key.js b/test/parallel/test-dsa-fips-invalid-key.js index b22be9d07792..38f86d315ba0 100644 --- a/test/parallel/test-dsa-fips-invalid-key.js +++ b/test/parallel/test-dsa-fips-invalid-key.js @@ -2,10 +2,8 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasFipsCrypto) { +if (!common.hasFipsCrypto) common.skip('node compiled without FIPS OpenSSL.'); - return; -} 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 b8aa6a2ac871..b5a0b78ad136 100644 --- a/test/parallel/test-fs-long-path.js +++ b/test/parallel/test-fs-long-path.js @@ -25,10 +25,8 @@ const fs = require('fs'); const path = require('path'); const assert = require('assert'); -if (!common.isWindows) { +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); diff --git a/test/parallel/test-fs-read-file-sync-hostname.js b/test/parallel/test-fs-read-file-sync-hostname.js index f7a03e552478..b60f611ed887 100644 --- a/test/parallel/test-fs-read-file-sync-hostname.js +++ b/test/parallel/test-fs-read-file-sync-hostname.js @@ -24,10 +24,8 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -if (!common.isLinux) { +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 diff --git a/test/parallel/test-fs-readdir-ucs2.js b/test/parallel/test-fs-readdir-ucs2.js index 4d5f53abd8ea..02d75a253e21 100644 --- a/test/parallel/test-fs-readdir-ucs2.js +++ b/test/parallel/test-fs-readdir-ucs2.js @@ -5,10 +5,8 @@ const path = require('path'); const fs = require('fs'); const assert = require('assert'); -if (!common.isLinux) { +if (!common.isLinux) common.skip('Test is linux specific.'); - return; -} common.refreshTmpDir(); const filename = '\uD83D\uDC04'; diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js index 208b478c12ab..b0eb39b4c9c0 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -27,10 +27,8 @@ 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; -} 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 f0d1dd9c4086..eb708780bbdf 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -5,10 +5,8 @@ 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 fs = require('fs'); diff --git a/test/parallel/test-fs-readfile-pipe.js b/test/parallel/test-fs-readfile-pipe.js index 10fc6a925af4..6012dd9bab7d 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -25,10 +25,8 @@ 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 fs = require('fs'); diff --git a/test/parallel/test-fs-readfilesync-pipe-large.js b/test/parallel/test-fs-readfilesync-pipe-large.js index 01e41047774c..35533ef987f4 100644 --- a/test/parallel/test-fs-readfilesync-pipe-large.js +++ b/test/parallel/test-fs-readfilesync-pipe-large.js @@ -5,10 +5,8 @@ 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 fs = require('fs'); diff --git a/test/parallel/test-fs-realpath-on-substed-drive.js b/test/parallel/test-fs-realpath-on-substed-drive.js index f8d9e86de5e6..9ace64cf6315 100644 --- a/test/parallel/test-fs-realpath-on-substed-drive.js +++ b/test/parallel/test-fs-realpath-on-substed-drive.js @@ -5,10 +5,9 @@ const assert = require('assert'); const fs = require('fs'); const spawnSync = require('child_process').spawnSync; -if (!common.isWindows) { +if (!common.isWindows) common.skip('Test for Windows only'); - return; -} + let result; // create a subst drive @@ -21,10 +20,8 @@ for (i = 0; i < driveLetters.length; ++i) { if (result.status === 0) break; } -if (i === driveLetters.length) { +if (i === driveLetters.length) common.skip('Cannot create subst drive'); - return; -} // schedule cleanup (and check if all callbacks where called) process.on('exit', function() { diff --git a/test/parallel/test-fs-realpath-pipe.js b/test/parallel/test-fs-realpath-pipe.js index 89bdc08229a9..0f30b07f0a9b 100644 --- a/test/parallel/test-fs-realpath-pipe.js +++ b/test/parallel/test-fs-realpath-pipe.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} const assert = require('assert'); diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 1c9f7a7d90e2..a9ec65168d0c 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -103,7 +103,7 @@ function test_simple_error_callback(cb) { function test_simple_relative_symlink(callback) { console.log('test_simple_relative_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const entry = `${tmpDir}/symlink`; @@ -152,7 +152,7 @@ function test_simple_absolute_symlink(callback) { function test_deep_relative_file_symlink(callback) { console.log('test_deep_relative_file_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -182,7 +182,7 @@ function test_deep_relative_file_symlink(callback) { function test_deep_relative_dir_symlink(callback) { console.log('test_deep_relative_dir_symlink'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const expected = path.join(common.fixturesDir, 'cycles', 'folder'); @@ -210,7 +210,7 @@ function test_deep_relative_dir_symlink(callback) { function test_cyclic_link_protection(callback) { console.log('test_cyclic_link_protection'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const entry = path.join(tmpDir, '/cycles/realpath-3a'); @@ -237,7 +237,7 @@ function test_cyclic_link_protection(callback) { function test_cyclic_link_overprotection(callback) { console.log('test_cyclic_link_overprotection'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } const cycles = `${tmpDir}/cycles`; @@ -258,7 +258,7 @@ function test_cyclic_link_overprotection(callback) { function test_relative_input_cwd(callback) { console.log('test_relative_input_cwd'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -297,7 +297,7 @@ function test_deep_symlink_mix(callback) { if (common.isWindows) { // This one is a mix of files and directories, and it's quite tricky // to get the file/dir links sorted out correctly. - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } @@ -384,7 +384,7 @@ assertEqualPath( function test_up_multiple(cb) { console.error('test_up_multiple'); if (skipSymlinks) { - common.skip('symlink test (no privs)'); + common.printSkipMessage('symlink test (no privs)'); return runNextTest(); } function cleanup() { diff --git a/test/parallel/test-fs-symlink.js b/test/parallel/test-fs-symlink.js index 2ceb4d10936a..92cae6ffc0a5 100644 --- a/test/parallel/test-fs-symlink.js +++ b/test/parallel/test-fs-symlink.js @@ -28,10 +28,8 @@ const fs = require('fs'); let linkTime; let fileTime; -if (!common.canCreateSymLink()) { +if (!common.canCreateSymLink()) common.skip('insufficient privileges'); - return; -} common.refreshTmpDir(); diff --git a/test/parallel/test-fs-watch-encoding.js b/test/parallel/test-fs-watch-encoding.js index 04f5ffaad97a..ac3bd19646bb 100644 --- a/test/parallel/test-fs-watch-encoding.js +++ b/test/parallel/test-fs-watch-encoding.js @@ -18,10 +18,8 @@ const path = require('path'); // 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; -} common.refreshTmpDir(); diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index 5fb13623dff5..8e27abb25176 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 822aab804f03..f6aae676944f 100644 --- a/test/parallel/test-http-chunk-problem.js +++ b/test/parallel/test-http-chunk-problem.js @@ -2,10 +2,8 @@ // 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; -} 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 d53c69c1b0d6..beae62d3998e 100644 --- a/test/parallel/test-http-default-port.js +++ b/test/parallel/test-http-default-port.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const http = require('http'); const https = require('https'); diff --git a/test/parallel/test-http-dns-error.js b/test/parallel/test-http-dns-error.js index 4a724b0b41a0..76634c5a830a 100644 --- a/test/parallel/test-http-dns-error.js +++ b/test/parallel/test-http-dns-error.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const http = require('http'); @@ -57,7 +55,7 @@ function test(mod) { if (common.hasCrypto) { test(https); } else { - common.skip('missing crypto'); + common.printSkipMessage('missing crypto'); } test(http); diff --git a/test/parallel/test-http-full-response.js b/test/parallel/test-http-full-response.js index dc52a5bc2f1b..422134320903 100644 --- a/test/parallel/test-http-full-response.js +++ b/test/parallel/test-http-full-response.js @@ -43,7 +43,7 @@ function runAb(opts, callback) { exec(command, function(err, stdout, stderr) { if (err) { if (/ab|apr/i.test(stderr)) { - common.skip(`problem spawning \`ab\`.\n${stderr}`); + common.printSkipMessage(`problem spawning \`ab\`.\n${stderr}`); process.reallyExit(0); } process.exit(); diff --git a/test/parallel/test-http-invalid-urls.js b/test/parallel/test-http-invalid-urls.js index 65cca822f9b2..039270fe4301 100644 --- a/test/parallel/test-http-invalid-urls.js +++ b/test/parallel/test-http-invalid-urls.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const http = require('http'); diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index 35f2c15f8d91..63d4ea446772 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -24,10 +24,8 @@ const common = require('../common'); const http = require('http'); const assert = require('assert'); -if (!common.hasMultiLocalhost()) { +if (!common.hasMultiLocalhost()) common.skip('platform-specific test.'); - return; -} const server = http.createServer(function(req, res) { console.log(`Connect from: ${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 5c625cf4475f..b1ddba31e607 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const url = require('url'); diff --git a/test/parallel/test-https-agent-constructor.js b/test/parallel/test-https-agent-constructor.js index fe77381c858c..29bb9eaa9806 100644 --- a/test/parallel/test-https-agent-constructor.js +++ b/test/parallel/test-https-agent-constructor.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-agent-create-connection.js b/test/parallel/test-https-agent-create-connection.js index a1f0c4ace4ca..267030232dcf 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 0331cd4e283c..6fb06c56e21f 100644 --- a/test/parallel/test-https-agent-disable-session-reuse.js +++ b/test/parallel/test-https-agent-disable-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 TOTAL_REQS = 2; diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index 9b4f29602b79..0986f8472de8 100644 --- a/test/parallel/test-https-agent-getname.js +++ b/test/parallel/test-https-agent-getname.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-agent-secure-protocol.js b/test/parallel/test-https-agent-secure-protocol.js index c11d9f8ca870..396332858f97 100644 --- a/test/parallel/test-https-agent-secure-protocol.js +++ b/test/parallel/test-https-agent-secure-protocol.js @@ -2,10 +2,8 @@ const assert = require('assert'); 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-servername.js b/test/parallel/test-https-agent-servername.js index 8562d021c997..625fa45c7c1d 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 acead806ed06..567ed809e646 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 a9977d8ce9a9..f850144eaab1 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 fb7bee16ec00..d48defbcbb14 100644 --- a/test/parallel/test-https-agent-sni.js +++ b/test/parallel/test-https-agent-sni.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -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-sockets-leak.js b/test/parallel/test-https-agent-sockets-leak.js index bc86b9c24128..2fc477c0b33c 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 add9913358fe..de939132f994 100644 --- a/test/parallel/test-https-agent.js +++ b/test/parallel/test-https-agent.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-argument-of-creating.js b/test/parallel/test-https-argument-of-creating.js index 87d934316f88..5a4150eb1cca 100644 --- a/test/parallel/test-https-argument-of-creating.js +++ b/test/parallel/test-https-argument-of-creating.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-byteswritten.js b/test/parallel/test-https-byteswritten.js index cad824c5fed5..2bbd427363c4 100644 --- a/test/parallel/test-https-byteswritten.js +++ b/test/parallel/test-https-byteswritten.js @@ -24,10 +24,9 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -if (!common.hasCrypto) { +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 a70af2c42946..5806df25dbfc 100644 --- a/test/parallel/test-https-client-checkServerIdentity.js +++ b/test/parallel/test-https-client-checkServerIdentity.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-client-get-url.js b/test/parallel/test-https-client-get-url.js index 05a3824637a3..81c67ec305c5 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -26,10 +26,9 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); -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-client-reject.js b/test/parallel/test-https-client-reject.js index 95c3ca1a3b8a..129b218081a4 100644 --- a/test/parallel/test-https-client-reject.js +++ b/test/parallel/test-https-client-reject.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-client-resume.js b/test/parallel/test-https-client-resume.js index 95e1da56d0c4..1f85a0bb44cd 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -26,10 +26,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-close.js b/test/parallel/test-https-close.js index 4c4dea577c00..996b6ab02065 100644 --- a/test/parallel/test-https-close.js +++ b/test/parallel/test-https-close.js @@ -2,10 +2,9 @@ const common = require('../common'); const fs = require('fs'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 e7f41ce861cb..76a12ef5d5dc 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 168be7c2d984..99050540b1de 100644 --- a/test/parallel/test-https-connecting-to-http.js +++ b/test/parallel/test-https-connecting-to-http.js @@ -25,10 +25,9 @@ const common = require('../common'); const http = require('http'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const server = http.createServer(common.mustNotCall()); diff --git a/test/parallel/test-https-drain.js b/test/parallel/test-https-drain.js index ed0a11ae832a..e6bd9f1b673d 100644 --- a/test/parallel/test-https-drain.js +++ b/test/parallel/test-https-drain.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js index 3300dabb54aa..b85059ab3647 100644 --- a/test/parallel/test-https-eof-for-eom.js +++ b/test/parallel/test-https-eof-for-eom.js @@ -31,10 +31,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js index 9900cf7a643c..dcc53456567d 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} const assert = require('assert'); const join = require('path').join; @@ -33,10 +31,9 @@ const join = require('path').join; const fs = require('fs'); const spawn = require('child_process').spawn; -if (!common.hasCrypto) { +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 adb8952871ca..64fc8e15b693 100644 --- a/test/parallel/test-https-host-headers.js +++ b/test/parallel/test-https-host-headers.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -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-localaddress-bind-error.js b/test/parallel/test-https-localaddress-bind-error.js index 0b046cfa85c5..1804e4f1e474 100644 --- a/test/parallel/test-https-localaddress-bind-error.js +++ b/test/parallel/test-https-localaddress-bind-error.js @@ -24,10 +24,9 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const options = { diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js index bcd1d6fdbd71..20116eb7cf1b 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -24,16 +24,13 @@ 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 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 9d7a1d888cef..987a811e1011 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -24,10 +24,9 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); -if (!common.hasCrypto) { +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 0abd74be6172..27dbbc558709 100644 --- a/test/parallel/test-https-req-split.js +++ b/test/parallel/test-https-req-split.js @@ -24,10 +24,9 @@ const common = require('../common'); // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-resume-after-renew.js b/test/parallel/test-https-resume-after-renew.js index c9e208ab9714..eb3192303713 100644 --- a/test/parallel/test-https-resume-after-renew.js +++ b/test/parallel/test-https-resume-after-renew.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const fs = require('fs'); const https = require('https'); diff --git a/test/parallel/test-https-server-keep-alive-timeout.js b/test/parallel/test-https-server-keep-alive-timeout.js index d1e9ed67889a..01d0fa6078b0 100644 --- a/test/parallel/test-https-server-keep-alive-timeout.js +++ b/test/parallel/test-https-server-keep-alive-timeout.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js index 3ad2806f6afa..b79d1b943f35 100644 --- a/test/parallel/test-https-simple.js +++ b/test/parallel/test-https-simple.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-socket-options.js b/test/parallel/test-https-socket-options.js index d6f6aaae7afd..da99c6e36625 100644 --- a/test/parallel/test-https-socket-options.js +++ b/test/parallel/test-https-socket-options.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const fs = require('fs'); diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index f28164a322a8..9bf574c732cd 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -26,10 +26,9 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); -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-timeout-server-2.js b/test/parallel/test-https-timeout-server-2.js index 08144f108b2a..73c713a48c45 100644 --- a/test/parallel/test-https-timeout-server-2.js +++ b/test/parallel/test-https-timeout-server-2.js @@ -24,10 +24,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js index 7d33e552115c..17218ba8055f 100644 --- a/test/parallel/test-https-timeout-server.js +++ b/test/parallel/test-https-timeout-server.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-timeout.js b/test/parallel/test-https-timeout.js index e75a8566e429..ad1fcb3ed232 100644 --- a/test/parallel/test-https-timeout.js +++ b/test/parallel/test-https-timeout.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const fs = require('fs'); diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js index d15efc9abce3..dcefcca104ef 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const https = require('https'); diff --git a/test/parallel/test-https-unix-socket-self-signed.js b/test/parallel/test-https-unix-socket-self-signed.js index f503b84591ca..df6773f83906 100644 --- a/test/parallel/test-https-unix-socket-self-signed.js +++ b/test/parallel/test-https-unix-socket-self-signed.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} common.refreshTmpDir(); diff --git a/test/parallel/test-icu-data-dir.js b/test/parallel/test-icu-data-dir.js index 5619d934020a..eb9b07e3a492 100644 --- a/test/parallel/test-icu-data-dir.js +++ b/test/parallel/test-icu-data-dir.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!(common.hasIntl && common.hasSmallICU)) { +if (!(common.hasIntl && common.hasSmallICU)) common.skip('missing Intl'); - return; -} + const assert = require('assert'); const { spawnSync } = require('child_process'); diff --git a/test/parallel/test-icu-punycode.js b/test/parallel/test-icu-punycode.js index 9488568267a1..7abcae461774 100644 --- a/test/parallel/test-icu-punycode.js +++ b/test/parallel/test-icu-punycode.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const icu = process.binding('icu'); const assert = require('assert'); diff --git a/test/parallel/test-icu-stringwidth.js b/test/parallel/test-icu-stringwidth.js index 7c8c2e948e0e..3c8021049c34 100644 --- a/test/parallel/test-icu-stringwidth.js +++ b/test/parallel/test-icu-stringwidth.js @@ -2,10 +2,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const assert = require('assert'); const readline = require('internal/readline'); diff --git a/test/parallel/test-icu-transcode.js b/test/parallel/test-icu-transcode.js index 1c77427b1545..d7794c30b7ac 100644 --- a/test/parallel/test-icu-transcode.js +++ b/test/parallel/test-icu-transcode.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const buffer = require('buffer'); const assert = require('assert'); diff --git a/test/parallel/test-intl-v8BreakIterator.js b/test/parallel/test-intl-v8BreakIterator.js index 70f0f782bbc7..6e9c9dbe3a1b 100644 --- a/test/parallel/test-intl-v8BreakIterator.js +++ b/test/parallel/test-intl-v8BreakIterator.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl || Intl.v8BreakIterator === undefined) { - return common.skip('missing Intl'); -} +if (!common.hasIntl || Intl.v8BreakIterator === undefined) + common.skip('missing Intl'); const assert = require('assert'); const warning = 'Intl.v8BreakIterator is deprecated and will be removed soon.'; diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js index 1e061d8f51de..ff9569774d0d 100644 --- a/test/parallel/test-intl.js +++ b/test/parallel/test-intl.js @@ -52,7 +52,6 @@ if (!common.hasIntl) { `"Intl" object is NOT present but v8_enable_i18n_support is ${enablei18n}`; assert.strictEqual(enablei18n, 0, erMsg); common.skip('Intl tests because Intl object not present.'); - } else { const erMsg = `"Intl" object is present but v8_enable_i18n_support is ${ @@ -72,7 +71,7 @@ if (!common.hasIntl) { // If list is specified and doesn't contain 'en' then return. if (process.config.variables.icu_locales && !haveLocale('en')) { - common.skip( + common.printSkipMessage( 'detailed Intl tests because English is not listed as supported.'); // Smoke test. Does it format anything, or fail? console.log(`Date(0) formatted to: ${dtf.format(date0)}`); diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index 688083f2a893..644948e60049 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -28,10 +28,8 @@ const cluster = require('cluster'); console.error('Cluster listen fd test', process.argv[2] || 'runner'); -if (common.isWindows) { +if (common.isWindows) common.skip('This test is disabled on windows.'); - return; -} // Process relationship is: // diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index f3f33055ac7d..737154420a2b 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -26,10 +26,8 @@ const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) { +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-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js index 8a40cce56bce..983eee7427ad 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -26,10 +26,8 @@ const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) { +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-listen-fd-server.js b/test/parallel/test-listen-fd-server.js index 3d238a8019a0..ef616f95812a 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -25,10 +25,8 @@ const assert = require('assert'); const http = require('http'); const net = require('net'); -if (common.isWindows) { +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 a04022c6564b..b5e04a9c622d 100644 --- a/test/parallel/test-module-circular-symlinks.js +++ b/test/parallel/test-module-circular-symlinks.js @@ -50,7 +50,6 @@ try { } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('insufficient privileges for symlinks'); - return; } fs.writeFileSync(path.join(tmpDir, 'index.js'), diff --git a/test/parallel/test-module-symlinked-peer-modules.js b/test/parallel/test-module-symlinked-peer-modules.js index 83aca75ed197..5fe3169ee873 100644 --- a/test/parallel/test-module-symlinked-peer-modules.js +++ b/test/parallel/test-module-symlinked-peer-modules.js @@ -46,7 +46,6 @@ try { } catch (err) { if (err.code !== 'EPERM') throw err; common.skip('insufficient privileges for symlinks'); - return; } fs.writeFileSync(path.join(moduleA, 'package.json'), diff --git a/test/parallel/test-net-access-byteswritten.js b/test/parallel/test-net-access-byteswritten.js index 5b734e7c6dc8..c928ab27c6d1 100644 --- a/test/parallel/test-net-access-byteswritten.js +++ b/test/parallel/test-net-access-byteswritten.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const net = require('net'); const tls = require('tls'); diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index 9e3859f84314..3cb8cf81ab9c 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -5,10 +5,8 @@ const net = require('net'); const path = require('path'); const Pipe = process.binding('pipe_wrap').Pipe; -if (common.isWindows) { +if (common.isWindows) common.skip('Does not support wrapping sockets with fd on Windows'); - return; -} common.refreshTmpDir(); diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index 6ac6c29e10fd..f0ef7198dc10 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -24,10 +24,8 @@ const common = require('../common'); const assert = require('assert'); const net = require('net'); -if (!common.hasIPv6) { +if (!common.hasIPv6) common.skip('no IPv6 support'); - return; -} const hosts = common.localIPv6Hosts; let hostIdx = 0; @@ -81,8 +79,8 @@ function tryConnect() { if (host) tryConnect(); else { - common.skip('no IPv6 localhost support'); server.close(); + common.skip('no IPv6 localhost support'); } return; } diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index 19749bde9552..03f3b25916df 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -4,10 +4,8 @@ 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; -} let conns = 0; const clientLocalPorts = []; diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index 75e2c92d5a79..1faa698b15fc 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const path = require('path'); const spawn = require('child_process').spawn; diff --git a/test/parallel/test-openssl-ca-options.js b/test/parallel/test-openssl-ca-options.js index 144a7dfe3d00..f8f777e26825 100644 --- a/test/parallel/test-openssl-ca-options.js +++ b/test/parallel/test-openssl-ca-options.js @@ -2,10 +2,9 @@ // This test checks the usage of --use-bundled-ca and --use-openssl-ca arguments // to verify that both are not used at the same time. const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const os = require('os'); const childProcess = require('child_process'); diff --git a/test/parallel/test-pipe-writev.js b/test/parallel/test-pipe-writev.js index 6440b5f62376..60daeb636322 100644 --- a/test/parallel/test-pipe-writev.js +++ b/test/parallel/test-pipe-writev.js @@ -4,10 +4,8 @@ const common = require('../common'); const assert = require('assert'); const net = require('net'); -if (common.isWindows) { +if (common.isWindows) common.skip('Unix-specific test'); - return; -} common.refreshTmpDir(); diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index 9d24fbb3652f..edf6f5388fa6 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -6,10 +6,8 @@ const path = require('path'); const childProcess = require('child_process'); // Refs: https://github.com/nodejs/node/pull/2253 -if (common.isSunOS) { +if (common.isSunOS) common.skip('unreliable on SunOS'); - return; -} const nodeBinary = process.argv[0]; diff --git a/test/parallel/test-process-execpath.js b/test/parallel/test-process-execpath.js index 5ac8a3f2238a..51ae592d9f74 100644 --- a/test/parallel/test-process-execpath.js +++ b/test/parallel/test-process-execpath.js @@ -7,10 +7,8 @@ const fs = require('fs'); assert.strictEqual(process.execPath, fs.realpathSync(process.execPath)); -if (common.isWindows) { +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. diff --git a/test/parallel/test-process-getgroups.js b/test/parallel/test-process-getgroups.js index 952e0d95ef9d..3479cf7028b2 100644 --- a/test/parallel/test-process-getgroups.js +++ b/test/parallel/test-process-getgroups.js @@ -24,10 +24,9 @@ const common = require('../common'); // Check `id -G` and `process.getgroups()` return same groups. -if (common.isOSX) { +if (common.isOSX) common.skip('Output of `id -G` is unreliable on Darwin.'); - return; -} + const assert = require('assert'); const exec = require('child_process').exec; diff --git a/test/parallel/test-process-remove-all-signal-listeners.js b/test/parallel/test-process-remove-all-signal-listeners.js index 85db45ff88c7..283e4b6f69ae 100644 --- a/test/parallel/test-process-remove-all-signal-listeners.js +++ b/test/parallel/test-process-remove-all-signal-listeners.js @@ -4,11 +4,8 @@ const common = require('../common'); 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 (common.isWindows) + common.skip('Win32 does not support signals.'); if (process.argv[2] !== '--do-test') { // We are the master, fork a child so we can verify it exits with correct diff --git a/test/parallel/test-regress-GH-1531.js b/test/parallel/test-regress-GH-1531.js index 3cf342b869d4..7d1f4a0dbec4 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 cc0285f74756..8747b88c0324 100644 --- a/test/parallel/test-regress-GH-3542.js +++ b/test/parallel/test-regress-GH-3542.js @@ -5,10 +5,8 @@ const fs = require('fs'); const path = require('path'); // This test is only relevant on Windows. -if (!common.isWindows) { +if (!common.isWindows) common.skip('Windows specific test.'); - return; -} function test(p) { const result = fs.realpathSync(p); diff --git a/test/parallel/test-regress-GH-9819.js b/test/parallel/test-regress-GH-9819.js index fb9bb489a081..965f30b27c8e 100644 --- a/test/parallel/test-regress-GH-9819.js +++ b/test/parallel/test-regress-GH-9819.js @@ -3,10 +3,8 @@ const common = require('../common'); const assert = require('assert'); const execFile = require('child_process').execFile; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const setup = 'const enc = { toString: () => { throw new Error("xyz"); } };'; diff --git a/test/parallel/test-repl-history-perm.js b/test/parallel/test-repl-history-perm.js index 1a98999c3be9..259c96fe8aa0 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 030c86be8e8d..1dc093df4f97 100644 --- a/test/parallel/test-repl-sigint-nested-eval.js +++ b/test/parallel/test-repl-sigint-nested-eval.js @@ -7,7 +7,6 @@ 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; } process.env.REPL_TEST_PPID = process.pid; diff --git a/test/parallel/test-repl-sigint.js b/test/parallel/test-repl-sigint.js index 61bc75cc6ffe..5268ee7545ac 100644 --- a/test/parallel/test-repl-sigint.js +++ b/test/parallel/test-repl-sigint.js @@ -7,7 +7,6 @@ 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; } process.env.REPL_TEST_PPID = process.pid; diff --git a/test/parallel/test-require-long-path.js b/test/parallel/test-require-long-path.js index 1a8ce1b7dfd2..0cf61c20af55 100644 --- a/test/parallel/test-require-long-path.js +++ b/test/parallel/test-require-long-path.js @@ -3,10 +3,8 @@ const common = require('../common'); const fs = require('fs'); const path = require('path'); -if (!common.isWindows) { +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); diff --git a/test/parallel/test-require-symlink.js b/test/parallel/test-require-symlink.js index 964f856829ac..d5dc03e49dfc 100644 --- a/test/parallel/test-require-symlink.js +++ b/test/parallel/test-require-symlink.js @@ -27,10 +27,8 @@ if (common.isWindows) { // On Windows, creating symlinks requires admin privileges. // We'll only try to run symlink test if we have enough privileges. exec('whoami /priv', function(err, o) { - if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) { + if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) common.skip('insufficient privileges'); - return; - } test(); }); diff --git a/test/parallel/test-setproctitle.js b/test/parallel/test-setproctitle.js index 672b6f037d8a..f4e25a6e8ce7 100644 --- a/test/parallel/test-setproctitle.js +++ b/test/parallel/test-setproctitle.js @@ -3,9 +3,8 @@ const common = require('../common'); // FIXME add sunos support -if (common.isSunOS) { - return common.skip(`Unsupported platform [${process.platform}]`); -} +if (common.isSunOS) + common.skip(`Unsupported platform [${process.platform}]`); const assert = require('assert'); const exec = require('child_process').exec; @@ -21,9 +20,8 @@ process.title = title; assert.strictEqual(process.title, title); // Test setting the title but do not try to run `ps` on Windows. -if (common.isWindows) { - return common.skip('Windows does not have "ps" utility'); -} +if (common.isWindows) + common.skip('Windows does not have "ps" utility'); // To pass this test on alpine, since Busybox `ps` does not // support `-p` switch, use `ps -o` and `grep` instead. diff --git a/test/parallel/test-signal-handler.js b/test/parallel/test-signal-handler.js index db34a036e456..a5c900695a54 100644 --- a/test/parallel/test-signal-handler.js +++ b/test/parallel/test-signal-handler.js @@ -23,10 +23,8 @@ const common = require('../common'); -if (common.isWindows) { +if (common.isWindows) common.skip('SIGUSR1 and SIGHUP signals are not supported'); - return; -} console.log(`process.pid: ${process.pid}`); diff --git a/test/parallel/test-spawn-cmd-named-pipe.js b/test/parallel/test-spawn-cmd-named-pipe.js index 94a34b640d1e..a8350ba0d41b 100644 --- a/test/parallel/test-spawn-cmd-named-pipe.js +++ b/test/parallel/test-spawn-cmd-named-pipe.js @@ -3,10 +3,8 @@ 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; -} 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 7ac40eeda162..060e41ce0272 100644 --- a/test/parallel/test-tls-0-dns-altname.js +++ b/test/parallel/test-tls-0-dns-altname.js @@ -25,10 +25,9 @@ const assert = require('assert'); // Check getPeerCertificate can properly handle '\0' for fix CVE-2009-2408. -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-alert-handling.js b/test/parallel/test-tls-alert-handling.js index d089ad223b1f..ff776550b29d 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) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -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-alert.js b/test/parallel/test-tls-alert.js index ef79856108ea..21bc3c186789 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -21,16 +21,11 @@ 'use strict'; const common = require('../common'); - -if (!common.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 { 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 3d3453d32fdb..56f925b8a979 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 be499b845034..6b4d2bd9f58c 100644 --- a/test/parallel/test-tls-async-cb-after-socket-end.js +++ b/test/parallel/test-tls-async-cb-after-socket-end.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const path = require('path'); const fs = require('fs'); diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js index a6775c06033a..1d494b4ed3b7 100644 --- a/test/parallel/test-tls-basic-validations.js +++ b/test/parallel/test-tls-basic-validations.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-cert-regression.js b/test/parallel/test-tls-cert-regression.js index 0a128275c387..ab967bb2c6e1 100644 --- a/test/parallel/test-tls-cert-regression.js +++ b/test/parallel/test-tls-cert-regression.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js index e608df5a5a1a..1623e70a2af2 100644 --- a/test/parallel/test-tls-check-server-identity.js +++ b/test/parallel/test-tls-check-server-identity.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const util = require('util'); diff --git a/test/parallel/test-tls-cipher-list.js b/test/parallel/test-tls-cipher-list.js index 912fb6412859..4a39ee9391a7 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 15928a04f678..368bebcbedee 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-client-abort2.js b/test/parallel/test-tls-client-abort2.js index a652edfa8fe3..0a1cd0ee5dcd 100644 --- a/test/parallel/test-tls-client-abort2.js +++ b/test/parallel/test-tls-client-abort2.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 9eefe21e9573..f43fe7fa8479 100644 --- a/test/parallel/test-tls-client-default-ciphers.js +++ b/test/parallel/test-tls-client-default-ciphers.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 8d1f3e90234d..07ef8315996d 100644 --- a/test/parallel/test-tls-client-destroy-soon.js +++ b/test/parallel/test-tls-client-destroy-soon.js @@ -27,10 +27,9 @@ const common = require('../common'); const assert = require('assert'); -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-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js index f3da64ed3766..f946d6e3b1f7 100644 --- a/test/parallel/test-tls-client-getephemeralkeyinfo.js +++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js @@ -2,10 +2,9 @@ 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 fs = require('fs'); diff --git a/test/parallel/test-tls-client-mindhsize.js b/test/parallel/test-tls-client-mindhsize.js index 10fe196b5396..b5c6ee0c33c7 100644 --- a/test/parallel/test-tls-client-mindhsize.js +++ b/test/parallel/test-tls-client-mindhsize.js @@ -2,10 +2,9 @@ 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 fs = require('fs'); diff --git a/test/parallel/test-tls-client-reject.js b/test/parallel/test-tls-client-reject.js index 43cf337e6726..e9f561797651 100644 --- a/test/parallel/test-tls-client-reject.js +++ b/test/parallel/test-tls-client-reject.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-client-resume.js b/test/parallel/test-tls-client-resume.js index aa23f3331b59..68625bc74f52 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -27,10 +27,9 @@ const common = require('../common'); const assert = require('assert'); -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-client-verify.js b/test/parallel/test-tls-client-verify.js index d713be3b0cf1..217185166584 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -21,11 +21,8 @@ 'use strict'; const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-close-error.js b/test/parallel/test-tls-close-error.js index 978f76595089..f9b563f6c6ee 100644 --- a/test/parallel/test-tls-close-error.js +++ b/test/parallel/test-tls-close-error.js @@ -3,10 +3,9 @@ const common = require('../common'); const assert = require('assert'); -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-close-notify.js b/test/parallel/test-tls-close-notify.js index 625909c9c5ed..e6b259c366f9 100644 --- a/test/parallel/test-tls-close-notify.js +++ b/test/parallel/test-tls-close-notify.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-cnnic-whitelist.js b/test/parallel/test-tls-cnnic-whitelist.js index 084531748656..84b71c7e64b1 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 f22831f395a8..afacd5a39027 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 085539161941..cabf24643e2b 100644 --- a/test/parallel/test-tls-connect-given-socket.js +++ b/test/parallel/test-tls-connect-given-socket.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-connect-no-host.js b/test/parallel/test-tls-connect-no-host.js index 2e4bcfbc6d47..f63c821a7f6a 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 836471a0c50f..8a3abe3312ec 100644 --- a/test/parallel/test-tls-connect-pipe.js +++ b/test/parallel/test-tls-connect-pipe.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-connect-simple.js b/test/parallel/test-tls-connect-simple.js index 7e0d1b462bff..d6211d05c8ca 100644 --- a/test/parallel/test-tls-connect-simple.js +++ b/test/parallel/test-tls-connect-simple.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-connect-stream-writes.js b/test/parallel/test-tls-connect-stream-writes.js index 637e54f535da..4a8b53b4de18 100644 --- a/test/parallel/test-tls-connect-stream-writes.js +++ b/test/parallel/test-tls-connect-stream-writes.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-connect.js b/test/parallel/test-tls-connect.js index 1908dba65741..227b4fae7b4a 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-delayed-attach-error.js b/test/parallel/test-tls-delayed-attach-error.js index 35da6d0e42ef..9d37f15efe48 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 fa8baa81f85f..e1f1fc878f3d 100644 --- a/test/parallel/test-tls-delayed-attach.js +++ b/test/parallel/test-tls-delayed-attach.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-destroy-whilst-write.js b/test/parallel/test-tls-destroy-whilst-write.js index b4f9766d9986..d157c7bf3f82 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 2f86e82be7fc..c071091a98ce 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -24,15 +24,11 @@ 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 tls = require('tls'); diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js index 732ebe4d1bda..4a00aa337eb9 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -23,15 +23,11 @@ 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 tls = require('tls'); diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index 32e77456bdc0..856c1a96fb80 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-econnreset.js b/test/parallel/test-tls-econnreset.js index 798c10ca4c14..e1e54470e76e 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 4974e6323e87..b4129fa0d53e 100644 --- a/test/parallel/test-tls-empty-sni-context.js +++ b/test/parallel/test-tls-empty-sni-context.js @@ -2,16 +2,13 @@ const common = require('../common'); -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'); -} +if (!common.hasCrypto) + common.skip('missing crypto'); const tls = require('tls'); diff --git a/test/parallel/test-tls-env-bad-extra-ca.js b/test/parallel/test-tls-env-bad-extra-ca.js index 57e4c1cfaf3a..ece93f33539d 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 e2de272184e5..be7c826b85cc 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 08a4ad16e8b4..4192b3958a15 100644 --- a/test/parallel/test-tls-external-accessor.js +++ b/test/parallel/test-tls-external-accessor.js @@ -3,10 +3,8 @@ 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 tls = require('tls'); diff --git a/test/parallel/test-tls-fast-writing.js b/test/parallel/test-tls-fast-writing.js index 05722d895943..126fe66843e3 100644 --- a/test/parallel/test-tls-fast-writing.js +++ b/test/parallel/test-tls-fast-writing.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-friendly-error-message.js b/test/parallel/test-tls-friendly-error-message.js index c476fb20fe47..afe433da5057 100644 --- a/test/parallel/test-tls-friendly-error-message.js +++ b/test/parallel/test-tls-friendly-error-message.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-getcipher.js b/test/parallel/test-tls-getcipher.js index d2c5b9eab4d1..acf07ef0a033 100644 --- a/test/parallel/test-tls-getcipher.js +++ b/test/parallel/test-tls-getcipher.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-getprotocol.js b/test/parallel/test-tls-getprotocol.js index 393b8fb3fe02..585a0348f639 100644 --- a/test/parallel/test-tls-getprotocol.js +++ b/test/parallel/test-tls-getprotocol.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 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 3bd74baa9772..5e5c86c2c27c 100644 --- a/test/parallel/test-tls-handshake-error.js +++ b/test/parallel/test-tls-handshake-error.js @@ -3,10 +3,9 @@ const common = require('../common'); const assert = require('assert'); -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-handshake-nohang.js b/test/parallel/test-tls-handshake-nohang.js index 791ba8df84b3..e724fcd3422b 100644 --- a/test/parallel/test-tls-handshake-nohang.js +++ b/test/parallel/test-tls-handshake-nohang.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); // neither should hang diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index a6e272aa2aab..ed4c4f7b991f 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.js @@ -23,10 +23,8 @@ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-honorcipherorder.js b/test/parallel/test-tls-honorcipherorder.js index a6d51d5dfeea..7eb1f893a597 100644 --- a/test/parallel/test-tls-honorcipherorder.js +++ b/test/parallel/test-tls-honorcipherorder.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -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-inception.js b/test/parallel/test-tls-inception.js index 38f922107b0b..267fa391a73e 100644 --- a/test/parallel/test-tls-inception.js +++ b/test/parallel/test-tls-inception.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-interleave.js b/test/parallel/test-tls-interleave.js index 131915911fbe..d704a35e6881 100644 --- a/test/parallel/test-tls-interleave.js +++ b/test/parallel/test-tls-interleave.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js index 4437507516b9..b1027dd94338 100644 --- a/test/parallel/test-tls-invoke-queued.js +++ b/test/parallel/test-tls-invoke-queued.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js index 6553d6862dd4..1a759558268e 100644 --- a/test/parallel/test-tls-js-stream.js +++ b/test/parallel/test-tls-js-stream.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -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-junk-closes-server.js b/test/parallel/test-tls-junk-closes-server.js index a1ffb32c2408..b0e29ec9f8cf 100644 --- a/test/parallel/test-tls-junk-closes-server.js +++ b/test/parallel/test-tls-junk-closes-server.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-junk-server.js b/test/parallel/test-tls-junk-server.js index 9b5ab6fdcc64..3270dec745c1 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 ac261122ea6b..ed5a15c258ae 100644 --- a/test/parallel/test-tls-key-mismatch.js +++ b/test/parallel/test-tls-key-mismatch.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-legacy-deprecated.js b/test/parallel/test-tls-legacy-deprecated.js index b50c63e7763d..4a6120c71b1f 100644 --- a/test/parallel/test-tls-legacy-deprecated.js +++ b/test/parallel/test-tls-legacy-deprecated.js @@ -1,10 +1,9 @@ // Flags: --no-warnings 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-legacy-onselect.js b/test/parallel/test-tls-legacy-onselect.js index 9af65c43a066..efcc5c2c92b8 100644 --- a/test/parallel/test-tls-legacy-onselect.js +++ b/test/parallel/test-tls-legacy-onselect.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); diff --git a/test/parallel/test-tls-lookup.js b/test/parallel/test-tls-lookup.js index cebb85c4b2a6..4656d3e5cc6a 100644 --- a/test/parallel/test-tls-lookup.js +++ b/test/parallel/test-tls-lookup.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js index 86ee1a4f14a7..059c91440038 100644 --- a/test/parallel/test-tls-max-send-fragment.js +++ b/test/parallel/test-tls-max-send-fragment.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-multi-key.js b/test/parallel/test-tls-multi-key.js index 6158f7d40576..99de43245746 100644 --- a/test/parallel/test-tls-multi-key.js +++ b/test/parallel/test-tls-multi-key.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js index 06139307c43c..bcdaf1a472ab 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -23,10 +23,9 @@ const assert = require('assert'); const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 60ac0ab148b1..af7c4493a016 100644 --- a/test/parallel/test-tls-no-rsa-key.js +++ b/test/parallel/test-tls-no-rsa-key.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-no-sslv23.js b/test/parallel/test-tls-no-sslv23.js index 564efab26da2..690013ad63cb 100644 --- a/test/parallel/test-tls-no-sslv23.js +++ b/test/parallel/test-tls-no-sslv23.js @@ -2,10 +2,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 2c2c51eb9be5..b465b4bcca8b 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -2,19 +2,16 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); const spawn = require('child_process').spawn; -if (common.opensslCli === false) { +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`); @@ -48,7 +45,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 ffaf61b633bc..6a528732a320 100644 --- a/test/parallel/test-tls-npn-server-client.js +++ b/test/parallel/test-tls-npn-server-client.js @@ -21,15 +21,11 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_npn) { - common.skip('Skipping because node compiled without NPN feature of OpenSSL.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!process.features.tls_npn) + common.skip('Skipping because node compiled without NPN feature of OpenSSL.'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-ocsp-callback.js b/test/parallel/test-tls-ocsp-callback.js index a839384925c0..b4437c6a9b35 100644 --- a/test/parallel/test-tls-ocsp-callback.js +++ b/test/parallel/test-tls-ocsp-callback.js @@ -22,19 +22,15 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_ocsp) { +if (!process.features.tls_ocsp) common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} -if (!common.opensslCli) { + +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const assert = require('assert'); diff --git a/test/parallel/test-tls-on-empty-socket.js b/test/parallel/test-tls-on-empty-socket.js index 38537fd640c7..5b66edd0c207 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 638886e92e92..331b74865536 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-tls-parse-cert-string.js b/test/parallel/test-tls-parse-cert-string.js index c6cdbf2e36e6..2e940805c0b9 100644 --- a/test/parallel/test-tls-parse-cert-string.js +++ b/test/parallel/test-tls-parse-cert-string.js @@ -1,9 +1,7 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-passphrase.js b/test/parallel/test-tls-passphrase.js index 20b5961fb47f..3ae6577dff4a 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-pause.js b/test/parallel/test-tls-pause.js index a08b435f6785..3ec17a0a6443 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-peer-certificate-encoding.js b/test/parallel/test-tls-peer-certificate-encoding.js index 95f14c7b8ee1..bd038e51ea1e 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-peer-certificate-multi-keys.js b/test/parallel/test-tls-peer-certificate-multi-keys.js index a58c747bd41e..5abe8ad7c4b4 100644 --- a/test/parallel/test-tls-peer-certificate-multi-keys.js +++ b/test/parallel/test-tls-peer-certificate-multi-keys.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-pfx-gh-5100-regr.js b/test/parallel/test-tls-pfx-gh-5100-regr.js index 142a7de10b84..c47ad5f89d47 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 6f4392007bc8..9bb07fe7ca3b 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 c529d972d218..72d2bf161949 100644 --- a/test/parallel/test-tls-request-timeout.js +++ b/test/parallel/test-tls-request-timeout.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-retain-handle-no-abort.js b/test/parallel/test-tls-retain-handle-no-abort.js index a3a2aebcd6ab..9e982ac79117 100644 --- a/test/parallel/test-tls-retain-handle-no-abort.js +++ b/test/parallel/test-tls-retain-handle-no-abort.js @@ -3,10 +3,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); const util = require('util'); diff --git a/test/parallel/test-tls-securepair-fiftharg.js b/test/parallel/test-tls-securepair-fiftharg.js index 2b69ce88f4f9..236f719157f1 100644 --- a/test/parallel/test-tls-securepair-fiftharg.js +++ b/test/parallel/test-tls-securepair-fiftharg.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-securepair-leak.js b/test/parallel/test-tls-securepair-leak.js index b513bcd4c7c7..7ebdfaa12adb 100644 --- a/test/parallel/test-tls-securepair-leak.js +++ b/test/parallel/test-tls-securepair-leak.js @@ -4,10 +4,8 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const { createSecureContext } = require('tls'); const { createSecurePair } = require('_tls_legacy'); diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index 00e8cd591ff2..6ccf496ea1a6 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -23,15 +23,11 @@ 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 tls = require('tls'); diff --git a/test/parallel/test-tls-server-connection-server.js b/test/parallel/test-tls-server-connection-server.js index 1c54eb635ad4..7eef14d23b53 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 0290bcc629a3..8efb4ec53866 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 86a735f64c98..f0f0b168fcf6 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); // This is a rather complex test which sets up various TLS servers with node // and connects to them using the 'openssl s_client' command line utility @@ -132,7 +128,6 @@ const testCases = } ]; - function filenamePEM(n) { return path.join(common.fixturesDir, 'keys', `${n}.pem`); } diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index e87c62d3ed94..805c21b3ade2 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} doTest({ tickets: false }, function() { doTest({ tickets: true }, function() { diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index 4b7923891bd5..2c7177389b12 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const exec = require('child_process').exec; diff --git a/test/parallel/test-tls-set-encoding.js b/test/parallel/test-tls-set-encoding.js index 7023132d7373..4f456aee1900 100644 --- a/test/parallel/test-tls-set-encoding.js +++ b/test/parallel/test-tls-set-encoding.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-sni-option.js b/test/parallel/test-tls-sni-option.js index ad7410b16311..f744b6db54c9 100644 --- a/test/parallel/test-tls-sni-option.js +++ b/test/parallel/test-tls-sni-option.js @@ -21,15 +21,11 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_sni) { - common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!process.features.tls_sni) + common.skip('node compiled without OpenSSL or with old OpenSSL version.'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js index 300010cfa13c..83fd50c06603 100644 --- a/test/parallel/test-tls-sni-server-client.js +++ b/test/parallel/test-tls-sni-server-client.js @@ -21,15 +21,11 @@ 'use strict'; const common = require('../common'); -if (!process.features.tls_sni) { - common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!process.features.tls_sni) + common.skip('node compiled without OpenSSL or with old OpenSSL version.'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/parallel/test-tls-socket-close.js b/test/parallel/test-tls-socket-close.js index 25282ada9ed3..0a1911b5e8cb 100644 --- a/test/parallel/test-tls-socket-close.js +++ b/test/parallel/test-tls-socket-close.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); diff --git a/test/parallel/test-tls-socket-destroy.js b/test/parallel/test-tls-socket-destroy.js index 0a72ac6232e8..b101a872c234 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 106a14a7df8e..16175b889811 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 601c0e4393c2..92d595e80cfa 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 d588fee34d5f..28d1db88598c 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 8654dd9ceb32..7102fb460ce2 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const cluster = require('cluster'); diff --git a/test/parallel/test-tls-ticket.js b/test/parallel/test-tls-ticket.js index b2541e06ab88..5e385a5271f9 100644 --- a/test/parallel/test-tls-ticket.js +++ b/test/parallel/test-tls-ticket.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js index bf6dcc385bc2..76d587f675b8 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -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-timeout-server.js b/test/parallel/test-tls-timeout-server.js index b43bb169f343..b5855ea39b1f 100644 --- a/test/parallel/test-tls-timeout-server.js +++ b/test/parallel/test-tls-timeout-server.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const net = require('net'); diff --git a/test/parallel/test-tls-two-cas-one-string.js b/test/parallel/test-tls-two-cas-one-string.js index 3f948b86a585..897635d7b18c 100644 --- a/test/parallel/test-tls-two-cas-one-string.js +++ b/test/parallel/test-tls-two-cas-one-string.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const fs = require('fs'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-econnreset-localaddress.js b/test/parallel/test-tls-wrap-econnreset-localaddress.js index 5052d4377a44..9df145ac374a 100644 --- a/test/parallel/test-tls-wrap-econnreset-localaddress.js +++ b/test/parallel/test-tls-wrap-econnreset-localaddress.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const net = require('net'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-econnreset-pipe.js b/test/parallel/test-tls-wrap-econnreset-pipe.js index f31e058e6aae..ef6efaedc34a 100644 --- a/test/parallel/test-tls-wrap-econnreset-pipe.js +++ b/test/parallel/test-tls-wrap-econnreset-pipe.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const tls = require('tls'); const net = require('net'); diff --git a/test/parallel/test-tls-wrap-econnreset-socket.js b/test/parallel/test-tls-wrap-econnreset-socket.js index 479d7524aa36..672da9876fd0 100644 --- a/test/parallel/test-tls-wrap-econnreset-socket.js +++ b/test/parallel/test-tls-wrap-econnreset-socket.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const net = require('net'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-econnreset.js b/test/parallel/test-tls-wrap-econnreset.js index ed0fe9b1a31b..5c6db86b75e0 100644 --- a/test/parallel/test-tls-wrap-econnreset.js +++ b/test/parallel/test-tls-wrap-econnreset.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const net = require('net'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-event-emmiter.js b/test/parallel/test-tls-wrap-event-emmiter.js index 417b21804a40..82953f1333e5 100644 --- a/test/parallel/test-tls-wrap-event-emmiter.js +++ b/test/parallel/test-tls-wrap-event-emmiter.js @@ -6,10 +6,9 @@ */ const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const assert = require('assert'); const TlsSocket = require('tls').TLSSocket; diff --git a/test/parallel/test-tls-wrap-no-abort.js b/test/parallel/test-tls-wrap-no-abort.js index c18b17a64063..21a472ee3bc7 100644 --- a/test/parallel/test-tls-wrap-no-abort.js +++ b/test/parallel/test-tls-wrap-no-abort.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const util = require('util'); const TLSWrap = process.binding('tls_wrap').TLSWrap; diff --git a/test/parallel/test-tls-wrap-timeout.js b/test/parallel/test-tls-wrap-timeout.js index 64fbcc7fc7f2..b4cff368182f 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 0d61f279312d..7035764cba53 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 10d0efaf0b47..84c03d292c1d 100644 --- a/test/parallel/test-tls-zero-clear-in.js +++ b/test/parallel/test-tls-zero-clear-in.js @@ -22,10 +22,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-url-domain-ascii-unicode.js b/test/parallel/test-url-domain-ascii-unicode.js index 2be8ac7f5fec..49259a7ab0f4 100644 --- a/test/parallel/test-url-domain-ascii-unicode.js +++ b/test/parallel/test-url-domain-ascii-unicode.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} + const strictEqual = require('assert').strictEqual; const url = require('url'); diff --git a/test/parallel/test-url-format-whatwg.js b/test/parallel/test-url-format-whatwg.js index f7363fdbb998..d484760c8085 100644 --- a/test/parallel/test-url-format-whatwg.js +++ b/test/parallel/test-url-format-whatwg.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} + const assert = require('assert'); const url = require('url'); const URL = url.URL; diff --git a/test/parallel/test-util-sigint-watchdog.js b/test/parallel/test-util-sigint-watchdog.js index 207f44b011c3..ec19c096fec2 100644 --- a/test/parallel/test-util-sigint-watchdog.js +++ b/test/parallel/test-util-sigint-watchdog.js @@ -6,7 +6,6 @@ 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; } [(next) => { diff --git a/test/parallel/test-vm-sigint-existing-handler.js b/test/parallel/test-vm-sigint-existing-handler.js index cbd91bef06c9..5300d7cd0b7b 100644 --- a/test/parallel/test-vm-sigint-existing-handler.js +++ b/test/parallel/test-vm-sigint-existing-handler.js @@ -13,7 +13,6 @@ const methods = [ 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') { diff --git a/test/parallel/test-vm-sigint.js b/test/parallel/test-vm-sigint.js index b1ad61640545..bb836225fc68 100644 --- a/test/parallel/test-vm-sigint.js +++ b/test/parallel/test-vm-sigint.js @@ -9,7 +9,6 @@ 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; } if (process.argv[2] === 'child') { diff --git a/test/parallel/test-warn-sigprof.js b/test/parallel/test-warn-sigprof.js index eedbe33d84ff..3404490c2a17 100644 --- a/test/parallel/test-warn-sigprof.js +++ b/test/parallel/test-warn-sigprof.js @@ -6,10 +6,8 @@ const common = require('../common'); common.skipIfInspectorDisabled(); -if (common.isWindows) { +if (common.isWindows) common.skip('test does not apply to Windows'); - return; -} common.expectWarning('Warning', 'process.on(SIGPROF) is reserved while debugging'); diff --git a/test/parallel/test-whatwg-url-constructor.js b/test/parallel/test-whatwg-url-constructor.js index b67f63baf139..beb620a8dc1d 100644 --- a/test/parallel/test-whatwg-url-constructor.js +++ b/test/parallel/test-whatwg-url-constructor.js @@ -8,7 +8,6 @@ const { test, assert_equals, assert_true, assert_throws } = if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } const request = { diff --git a/test/parallel/test-whatwg-url-domainto.js b/test/parallel/test-whatwg-url-domainto.js index b399f24136e1..bfd5e94d2e5d 100644 --- a/test/parallel/test-whatwg-url-domainto.js +++ b/test/parallel/test-whatwg-url-domainto.js @@ -1,10 +1,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const assert = require('assert'); const { domainToASCII, domainToUnicode } = require('url'); diff --git a/test/parallel/test-whatwg-url-historical.js b/test/parallel/test-whatwg-url-historical.js index 0f7c0e70cd63..46fde1632d6b 100644 --- a/test/parallel/test-whatwg-url-historical.js +++ b/test/parallel/test-whatwg-url-historical.js @@ -6,7 +6,6 @@ const { test, assert_equals, assert_throws } = require('../common/wpt'); if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } /* eslint-disable */ diff --git a/test/parallel/test-whatwg-url-inspect.js b/test/parallel/test-whatwg-url-inspect.js index 8db1a20e5be1..4d0a25fc866b 100644 --- a/test/parallel/test-whatwg-url-inspect.js +++ b/test/parallel/test-whatwg-url-inspect.js @@ -8,7 +8,6 @@ const assert = require('assert'); if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } // Tests below are not from WPT. diff --git a/test/parallel/test-whatwg-url-origin.js b/test/parallel/test-whatwg-url-origin.js index b5b54f887f09..f73144e0e082 100644 --- a/test/parallel/test-whatwg-url-origin.js +++ b/test/parallel/test-whatwg-url-origin.js @@ -7,7 +7,6 @@ const { test, assert_equals } = require('../common/wpt'); if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } const request = { diff --git a/test/parallel/test-whatwg-url-parsing.js b/test/parallel/test-whatwg-url-parsing.js index 6c95a5e91391..8f940273aea5 100644 --- a/test/parallel/test-whatwg-url-parsing.js +++ b/test/parallel/test-whatwg-url-parsing.js @@ -8,7 +8,6 @@ const assert = require('assert'); if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } // Tests below are not from WPT. diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index 60a482decc32..b6d0586c3b1e 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -11,7 +11,6 @@ const additionalTestCases = require( if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } const request = { diff --git a/test/parallel/test-whatwg-url-toascii.js b/test/parallel/test-whatwg-url-toascii.js index bd986c96a47a..b614f599dfcc 100644 --- a/test/parallel/test-whatwg-url-toascii.js +++ b/test/parallel/test-whatwg-url-toascii.js @@ -7,7 +7,6 @@ const { test, assert_equals, assert_throws } = require('../common/wpt'); if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } const request = { diff --git a/test/parallel/test-windows-abort-exitcode.js b/test/parallel/test-windows-abort-exitcode.js index c5c5fa6f3a5e..97232337b2e7 100644 --- a/test/parallel/test-windows-abort-exitcode.js +++ b/test/parallel/test-windows-abort-exitcode.js @@ -8,10 +8,9 @@ const assert = require('assert'); // exit code in the parent. const spawn = require('child_process').spawn; -if (!common.isWindows) { +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 4ccfd2dc2282..5b5b334ef2d9 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const crypto = require('crypto'); const stream = require('stream'); diff --git a/test/pummel/test-abort-fatal-error.js b/test/pummel/test-abort-fatal-error.js index 6208a13261bd..cd0442f28075 100644 --- a/test/pummel/test-abort-fatal-error.js +++ b/test/pummel/test-abort-fatal-error.js @@ -23,10 +23,8 @@ const common = require('../common'); const assert = require('assert'); -if (common.isWindows) { +if (common.isWindows) common.skip('no RLIMIT_NOFILE on Windows'); - return; -} const exec = require('child_process').exec; diff --git a/test/pummel/test-crypto-dh.js b/test/pummel/test-crypto-dh.js index 2268994b4d2f..c2a2f42e7e2a 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -24,10 +24,8 @@ const common = require('../common'); const assert = require('assert'); const crypto = require('crypto'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); - return; -} assert.throws( function() { diff --git a/test/pummel/test-crypto-timing-safe-equal-benchmarks.js b/test/pummel/test-crypto-timing-safe-equal-benchmarks.js index 5560a4a256b5..8e17aabf9a85 100644 --- a/test/pummel/test-crypto-timing-safe-equal-benchmarks.js +++ b/test/pummel/test-crypto-timing-safe-equal-benchmarks.js @@ -2,15 +2,11 @@ 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 crypto = require('crypto'); diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js index 092d91428eb4..322bd866eda4 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + 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 d69e96b25117..f5ca97d123ee 100644 --- a/test/pummel/test-dtrace-jsstack.js +++ b/test/pummel/test-dtrace-jsstack.js @@ -24,10 +24,8 @@ const common = require('../common'); const assert = require('assert'); const os = require('os'); -if (!common.isSunOS) { +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 6cc8c51fe211..458232caf3a3 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -24,19 +24,16 @@ const common = require('../common'); const assert = require('assert'); const spawn = require('child_process').spawn; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const https = require('https'); const fs = require('fs'); -if (!common.opensslCli) { +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 17038bf7bde5..7cea39a90a03 100644 --- a/test/pummel/test-https-large-response.js +++ b/test/pummel/test-https-large-response.js @@ -25,10 +25,9 @@ const assert = require('assert'); const fs = require('fs'); -if (!common.hasCrypto) { +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 cc77993a7312..2d5761138367 100644 --- a/test/pummel/test-https-no-reader.js +++ b/test/pummel/test-https-no-reader.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const fs = require('fs'); diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index 26e19786913f..d7263db2589b 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -28,10 +28,8 @@ const spawn = require('child_process').spawn; const http = require('http'); const url = require('url'); -if (common.isWindows) { +if (common.isWindows) common.skip('no `wrk` on windows'); - return; -} const body = 'hello world\n'; const server = http.createServer(function(req, res) { diff --git a/test/pummel/test-regress-GH-892.js b/test/pummel/test-regress-GH-892.js index 1a7e3ad1cb03..2b68d96a293f 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -30,10 +30,9 @@ const common = require('../common'); const assert = require('assert'); const spawn = require('child_process').spawn; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const https = require('https'); const fs = require('fs'); diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js index 4bbaacebf4b6..d1e1ebd9d2ba 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -24,18 +24,15 @@ const common = require('../common'); const assert = require('assert'); const spawn = require('child_process').spawn; -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); -if (!common.opensslCli) { +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 d4797e194026..80de284dee1f 100644 --- a/test/pummel/test-tls-connect-memleak.js +++ b/test/pummel/test-tls-connect-memleak.js @@ -25,10 +25,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/pummel/test-tls-securepair-client.js b/test/pummel/test-tls-securepair-client.js index f147d019c938..89683c3830b8 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -24,15 +24,11 @@ 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 021fb7913b58..1a45861201a2 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.js @@ -23,10 +23,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/pummel/test-tls-session-timeout.js b/test/pummel/test-tls-session-timeout.js index 1bb359204227..9b175da77e62 100644 --- a/test/pummel/test-tls-session-timeout.js +++ b/test/pummel/test-tls-session-timeout.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} doTest(); diff --git a/test/pummel/test-tls-throttle.js b/test/pummel/test-tls-throttle.js index a9e2442ef2bc..f4f42922d942 100644 --- a/test/pummel/test-tls-throttle.js +++ b/test/pummel/test-tls-throttle.js @@ -26,10 +26,9 @@ const common = require('../common'); const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + const tls = require('tls'); const fs = require('fs'); diff --git a/test/sequential/test-benchmark-http.js b/test/sequential/test-benchmark-http.js index ce3d58e5d8d4..34fbc3732b20 100644 --- a/test/sequential/test-benchmark-http.js +++ b/test/sequential/test-benchmark-http.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.enoughTestMem) { +if (!common.enoughTestMem) common.skip('Insufficient memory for HTTP benchmark test'); - return; -} // Minimal test for http benchmarks. This makes sure the benchmarks aren't // horribly broken but nothing more than that. diff --git a/test/sequential/test-buffer-creation-regression.js b/test/sequential/test-buffer-creation-regression.js index 8137e4830a9c..8c3a09848c9f 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 59756e4c7b2e..86908ff4a250 100644 --- a/test/sequential/test-child-process-emfile.js +++ b/test/sequential/test-child-process-emfile.js @@ -25,10 +25,8 @@ const assert = require('assert'); const child_process = require('child_process'); const fs = require('fs'); -if (common.isWindows) { +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)) { diff --git a/test/sequential/test-child-process-pass-fd.js b/test/sequential/test-child-process-pass-fd.js index b2481270faf0..d50ad1a9fd88 100644 --- a/test/sequential/test-child-process-pass-fd.js +++ b/test/sequential/test-child-process-pass-fd.js @@ -5,10 +5,8 @@ const fork = require('child_process').fork; const net = require('net'); if ((process.config.variables.arm_version === '6') || - (process.config.variables.arm_version === '7')) { + (process.config.variables.arm_version === '7')) common.skip('Too slow for armv6 and armv7 bots'); - return; -} const N = 80; diff --git a/test/sequential/test-crypto-timing-safe-equal.js b/test/sequential/test-crypto-timing-safe-equal.js index 7a1f8d299366..1bb23599abcb 100644 --- a/test/sequential/test-crypto-timing-safe-equal.js +++ b/test/sequential/test-crypto-timing-safe-equal.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 crypto = require('crypto'); diff --git a/test/sequential/test-fs-readfile-tostring-fail.js b/test/sequential/test-fs-readfile-tostring-fail.js index ee962652fc14..2eb6ce0732dd 100644 --- a/test/sequential/test-fs-readfile-tostring-fail.js +++ b/test/sequential/test-fs-readfile-tostring-fail.js @@ -2,11 +2,8 @@ const common = require('../common'); -if (!common.enoughTestMem) { - const skipMessage = 'intensive toString tests due to memory confinements'; - common.skip(skipMessage); - return; -} +if (!common.enoughTestMem) + common.skip('intensive toString tests due to memory confinements'); const assert = require('assert'); const fs = require('fs'); diff --git a/test/sequential/test-https-set-timeout-server.js b/test/sequential/test-https-set-timeout-server.js index aa4eb5714ffa..e1b9430583ff 100644 --- a/test/sequential/test-https-set-timeout-server.js +++ b/test/sequential/test-https-set-timeout-server.js @@ -22,10 +22,8 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const fs = require('fs'); diff --git a/test/sequential/test-net-server-address.js b/test/sequential/test-net-server-address.js index a6e09a86532d..52a8c1ac820e 100644 --- a/test/sequential/test-net-server-address.js +++ b/test/sequential/test-net-server-address.js @@ -40,7 +40,7 @@ server_ipv4 })); if (!common.hasIPv6) { - common.skip('ipv6 part of test, no IPv6 support'); + common.printSkipMessage('ipv6 part of test, no IPv6 support'); return; } diff --git a/test/tick-processor/test-tick-processor-builtin.js b/test/tick-processor/test-tick-processor-builtin.js index afe08bdb0b67..cacacc1b42e1 100644 --- a/test/tick-processor/test-tick-processor-builtin.js +++ b/test/tick-processor/test-tick-processor-builtin.js @@ -5,15 +5,11 @@ 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) { +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 72eb25e91c39..1bfe222ed9ce 100644 --- a/test/tick-processor/test-tick-processor-cpp-core.js +++ b/test/tick-processor/test-tick-processor-cpp-core.js @@ -5,15 +5,11 @@ 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) { +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 ab3d110ccff0..c0f5f332b260 100644 --- a/test/tick-processor/test-tick-processor-unknown.js +++ b/test/tick-processor/test-tick-processor-unknown.js @@ -6,15 +6,11 @@ const common = require('../common'); // the full 64 bits and the result is that it does not process the // addresses correctly and runs out of memory // Disabling until we get a fix upstreamed into V8 -if (common.isAix) { +if (common.isAix) common.skip('AIX address range too big for scripts.'); - return; -} -if (!common.enoughTestCpu) { +if (!common.enoughTestCpu) common.skip('test is CPU-intensive'); - return; -} const base = require('./tick-processor-base.js'); From 881c785a69fc28b77c4a0c4cd50585ece3396278 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 1 Jul 2017 08:10:08 +0300 Subject: [PATCH 2/2] test: don't make needless things before skip --- test/abort/test-abort-backtrace.js | 6 +++--- test/addons/load-long-path/test.js | 6 +++--- .../test-stringbytes-external-at-max.js | 8 ++++---- ...est-stringbytes-external-exceed-max-by-1-ascii.js | 6 +++--- ...st-stringbytes-external-exceed-max-by-1-base64.js | 6 +++--- ...st-stringbytes-external-exceed-max-by-1-binary.js | 6 +++--- .../test-stringbytes-external-exceed-max-by-1-hex.js | 6 +++--- ...test-stringbytes-external-exceed-max-by-1-utf8.js | 6 +++--- .../test-stringbytes-external-exceed-max-by-2.js | 6 +++--- .../test-stringbytes-external-exceed-max.js | 6 +++--- test/async-hooks/test-connection.ssl.js | 8 ++++---- test/async-hooks/test-graph.connection.js | 6 +++--- test/async-hooks/test-graph.shutdown.js | 5 ++--- test/async-hooks/test-graph.tcp.js | 5 ++--- test/async-hooks/test-graph.tls-write.js | 8 ++++---- test/async-hooks/test-tcpwrap.js | 7 +++---- test/async-hooks/test-tlswrap.js | 8 ++++---- test/async-hooks/test-ttywrap.writestream.js | 9 +++++---- test/async-hooks/test-writewrap.js | 8 ++++---- test/doctool/test-doctool-html.js | 7 +++---- test/doctool/test-doctool-json.js | 7 +++---- test/fixtures/tls-connect.js | 4 ++-- test/internet/test-dgram-broadcast-multi-process.js | 6 +++--- test/internet/test-dgram-multicast-multi-process.js | 8 ++++---- test/internet/test-dns-ipv6.js | 6 +++--- test/parallel/test-child-process-fork-dgram.js | 6 +++--- test/parallel/test-cluster-bind-privileged-port.js | 8 ++++---- test/parallel/test-cluster-dgram-1.js | 7 +++---- test/parallel/test-cluster-dgram-2.js | 7 +++---- test/parallel/test-cluster-dgram-reuse.js | 6 +++--- test/parallel/test-cluster-disconnect-race.js | 6 +++--- test/parallel/test-cluster-http-pipe.js | 8 ++++---- ...est-cluster-shared-handle-bind-privileged-port.js | 8 ++++---- test/parallel/test-crypto-authenticated.js | 3 +-- test/parallel/test-crypto-certificate.js | 3 +-- test/parallel/test-crypto-cipheriv-decipheriv.js | 3 +-- test/parallel/test-crypto-deprecated.js | 3 +-- test/parallel/test-crypto-dh-odd-key.js | 3 +-- test/parallel/test-crypto-dh.js | 4 ++-- test/parallel/test-crypto-domain.js | 5 ++--- test/parallel/test-crypto-domains.js | 10 +++++----- test/parallel/test-crypto-ecb.js | 3 +-- test/parallel/test-crypto-fips.js | 6 +++--- test/parallel/test-crypto-from-binary.js | 3 +-- test/parallel/test-crypto-hash.js | 7 +++---- test/parallel/test-crypto-hmac.js | 3 +-- test/parallel/test-crypto-padding-aes256.js | 3 +-- test/parallel/test-crypto-padding.js | 3 +-- test/parallel/test-crypto-pbkdf2.js | 3 +-- test/parallel/test-crypto-rsa-dsa.js | 7 +++---- test/parallel/test-crypto-sign-verify.js | 7 +++---- test/parallel/test-crypto-stream.js | 7 +++---- test/parallel/test-cwd-enoent-preload.js | 8 ++++---- test/parallel/test-cwd-enoent-repl.js | 8 ++++---- test/parallel/test-cwd-enoent.js | 8 ++++---- test/parallel/test-debug-usage.js | 6 +++--- test/parallel/test-dgram-bind-default-address.js | 6 +++--- .../parallel/test-dgram-cluster-close-during-bind.js | 6 +++--- test/parallel/test-dgram-send-empty-buffer.js | 3 +-- test/parallel/test-dgram-send-empty-packet.js | 3 +-- test/parallel/test-dgram-udp6-send-default-host.js | 6 +++--- test/parallel/test-dsa-fips-invalid-key.js | 3 +-- test/parallel/test-fs-long-path.js | 6 +++--- test/parallel/test-fs-read-file-sync-hostname.js | 6 +++--- test/parallel/test-fs-readdir-ucs2.js | 6 +++--- test/parallel/test-fs-readfile-error.js | 8 ++++---- test/parallel/test-fs-readfile-pipe-large.js | 4 ++-- test/parallel/test-fs-readfile-pipe.js | 2 +- test/parallel/test-fs-readfilesync-pipe-large.js | 4 ++-- test/parallel/test-fs-realpath-on-substed-drive.js | 6 +++--- test/parallel/test-fs-symlink.js | 6 +++--- test/parallel/test-fs-watch-encoding.js | 5 +++-- test/parallel/test-http-chunk-problem.js | 3 ++- test/parallel/test-http-localaddress.js | 6 +++--- test/parallel/test-http-url.parse-https.request.js | 4 +--- .../test-https-agent-disable-session-reuse.js | 8 +++----- test/parallel/test-https-agent-secure-protocol.js | 3 +-- test/parallel/test-https-agent-sni.js | 4 +--- test/parallel/test-https-agent.js | 4 +--- test/parallel/test-https-byteswritten.js | 5 ++--- .../test-https-client-checkServerIdentity.js | 4 +--- test/parallel/test-https-client-get-url.js | 9 ++++----- test/parallel/test-https-client-reject.js | 4 +--- test/parallel/test-https-client-resume.js | 4 +--- test/parallel/test-https-close.js | 3 +-- test/parallel/test-https-connecting-to-http.js | 4 +--- test/parallel/test-https-drain.js | 4 +--- test/parallel/test-https-eof-for-eom.js | 4 +--- test/parallel/test-https-foafssl.js | 7 ++----- test/parallel/test-https-host-headers.js | 5 ++--- test/parallel/test-https-localaddress-bind-error.js | 5 ++--- test/parallel/test-https-localaddress.js | 9 ++++----- test/parallel/test-https-pfx.js | 5 ++--- test/parallel/test-https-req-split.js | 6 +++--- test/parallel/test-https-socket-options.js | 2 -- test/parallel/test-https-strict.js | 8 +++----- test/parallel/test-https-timeout-server-2.js | 4 +--- test/parallel/test-inspector-open.js | 3 +-- test/parallel/test-listen-fd-cluster.js | 6 +++--- test/parallel/test-listen-fd-detached-inherit.js | 6 +++--- test/parallel/test-listen-fd-detached.js | 6 +++--- test/parallel/test-listen-fd-server.js | 6 +++--- test/parallel/test-net-connect-options-fd.js | 6 +++--- test/parallel/test-net-connect-options-ipv6.js | 6 +++--- test/parallel/test-net-socket-local-address.js | 6 +++--- test/parallel/test-pipe-writev.js | 6 +++--- test/parallel/test-preload.js | 8 ++++---- test/parallel/test-process-execpath.js | 6 +++--- .../test-process-remove-all-signal-listeners.js | 6 +++--- test/parallel/test-regress-GH-3542.js | 8 ++++---- test/parallel/test-regress-GH-9819.js | 6 +++--- test/parallel/test-repl-sigint-nested-eval.js | 7 +++---- test/parallel/test-repl-sigint.js | 7 +++---- test/parallel/test-require-long-path.js | 6 +++--- test/parallel/test-spawn-cmd-named-pipe.js | 4 ++-- test/parallel/test-tls-0-dns-altname.js | 8 +++----- test/parallel/test-tls-alert-handling.js | 6 +++--- test/parallel/test-tls-alert.js | 6 +++--- test/parallel/test-tls-client-abort.js | 4 +--- test/parallel/test-tls-client-abort2.js | 3 +-- test/parallel/test-tls-client-default-ciphers.js | 3 +-- test/parallel/test-tls-client-destroy-soon.js | 4 +--- test/parallel/test-tls-client-getephemeralkeyinfo.js | 5 ++--- test/parallel/test-tls-client-mindhsize.js | 5 ++--- test/parallel/test-tls-client-reject.js | 4 +--- test/parallel/test-tls-client-resume.js | 4 +--- test/parallel/test-tls-close-error.js | 4 +--- test/parallel/test-tls-close-notify.js | 1 - test/parallel/test-tls-connect-given-socket.js | 5 ++--- test/parallel/test-tls-connect.js | 1 - test/parallel/test-tls-delayed-attach.js | 4 +--- test/parallel/test-tls-dhe.js | 5 ++--- test/parallel/test-tls-ecdh-disable.js | 4 +--- test/parallel/test-tls-econnreset.js | 3 +-- test/parallel/test-tls-empty-sni-context.js | 6 ++---- test/parallel/test-tls-external-accessor.js | 6 +++--- test/parallel/test-tls-fast-writing.js | 4 +--- test/parallel/test-tls-friendly-error-message.js | 4 +--- test/parallel/test-tls-getprotocol.js | 3 +-- test/parallel/test-tls-handshake-error.js | 4 +--- test/parallel/test-tls-honorcipherorder.js | 5 ++--- test/parallel/test-tls-js-stream.js | 4 +--- test/parallel/test-tls-max-send-fragment.js | 4 +--- test/parallel/test-tls-multi-key.js | 3 +-- test/parallel/test-tls-no-cert-required.js | 3 +-- test/parallel/test-tls-no-rsa-key.js | 4 +--- test/parallel/test-tls-no-sslv23.js | 3 +-- test/parallel/test-tls-no-sslv3.js | 10 ++++------ test/parallel/test-tls-over-http-tunnel.js | 4 +--- test/parallel/test-tls-passphrase.js | 4 +--- test/parallel/test-tls-pause.js | 4 +--- test/parallel/test-tls-peer-certificate-encoding.js | 4 +--- .../parallel/test-tls-peer-certificate-multi-keys.js | 4 +--- test/parallel/test-tls-request-timeout.js | 4 +--- test/parallel/test-tls-retain-handle-no-abort.js | 3 +-- test/parallel/test-tls-securepair-leak.js | 3 +-- test/parallel/test-tls-securepair-server.js | 4 +--- test/parallel/test-tls-server-verify.js | 1 + test/parallel/test-tls-set-encoding.js | 5 +---- test/parallel/test-tls-socket-close.js | 1 - test/parallel/test-tls-ticket-cluster.js | 4 +--- test/parallel/test-tls-ticket.js | 4 +--- test/parallel/test-tls-timeout-server-2.js | 4 +--- test/parallel/test-tls-timeout-server.js | 1 - test/parallel/test-util-sigint-watchdog.js | 6 +++--- test/parallel/test-vm-sigint-existing-handler.js | 11 +++++------ test/parallel/test-vm-sigint.js | 10 ++++------ test/parallel/test-whatwg-url-constructor.js | 10 +++++----- test/parallel/test-whatwg-url-historical.js | 6 +++--- test/parallel/test-whatwg-url-inspect.js | 8 ++++---- test/parallel/test-whatwg-url-origin.js | 8 ++++---- test/parallel/test-whatwg-url-parsing.js | 8 ++++---- test/parallel/test-whatwg-url-setters.js | 10 +++++----- test/parallel/test-whatwg-url-toascii.js | 8 ++++---- test/parallel/test-windows-abort-exitcode.js | 8 ++++---- test/parallel/test-zlib-random-byte-pipes.js | 6 ++---- test/pummel/test-abort-fatal-error.js | 3 +-- test/pummel/test-crypto-dh.js | 6 +++--- .../test-crypto-timing-safe-equal-benchmarks.js | 3 +-- test/pummel/test-dh-regr.js | 3 +-- test/pummel/test-dtrace-jsstack.js | 6 +++--- test/pummel/test-https-ci-reneg-attack.js | 12 +++++------- test/pummel/test-https-large-response.js | 6 ++---- test/pummel/test-https-no-reader.js | 4 +--- test/pummel/test-keep-alive.js | 6 +++--- test/pummel/test-regress-GH-892.js | 6 ++---- test/pummel/test-tls-ci-reneg-attack.js | 12 +++++------- test/pummel/test-tls-connect-memleak.js | 4 +--- test/pummel/test-tls-securepair-client.js | 1 - test/pummel/test-tls-server-large-request.js | 4 +--- test/pummel/test-tls-throttle.js | 3 +-- test/sequential/test-child-process-emfile.js | 6 +++--- test/sequential/test-child-process-pass-fd.js | 8 ++++---- test/sequential/test-crypto-timing-safe-equal.js | 3 +-- test/tick-processor/test-tick-processor-builtin.js | 6 +++--- test/tick-processor/test-tick-processor-cpp-core.js | 6 +++--- 196 files changed, 446 insertions(+), 606 deletions(-) diff --git a/test/abort/test-abort-backtrace.js b/test/abort/test-abort-backtrace.js index 2ea1179a77a6..dd1081716840 100644 --- a/test/abort/test-abort-backtrace.js +++ b/test/abort/test-abort-backtrace.js @@ -1,11 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cp = require('child_process'); - if (common.isWindows) common.skip('Backtraces unimplemented on Windows.'); +const assert = require('assert'); +const cp = require('child_process'); + 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 b1b8c4e2980f..accb90d26382 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -1,12 +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'); - 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 4b98e85dd111..4c074773a21f 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,10 +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); - let buf; try { buf = Buffer.allocUnsafe(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 11a85bfab039..43b8c63f1e46 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,13 +1,13 @@ '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) common.skip(skipMessage); +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 const kStringMaxLength = process.binding('buffer').kStringMaxLength; 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 3088712bb912..a94a57e18037 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,13 +1,13 @@ '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) common.skip(skipMessage); +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 const kStringMaxLength = process.binding('buffer').kStringMaxLength; 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 67690a1d0d5e..996c01752da7 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,13 +1,13 @@ '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) common.skip(skipMessage); +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 const kStringMaxLength = process.binding('buffer').kStringMaxLength; 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 ab36c660d024..17d9ae5d68f0 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,13 +1,13 @@ '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) common.skip(skipMessage); +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 const kStringMaxLength = process.binding('buffer').kStringMaxLength; 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 7666081191cf..d3368ca7b2ea 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,13 +1,13 @@ '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) common.skip(skipMessage); +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 const kStringMaxLength = process.binding('buffer').kStringMaxLength; 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 999971a0a4f8..db007a53a44f 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,13 +1,13 @@ '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) common.skip(skipMessage); +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 const kStringMaxLength = process.binding('buffer').kStringMaxLength; 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 397ba5d9ca58..319a8a93558c 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,13 +1,13 @@ '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) common.skip(skipMessage); +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 const kStringMaxLength = process.binding('buffer').kStringMaxLength; diff --git a/test/async-hooks/test-connection.ssl.js b/test/async-hooks/test-connection.ssl.js index 2c0a2772b4d9..faee0fdf080e 100644 --- a/test/async-hooks/test-connection.ssl.js +++ b/test/async-hooks/test-connection.ssl.js @@ -1,14 +1,14 @@ 'use strict'; +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const initHooks = require('./init-hooks'); const tick = require('./tick'); -const common = require('../common'); const assert = require('assert'); const { checkInvocations } = require('./hook-checks'); -if (!common.hasCrypto) - common.skip('missing crypto'); - const tls = require('tls'); const Connection = process.binding('crypto').Connection; const hooks = initHooks(); diff --git a/test/async-hooks/test-graph.connection.js b/test/async-hooks/test-graph.connection.js index e2a80523bc16..fcc764b5ccf2 100644 --- a/test/async-hooks/test-graph.connection.js +++ b/test/async-hooks/test-graph.connection.js @@ -1,12 +1,12 @@ 'use strict'; -const initHooks = require('./init-hooks'); const common = require('../common'); -const verifyGraph = require('./verify-graph'); - if (!common.hasCrypto) common.skip('missing crypto'); +const initHooks = require('./init-hooks'); +const verifyGraph = require('./verify-graph'); + const tls = require('tls'); const Connection = process.binding('crypto').Connection; const hooks = initHooks(); diff --git a/test/async-hooks/test-graph.shutdown.js b/test/async-hooks/test-graph.shutdown.js index f58474cb3fe3..136f01821217 100644 --- a/test/async-hooks/test-graph.shutdown.js +++ b/test/async-hooks/test-graph.shutdown.js @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); -const initHooks = require('./init-hooks'); -const verifyGraph = require('./verify-graph'); - if (!common.hasIPv6) common.skip('IPv6 support required'); +const initHooks = require('./init-hooks'); +const verifyGraph = require('./verify-graph'); const net = require('net'); const hooks = initHooks(); diff --git a/test/async-hooks/test-graph.tcp.js b/test/async-hooks/test-graph.tcp.js index f640b9215e5f..872615990733 100644 --- a/test/async-hooks/test-graph.tcp.js +++ b/test/async-hooks/test-graph.tcp.js @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); -const initHooks = require('./init-hooks'); -const verifyGraph = require('./verify-graph'); - if (!common.hasIPv6) common.skip('IPv6 support required'); +const initHooks = require('./init-hooks'); +const verifyGraph = require('./verify-graph'); const net = require('net'); const hooks = initHooks(); diff --git a/test/async-hooks/test-graph.tls-write.js b/test/async-hooks/test-graph.tls-write.js index 6bcac46cf87e..338a714c3223 100644 --- a/test/async-hooks/test-graph.tls-write.js +++ b/test/async-hooks/test-graph.tls-write.js @@ -1,17 +1,17 @@ 'use strict'; const common = require('../common'); -const initHooks = require('./init-hooks'); -const verifyGraph = require('./verify-graph'); -const fs = require('fs'); - if (!common.hasCrypto) common.skip('missing crypto'); if (!common.hasIPv6) common.skip('IPv6 support required'); +const initHooks = require('./init-hooks'); +const verifyGraph = require('./verify-graph'); +const fs = require('fs'); const tls = require('tls'); + const hooks = initHooks(); hooks.enable(); diff --git a/test/async-hooks/test-tcpwrap.js b/test/async-hooks/test-tcpwrap.js index e69d79d3fa1f..b4021753a072 100644 --- a/test/async-hooks/test-tcpwrap.js +++ b/test/async-hooks/test-tcpwrap.js @@ -2,14 +2,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('IPv6 support required'); + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); - -if (!common.hasIPv6) - common.skip('IPv6 support required'); - const net = require('net'); let tcp1, tcp2, tcp3; diff --git a/test/async-hooks/test-tlswrap.js b/test/async-hooks/test-tlswrap.js index 6e7942a1bf91..878afac06311 100644 --- a/test/async-hooks/test-tlswrap.js +++ b/test/async-hooks/test-tlswrap.js @@ -1,16 +1,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const fs = require('fs'); const { checkInvocations } = require('./hook-checks'); - -if (!common.hasCrypto) - common.skip('missing crypto'); - const tls = require('tls'); + const hooks = initHooks(); hooks.enable(); diff --git a/test/async-hooks/test-ttywrap.writestream.js b/test/async-hooks/test-ttywrap.writestream.js index 2345cac8586e..990460b53760 100644 --- a/test/async-hooks/test-ttywrap.writestream.js +++ b/test/async-hooks/test-ttywrap.writestream.js @@ -1,14 +1,15 @@ 'use strict'; const common = require('../common'); + +const tty_fd = common.getTTYfd(); +if (tty_fd < 0) + common.skip('no valid TTY fd available'); + const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); -const tty_fd = common.getTTYfd(); - -if (tty_fd < 0) - common.skip('no valid TTY fd available'); const ttyStream = (() => { try { diff --git a/test/async-hooks/test-writewrap.js b/test/async-hooks/test-writewrap.js index b842236c9dab..eca0d08f10f4 100644 --- a/test/async-hooks/test-writewrap.js +++ b/test/async-hooks/test-writewrap.js @@ -1,15 +1,15 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const initHooks = require('./init-hooks'); const fs = require('fs'); const { checkInvocations } = require('./hook-checks'); - -if (!common.hasCrypto) - common.skip('missing crypto'); - const tls = require('tls'); + const hooks = initHooks(); hooks.enable(); diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 53dd0f22441d..64f1d7f8b142 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -1,10 +1,6 @@ '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'); @@ -12,6 +8,9 @@ try { 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 d8885b26d65c..4a4d3a895c3f 100644 --- a/test/doctool/test-doctool-json.js +++ b/test/doctool/test-doctool-json.js @@ -1,10 +1,6 @@ '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'); @@ -12,6 +8,9 @@ try { 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 4670e5aa1ed8..2ce75a537677 100644 --- a/test/fixtures/tls-connect.js +++ b/test/fixtures/tls-connect.js @@ -4,13 +4,13 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); -const join = require('path').join; // Check if Node was compiled --without-ssl and if so exit early // as the require of tls will otherwise throw an Error. if (!common.hasCrypto) common.skip('missing crypto'); +const fs = require('fs'); +const join = require('path').join; const tls = require('tls'); const util = require('util'); diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index a7567d6e16cf..0ec4bbd9ce5a 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.inFreeBSDJail) + common.skip('in a FreeBSD jail'); + const assert = require('assert'); const dgram = require('dgram'); const util = require('util'); @@ -35,9 +38,6 @@ const messages = [ Buffer.from('Fourth message to send') ]; -if (common.inFreeBSDJail) - common.skip('in a FreeBSD jail'); - 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 d970cfc27274..a7854652eab4 100644 --- a/test/internet/test-dgram-multicast-multi-process.js +++ b/test/internet/test-dgram-multicast-multi-process.js @@ -21,6 +21,10 @@ 'use strict'; const common = require('../common'); +// Skip test in FreeBSD jails. +if (common.inFreeBSDJail) + common.skip('In a FreeBSD jail'); + const assert = require('assert'); const dgram = require('dgram'); const fork = require('child_process').fork; @@ -37,10 +41,6 @@ const listeners = 3; let listening, sendSocket, done, timer, dead; -// Skip test in FreeBSD jails. -if (common.inFreeBSDJail) - common.skip('In a FreeBSD jail'); - 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 edaba545f9a5..9b9360c2a162 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,9 +11,6 @@ const isIPv6 = net.isIPv6; let running = false; const queue = []; -if (!common.hasIPv6) - common.skip('this test, no IPv6 support'); - function TEST(f) { function next() { const f = queue.shift(); diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index b833e8e5dfdd..4aa36261dbb2 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -28,13 +28,13 @@ */ const common = require('../common'); +if (common.isWindows) + common.skip('Sending dgram sockets to child processes is not supported'); + const dgram = require('dgram'); const fork = require('child_process').fork; const assert = require('assert'); -if (common.isWindows) - common.skip('Sending dgram sockets to child processes is not supported'); - 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 6679cad2b7ce..99f7a20c4946 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -21,16 +21,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - if (common.isWindows) common.skip('not reliable on Windows.'); if (process.getuid() === 0) common.skip('Test is not supposed to be run as root.'); +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); + if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((exitCode) => { assert.strictEqual(exitCode, 0); diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js index 955f0649975c..3688c67f6c68 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + const NUM_WORKERS = 4; const PACKETS_PER_WORKER = 10; @@ -28,10 +31,6 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); - -if (common.isWindows) - common.skip('dgram clustering is currently not supported on Windows.'); - if (cluster.isMaster) master(); else diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js index 5b3743757211..7c1dae65600f 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + const NUM_WORKERS = 4; const PACKETS_PER_WORKER = 10; @@ -28,10 +31,6 @@ const cluster = require('cluster'); const dgram = require('dgram'); const assert = require('assert'); - -if (common.isWindows) - common.skip('dgram clustering is currently not supported on Windows.'); - if (cluster.isMaster) master(); else diff --git a/test/parallel/test-cluster-dgram-reuse.js b/test/parallel/test-cluster-dgram-reuse.js index 7d76a3426874..51a4944e5548 100644 --- a/test/parallel/test-cluster-dgram-reuse.js +++ b/test/parallel/test-cluster-dgram-reuse.js @@ -1,12 +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.'); - if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((code) => { assert.strictEqual(code, 0); diff --git a/test/parallel/test-cluster-disconnect-race.js b/test/parallel/test-cluster-disconnect-race.js index 3afed91c8158..60d8697b671b 100644 --- a/test/parallel/test-cluster-disconnect-race.js +++ b/test/parallel/test-cluster-disconnect-race.js @@ -4,13 +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.'); - cluster.schedulingPolicy = cluster.SCHED_NONE; if (cluster.isMaster) { diff --git a/test/parallel/test-cluster-http-pipe.js b/test/parallel/test-cluster-http-pipe.js index 2ae7433d60b1..96f741e80443 100644 --- a/test/parallel/test-cluster-http-pipe.js +++ b/test/parallel/test-cluster-http-pipe.js @@ -22,15 +22,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const http = require('http'); - if (common.isWindows) { common.skip( 'It is not possible to send pipe handles over the IPC pipe on Windows'); } +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 f89bea585f2f..8f05b28fed33 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -21,16 +21,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - if (common.isWindows) common.skip('not reliable on Windows'); if (process.getuid() === 0) common.skip('as this test should not be run as `root`'); +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. cluster.schedulingPolicy = cluster.SCHED_NONE; diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index c26c161570ec..c03aa0efce54 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index 1438b4a3b6c4..61d8ea8193d5 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js index 7fbf6f968570..96ca44fec828 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 87153f012123..84f25316d49b 100644 --- a/test/parallel/test-crypto-deprecated.js +++ b/test/parallel/test-crypto-deprecated.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 20afc178dc66..449c482d351c 100644 --- a/test/parallel/test-crypto-dh-odd-key.js +++ b/test/parallel/test-crypto-dh-odd-key.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 82a07026eaf3..3b51dc559063 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -1,11 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 4924c21177b1..d579331287c4 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -21,12 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const domain = require('domain'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const domain = require('domain'); const crypto = require('crypto'); function test(fn) { diff --git a/test/parallel/test-crypto-domains.js b/test/parallel/test-crypto-domains.js index 4e84f2407c67..be87cad6ff6f 100644 --- a/test/parallel/test-crypto-domains.js +++ b/test/parallel/test-crypto-domains.js @@ -21,16 +21,16 @@ 'use strict'; const common = require('../common'); -const domain = require('domain'); -const assert = require('assert'); -const d = domain.create(); -const expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes']; - 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']; + 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 f444a3711e97..4faf4af2c576 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -21,14 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); if (common.hasFipsCrypto) common.skip('BF-ECB is not FIPS 140-2 compatible'); +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js index 0c71af412440..f1d81f078bd5 100644 --- a/test/parallel/test-crypto-fips.js +++ b/test/parallel/test-crypto-fips.js @@ -1,12 +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'); - 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 9a4df572b84c..ed1be9b31572 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -25,11 +25,10 @@ const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const crypto = require('crypto'); const EXTERN_APEX = 0xFBEE9; diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 3fbc8731fcb8..f76e4f98c851 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -const path = require('path'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); const crypto = require('crypto'); // Test hashing diff --git a/test/parallel/test-crypto-hmac.js b/test/parallel/test-crypto-hmac.js index d14a89a6fd21..a10e8a731be0 100644 --- a/test/parallel/test-crypto-hmac.js +++ b/test/parallel/test-crypto-hmac.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const crypto = require('crypto'); // Test for binding layer robustness diff --git a/test/parallel/test-crypto-padding-aes256.js b/test/parallel/test-crypto-padding-aes256.js index 77fb89e1e832..9fb80f3eed78 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 b00f464cca74..6ad504d12c2c 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 ceb311e89863..f8f428652506 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 d506f69ca999..813df587325b 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); - if (!common.hasCrypto) common.skip('missing crypto'); -const constants = require('crypto').constants; +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 ca38d8889547..5d19917c488f 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -1,13 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); const exec = require('child_process').exec; - -if (!common.hasCrypto) - common.skip('missing crypto'); - const crypto = require('crypto'); // Test certificates diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index bc2a400ab900..1c3b8bbcbb1c 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -21,13 +21,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const stream = require('stream'); -const util = require('util'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const stream = require('stream'); +const util = require('util'); const crypto = require('crypto'); // Small stream to buffer converter diff --git a/test/parallel/test-cwd-enoent-preload.js b/test/parallel/test-cwd-enoent-preload.js index 479c2b5888ff..8979547c0dea 100644 --- a/test/parallel/test-cwd-enoent-preload.js +++ b/test/parallel/test-cwd-enoent-preload.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); -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'); +const assert = require('assert'); +const fs = require('fs'); +const spawn = require('child_process').spawn; + 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 ac44d9277be6..bb41b1fccd8b 100644 --- a/test/parallel/test-cwd-enoent-repl.js +++ b/test/parallel/test-cwd-enoent-repl.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); -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'); +const assert = require('assert'); +const fs = require('fs'); +const spawn = require('child_process').spawn; + 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 cce3c697eee6..27df46acf89e 100644 --- a/test/parallel/test-cwd-enoent.js +++ b/test/parallel/test-cwd-enoent.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); -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'); +const assert = require('assert'); +const fs = require('fs'); +const spawn = require('child_process').spawn; + 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 481d674bfc81..a264029f434a 100644 --- a/test/parallel/test-debug-usage.js +++ b/test/parallel/test-debug-usage.js @@ -1,11 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const spawn = require('child_process').spawn; + 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 93284569a770..762ead7c869e 100755 --- a/test/parallel/test-dgram-bind-default-address.js +++ b/test/parallel/test-dgram-bind-default-address.js @@ -21,13 +21,13 @@ '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) common.skip('In a FreeBSD jail'); +const assert = require('assert'); +const dgram = require('dgram'); + dgram.createSocket('udp4').bind(0, common.mustCall(function() { assert.strictEqual(typeof this.address().port, 'number'); assert.ok(isFinite(this.address().port)); diff --git a/test/parallel/test-dgram-cluster-close-during-bind.js b/test/parallel/test-dgram-cluster-close-during-bind.js index 882c33a09888..4e8cdbf9d35c 100644 --- a/test/parallel/test-dgram-cluster-close-during-bind.js +++ b/test/parallel/test-dgram-cluster-close-during-bind.js @@ -1,12 +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.'); - if (cluster.isMaster) { cluster.fork(); } else { diff --git a/test/parallel/test-dgram-send-empty-buffer.js b/test/parallel/test-dgram-send-empty-buffer.js index 98a092325cef..554a3c9185c8 100644 --- a/test/parallel/test-dgram-send-empty-buffer.js +++ b/test/parallel/test-dgram-send-empty-buffer.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (common.isOSX) common.skip('because of 17894467 Apple bug'); +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 94fd987dc168..b425e9eb1582 100644 --- a/test/parallel/test-dgram-send-empty-packet.js +++ b/test/parallel/test-dgram-send-empty-packet.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (common.isOSX) common.skip('because of 17894467 Apple bug'); +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 5434dcd15154..d801ca7e8dcd 100644 --- a/test/parallel/test-dgram-udp6-send-default-host.js +++ b/test/parallel/test-dgram-udp6-send-default-host.js @@ -1,12 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const dgram = require('dgram'); - if (!common.hasIPv6) common.skip('no IPv6 support'); +const assert = require('assert'); +const dgram = require('dgram'); + const client = dgram.createSocket('udp6'); const toSend = [Buffer.alloc(256, 'x'), diff --git a/test/parallel/test-dsa-fips-invalid-key.js b/test/parallel/test-dsa-fips-invalid-key.js index 38f86d315ba0..b88c05a87cbf 100644 --- a/test/parallel/test-dsa-fips-invalid-key.js +++ b/test/parallel/test-dsa-fips-invalid-key.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasFipsCrypto) common.skip('node compiled without FIPS OpenSSL.'); +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 b5a0b78ad136..ae60b16f1a3f 100644 --- a/test/parallel/test-fs-long-path.js +++ b/test/parallel/test-fs-long-path.js @@ -21,13 +21,13 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('this test is Windows-specific.'); + const fs = require('fs'); const path = require('path'); const assert = require('assert'); -if (!common.isWindows) - common.skip('this test is Windows-specific.'); - // make a path that will be at least 260 chars long. const fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1); const fileName = path.join(common.tmpDir, 'x'.repeat(fileNameLen)); diff --git a/test/parallel/test-fs-read-file-sync-hostname.js b/test/parallel/test-fs-read-file-sync-hostname.js index b60f611ed887..599f48b6ccfc 100644 --- a/test/parallel/test-fs-read-file-sync-hostname.js +++ b/test/parallel/test-fs-read-file-sync-hostname.js @@ -21,12 +21,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); - if (!common.isLinux) common.skip('Test is linux specific.'); +const assert = require('assert'); +const fs = require('fs'); + // 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 02d75a253e21..e8e69d6ee2fc 100644 --- a/test/parallel/test-fs-readdir-ucs2.js +++ b/test/parallel/test-fs-readdir-ucs2.js @@ -1,13 +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.'); - 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 b0eb39b4c9c0..d9ad834afcdc 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -21,15 +21,15 @@ '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) common.skip('platform not supported.'); +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'); const execPath = `"${process.execPath}" "${filename}"`; diff --git a/test/parallel/test-fs-readfile-pipe-large.js b/test/parallel/test-fs-readfile-pipe-large.js index eb708780bbdf..46603b14fa0a 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -1,13 +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) common.skip(`No /dev/stdin on ${process.platform}.`); +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 6012dd9bab7d..e15c2c10476c 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -21,13 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); // simulate `cat readfile.js | node readfile.js` if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); +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 35533ef987f4..daa53bf3de0c 100644 --- a/test/parallel/test-fs-readfilesync-pipe-large.js +++ b/test/parallel/test-fs-readfilesync-pipe-large.js @@ -1,13 +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) common.skip(`No /dev/stdin on ${process.platform}.`); +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 9ace64cf6315..a3d38d9f2797 100644 --- a/test/parallel/test-fs-realpath-on-substed-drive.js +++ b/test/parallel/test-fs-realpath-on-substed-drive.js @@ -1,13 +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'); - let result; // create a subst drive diff --git a/test/parallel/test-fs-symlink.js b/test/parallel/test-fs-symlink.js index 92cae6ffc0a5..9e19958b6287 100644 --- a/test/parallel/test-fs-symlink.js +++ b/test/parallel/test-fs-symlink.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (!common.canCreateSymLink()) + common.skip('insufficient privileges'); + const assert = require('assert'); const path = require('path'); const fs = require('fs'); @@ -28,9 +31,6 @@ const fs = require('fs'); let linkTime; let fileTime; -if (!common.canCreateSymLink()) - common.skip('insufficient privileges'); - common.refreshTmpDir(); // test creating and reading symbolic link diff --git a/test/parallel/test-fs-watch-encoding.js b/test/parallel/test-fs-watch-encoding.js index ac3bd19646bb..b9488f7a7f84 100644 --- a/test/parallel/test-fs-watch-encoding.js +++ b/test/parallel/test-fs-watch-encoding.js @@ -11,8 +11,6 @@ // 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 @@ -21,6 +19,9 @@ const path = require('path'); if (common.isAix) common.skip('folder watch capability is limited in AIX.'); +const fs = require('fs'); +const path = require('path'); + common.refreshTmpDir(); const fn = '新建文夹件.txt'; diff --git a/test/parallel/test-http-chunk-problem.js b/test/parallel/test-http-chunk-problem.js index f6aae676944f..46a7406e7459 100644 --- a/test/parallel/test-http-chunk-problem.js +++ b/test/parallel/test-http-chunk-problem.js @@ -1,10 +1,11 @@ 'use strict'; // http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919 const common = require('../common'); -const assert = require('assert'); if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); + if (process.argv[2] === 'request') { const http = require('http'); const options = { diff --git a/test/parallel/test-http-localaddress.js b/test/parallel/test-http-localaddress.js index 63d4ea446772..0ed048688eef 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -21,12 +21,12 @@ 'use strict'; const common = require('../common'); -const http = require('http'); -const assert = require('assert'); - if (!common.hasMultiLocalhost()) common.skip('platform-specific test.'); +const http = require('http'); +const assert = require('assert'); + 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 b1ddba31e607..b644e7530ff8 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const https = require('https'); - const url = require('url'); const fs = require('fs'); diff --git a/test/parallel/test-https-agent-disable-session-reuse.js b/test/parallel/test-https-agent-disable-session-reuse.js index 6fb06c56e21f..4f92547e999a 100644 --- a/test/parallel/test-https-agent-disable-session-reuse.js +++ b/test/parallel/test-https-agent-disable-session-reuse.js @@ -1,16 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); -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-secure-protocol.js b/test/parallel/test-https-agent-secure-protocol.js index 396332858f97..4839dd7c460d 100644 --- a/test/parallel/test-https-agent-secure-protocol.js +++ b/test/parallel/test-https-agent-secure-protocol.js @@ -1,10 +1,9 @@ 'use strict'; -const assert = require('assert'); const common = require('../common'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const https = require('https'); const fs = require('fs'); diff --git a/test/parallel/test-https-agent-sni.js b/test/parallel/test-https-agent-sni.js index d48defbcbb14..a06ce439fa43 100644 --- a/test/parallel/test-https-agent-sni.js +++ b/test/parallel/test-https-agent-sni.js @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const https = require('https'); - const fs = require('fs'); const options = { diff --git a/test/parallel/test-https-agent.js b/test/parallel/test-https-agent.js index de939132f994..e2e71cd31a76 100644 --- a/test/parallel/test-https-agent.js +++ b/test/parallel/test-https-agent.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 2bbd427363c4..8f4d761c02b7 100644 --- a/test/parallel/test-https-byteswritten.js +++ b/test/parallel/test-https-byteswritten.js @@ -21,12 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const fs = require('fs'); 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 5806df25dbfc..9842fc1f357e 100644 --- a/test/parallel/test-https-client-checkServerIdentity.js +++ b/test/parallel/test-https-client-checkServerIdentity.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 81c67ec305c5..f0e919ca648b 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -21,18 +21,17 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); - -if (!common.hasCrypto) - common.skip('missing crypto'); - const https = require('https'); - const fs = require('fs'); const url = require('url'); + const URL = url.URL; const options = { diff --git a/test/parallel/test-https-client-reject.js b/test/parallel/test-https-client-reject.js index 129b218081a4..82a7851e4e11 100644 --- a/test/parallel/test-https-client-reject.js +++ b/test/parallel/test-https-client-reject.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 1f85a0bb44cd..d61d91964b0e 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -24,13 +24,11 @@ // Cache session and close connection. Use session on second connection. // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 996b6ab02065..1590f3cb5b38 100644 --- a/test/parallel/test-https-close.js +++ b/test/parallel/test-https-close.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); - if (!common.hasCrypto) common.skip('missing crypto'); +const fs = require('fs'); const https = require('https'); const options = { diff --git a/test/parallel/test-https-connecting-to-http.js b/test/parallel/test-https-connecting-to-http.js index 99050540b1de..195ad38ed44a 100644 --- a/test/parallel/test-https-connecting-to-http.js +++ b/test/parallel/test-https-connecting-to-http.js @@ -23,13 +23,11 @@ // This tests the situation where you try to connect a https client // to an http server. You should get an error and exit. const common = require('../common'); -const http = require('http'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 e6bd9f1b673d..f9316a261b98 100644 --- a/test/parallel/test-https-drain.js +++ b/test/parallel/test-https-drain.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 b85059ab3647..3c724fe6342d 100644 --- a/test/parallel/test-https-eof-for-eom.js +++ b/test/parallel/test-https-eof-for-eom.js @@ -29,14 +29,12 @@ // correctly. const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 dcc53456567d..d8beefc22b25 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -21,19 +21,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 join = require('path').join; - const fs = require('fs'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) - common.skip('missing crypto'); - 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 64fc8e15b693..1181d300bf29 100644 --- a/test/parallel/test-https-host-headers.js +++ b/test/parallel/test-https-host-headers.js @@ -1,13 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 1804e4f1e474..a22db1e9e615 100644 --- a/test/parallel/test-https-localaddress-bind-error.js +++ b/test/parallel/test-https-localaddress-bind-error.js @@ -21,12 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +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 20116eb7cf1b..1c5669be30c1 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -21,17 +21,16 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); -const https = require('https'); - if (!common.hasMultiLocalhost()) common.skip('platform-specific test.'); +const fs = require('fs'); +const assert = require('assert'); +const https = require('https'); + 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-pfx.js b/test/parallel/test-https-pfx.js index 987a811e1011..d7561f742462 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -21,12 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const fs = require('fs'); 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 27dbbc558709..d0306cb714fb 100644 --- a/test/parallel/test-https-req-split.js +++ b/test/parallel/test-https-req-split.js @@ -21,12 +21,12 @@ 'use strict'; const common = require('../common'); -// disable strict server certificate validation by the client -process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; - if (!common.hasCrypto) common.skip('missing crypto'); +// disable strict server certificate validation by the client +process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-socket-options.js b/test/parallel/test-https-socket-options.js index da99c6e36625..2a6fc8f84f78 100644 --- a/test/parallel/test-https-socket-options.js +++ b/test/parallel/test-https-socket-options.js @@ -26,9 +26,7 @@ if (!common.hasCrypto) common.skip('missing crypto'); 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 9bf574c732cd..060151332d27 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); - -if (!common.hasCrypto) - common.skip('missing crypto'); - 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 73c713a48c45..269c06569f6b 100644 --- a/test/parallel/test-https-timeout-server-2.js +++ b/test/parallel/test-https-timeout-server-2.js @@ -22,13 +22,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const https = require('https'); - const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-inspector-open.js b/test/parallel/test-inspector-open.js index bc7d15a554aa..346393d6fac6 100644 --- a/test/parallel/test-inspector-open.js +++ b/test/parallel/test-inspector-open.js @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); +common.skipIfInspectorDisabled(); // Test inspector open()/close()/url() API. It uses ephemeral ports so can be // run safely in parallel. @@ -9,8 +10,6 @@ const fork = require('child_process').fork; const net = require('net'); const url = require('url'); -common.skipIfInspectorDisabled(); - if (process.env.BE_CHILD) return beChild(); diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index 644948e60049..4f74a5b22d6e 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); @@ -28,9 +31,6 @@ const cluster = require('cluster'); console.error('Cluster listen fd test', process.argv[2] || 'runner'); -if (common.isWindows) - common.skip('This test is disabled on windows.'); - // 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 737154420a2b..aad8d663c915 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -21,14 +21,14 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) - common.skip('This test is disabled on windows.'); - 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 983eee7427ad..cc9cb6471e40 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -21,14 +21,14 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) - common.skip('This test is disabled on windows.'); - 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 ef616f95812a..b21b5ee55d2e 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -21,13 +21,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); -if (common.isWindows) - common.skip('This test is disabled on windows.'); - switch (process.argv[2]) { case 'child': return child(); } diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index 3cb8cf81ab9c..68e63f0ba4cb 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Does not support wrapping sockets with fd on Windows'); + const assert = require('assert'); const net = require('net'); const path = require('path'); const Pipe = process.binding('pipe_wrap').Pipe; -if (common.isWindows) - common.skip('Does not support wrapping sockets with fd on Windows'); - common.refreshTmpDir(); function testClients(getSocketOpt, getConnectOpt, getConnectCb) { diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index f0ef7198dc10..29b07645c452 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -21,12 +21,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - if (!common.hasIPv6) common.skip('no IPv6 support'); +const assert = require('assert'); +const net = require('net'); + const hosts = common.localIPv6Hosts; let hostIdx = 0; let host = hosts[hostIdx]; diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index 03f3b25916df..c4f11db76bc4 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -1,12 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - // skip test in FreeBSD jails if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); +const assert = require('assert'); +const net = require('net'); + let conns = 0; const clientLocalPorts = []; const serverRemotePorts = []; diff --git a/test/parallel/test-pipe-writev.js b/test/parallel/test-pipe-writev.js index 60daeb636322..db95a4b18184 100644 --- a/test/parallel/test-pipe-writev.js +++ b/test/parallel/test-pipe-writev.js @@ -1,12 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - if (common.isWindows) common.skip('Unix-specific test'); +const assert = require('assert'); +const net = require('net'); + common.refreshTmpDir(); const server = net.createServer((connection) => { diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index edf6f5388fa6..a5f8a0c27650 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -1,14 +1,14 @@ 'use strict'; const common = require('../common'); -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'); +const assert = require('assert'); +const path = require('path'); +const childProcess = require('child_process'); + 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 51ae592d9f74..d70d1dfd3898 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,9 +10,6 @@ const fs = require('fs'); assert.strictEqual(process.execPath, fs.realpathSync(process.execPath)); -if (common.isWindows) - common.skip('symlinks are weird on windows'); - 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-remove-all-signal-listeners.js b/test/parallel/test-process-remove-all-signal-listeners.js index 283e4b6f69ae..759820c2dc56 100644 --- a/test/parallel/test-process-remove-all-signal-listeners.js +++ b/test/parallel/test-process-remove-all-signal-listeners.js @@ -1,12 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; - if (common.isWindows) common.skip('Win32 does not support signals.'); +const assert = require('assert'); +const spawn = require('child_process').spawn; + 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-3542.js b/test/parallel/test-regress-GH-3542.js index 8747b88c0324..b652c95c9ac8 100644 --- a/test/parallel/test-regress-GH-3542.js +++ b/test/parallel/test-regress-GH-3542.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); -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.'); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); + 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 965f30b27c8e..7eed1c512f79 100644 --- a/test/parallel/test-regress-GH-9819.js +++ b/test/parallel/test-regress-GH-9819.js @@ -1,11 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const execFile = require('child_process').execFile; - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const execFile = require('child_process').execFile; + const setup = 'const enc = { toString: () => { throw new Error("xyz"); } };'; const scripts = [ diff --git a/test/parallel/test-repl-sigint-nested-eval.js b/test/parallel/test-repl-sigint-nested-eval.js index 1dc093df4f97..7f15b7dfeb8b 100644 --- a/test/parallel/test-repl-sigint-nested-eval.js +++ b/test/parallel/test-repl-sigint-nested-eval.js @@ -1,14 +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'); } +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 5268ee7545ac..818111c39bf5 100644 --- a/test/parallel/test-repl-sigint.js +++ b/test/parallel/test-repl-sigint.js @@ -1,14 +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'); } +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 0cf61c20af55..aaaf07d48ae8 100644 --- a/test/parallel/test-require-long-path.js +++ b/test/parallel/test-require-long-path.js @@ -1,11 +1,11 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); -const path = require('path'); - if (!common.isWindows) common.skip('this test is Windows-specific.'); +const fs = require('fs'); +const path = require('path'); + // 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-spawn-cmd-named-pipe.js b/test/parallel/test-spawn-cmd-named-pipe.js index a8350ba0d41b..30d0ec2c263f 100644 --- a/test/parallel/test-spawn-cmd-named-pipe.js +++ b/test/parallel/test-spawn-cmd-named-pipe.js @@ -1,11 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - // This test is intended for Windows only if (!common.isWindows) common.skip('this test is Windows-specific.'); +const assert = require('assert'); + if (!process.argv[2]) { // parent const net = require('net'); diff --git a/test/parallel/test-tls-0-dns-altname.js b/test/parallel/test-tls-0-dns-altname.js index 060e41ce0272..0b1c7f6496ce 100644 --- a/test/parallel/test-tls-0-dns-altname.js +++ b/test/parallel/test-tls-0-dns-altname.js @@ -21,15 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -// Check getPeerCertificate can properly handle '\0' for fix CVE-2009-2408. - if (!common.hasCrypto) common.skip('missing crypto'); -const tls = require('tls'); +// Check getPeerCertificate can properly handle '\0' for fix CVE-2009-2408. +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 ff776550b29d..0b3447243db7 100644 --- a/test/parallel/test-tls-alert-handling.js +++ b/test/parallel/test-tls-alert-handling.js @@ -1,12 +1,12 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) - common.skip('node compiled without OpenSSL CLI.'); - if (!common.hasCrypto) common.skip('missing crypto'); +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); + const fs = require('fs'); const net = require('net'); const path = require('path'); diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index 21bc3c186789..8aa56eaf755a 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -21,12 +21,12 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) - common.skip('node compiled without OpenSSL CLI.'); - 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'); const fs = require('fs'); diff --git a/test/parallel/test-tls-client-abort.js b/test/parallel/test-tls-client-abort.js index 368bebcbedee..14f96104e16a 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 0a1cd0ee5dcd..59b592d25566 100644 --- a/test/parallel/test-tls-client-abort2.js +++ b/test/parallel/test-tls-client-abort2.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 f43fe7fa8479..0630fe947e7f 100644 --- a/test/parallel/test-tls-client-default-ciphers.js +++ b/test/parallel/test-tls-client-default-ciphers.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 07ef8315996d..a94e8fbdb98a 100644 --- a/test/parallel/test-tls-client-destroy-soon.js +++ b/test/parallel/test-tls-client-destroy-soon.js @@ -25,13 +25,11 @@ // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 f946d6e3b1f7..53e0144ac73d 100644 --- a/test/parallel/test-tls-client-getephemeralkeyinfo.js +++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js @@ -1,13 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 b5c6ee0c33c7..230c6e08458c 100644 --- a/test/parallel/test-tls-client-mindhsize.js +++ b/test/parallel/test-tls-client-mindhsize.js @@ -1,13 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 e9f561797651..a11e0fe28028 100644 --- a/test/parallel/test-tls-client-reject.js +++ b/test/parallel/test-tls-client-reject.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 68625bc74f52..fccdf6d930c0 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -25,13 +25,11 @@ // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const tls = require('tls'); - const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-close-error.js b/test/parallel/test-tls-close-error.js index f9b563f6c6ee..9973adde1220 100644 --- a/test/parallel/test-tls-close-error.js +++ b/test/parallel/test-tls-close-error.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 e6b259c366f9..500aec26c8d2 100644 --- a/test/parallel/test-tls-close-notify.js +++ b/test/parallel/test-tls-close-notify.js @@ -26,7 +26,6 @@ if (!common.hasCrypto) common.skip('missing crypto'); const tls = require('tls'); - const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-connect-given-socket.js b/test/parallel/test-tls-connect-given-socket.js index cabf24643e2b..d922d7d4d532 100644 --- a/test/parallel/test-tls-connect-given-socket.js +++ b/test/parallel/test-tls-connect-given-socket.js @@ -21,16 +21,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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.js b/test/parallel/test-tls-connect.js index 227b4fae7b4a..5e73196bc1f8 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -26,7 +26,6 @@ if (!common.hasCrypto) common.skip('missing crypto'); const tls = require('tls'); - const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-delayed-attach.js b/test/parallel/test-tls-delayed-attach.js index e1f1fc878f3d..9ab611566583 100644 --- a/test/parallel/test-tls-delayed-attach.js +++ b/test/parallel/test-tls-delayed-attach.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const tls = require('tls'); - const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js index c071091a98ce..fe17206fdcdc 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -22,18 +22,17 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); if (!common.opensslCli) common.skip('missing openssl-cli'); +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 4a00aa337eb9..65ee8fd69198 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); if (!common.opensslCli) common.skip('missing openssl-cli'); +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-econnreset.js b/test/parallel/test-tls-econnreset.js index e1e54470e76e..8a6536890e86 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 b4129fa0d53e..9a8e3449f0cb 100644 --- a/test/parallel/test-tls-empty-sni-context.js +++ b/test/parallel/test-tls-empty-sni-context.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); if (!process.features.tls_sni) common.skip('node compiled without OpenSSL or with old OpenSSL version.'); const assert = require('assert'); - -if (!common.hasCrypto) - common.skip('missing crypto'); - const tls = require('tls'); const options = { diff --git a/test/parallel/test-tls-external-accessor.js b/test/parallel/test-tls-external-accessor.js index 4192b3958a15..2d7b1f62b989 100644 --- a/test/parallel/test-tls-external-accessor.js +++ b/test/parallel/test-tls-external-accessor.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); -// 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 126fe66843e3..b846f732d2fb 100644 --- a/test/parallel/test-tls-fast-writing.js +++ b/test/parallel/test-tls-fast-writing.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 afe433da5057..644b298fb9a4 100644 --- a/test/parallel/test-tls-friendly-error-message.js +++ b/test/parallel/test-tls-friendly-error-message.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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-getprotocol.js b/test/parallel/test-tls-getprotocol.js index 585a0348f639..dd96aa6f7494 100644 --- a/test/parallel/test-tls-getprotocol.js +++ b/test/parallel/test-tls-getprotocol.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 5e5c86c2c27c..e4a4addd37be 100644 --- a/test/parallel/test-tls-handshake-error.js +++ b/test/parallel/test-tls-handshake-error.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const tls = require('tls'); - const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-honorcipherorder.js b/test/parallel/test-tls-honorcipherorder.js index 7eb1f893a597..a9d35a01baca 100644 --- a/test/parallel/test-tls-honorcipherorder.js +++ b/test/parallel/test-tls-honorcipherorder.js @@ -1,13 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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-js-stream.js b/test/parallel/test-tls-js-stream.js index 1a759558268e..f535a46cce59 100644 --- a/test/parallel/test-tls-js-stream.js +++ b/test/parallel/test-tls-js-stream.js @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js index 059c91440038..1cbcb8e272d6 100644 --- a/test/parallel/test-tls-max-send-fragment.js +++ b/test/parallel/test-tls-max-send-fragment.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 99de43245746..6e1a3c8777ee 100644 --- a/test/parallel/test-tls-multi-key.js +++ b/test/parallel/test-tls-multi-key.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 bcdaf1a472ab..11c86efa08e1 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -20,12 +20,11 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const assert = require('assert'); const common = require('../common'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 af7c4493a016..4551928acdcf 100644 --- a/test/parallel/test-tls-no-rsa-key.js +++ b/test/parallel/test-tls-no-rsa-key.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 690013ad63cb..737f42b530d9 100644 --- a/test/parallel/test-tls-no-sslv23.js +++ b/test/parallel/test-tls-no-sslv23.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 b465b4bcca8b..0a118dbe7e9d 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -1,18 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); -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.'); - 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()); diff --git a/test/parallel/test-tls-over-http-tunnel.js b/test/parallel/test-tls-over-http-tunnel.js index 331b74865536..5ff05b8504fd 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 3ae6577dff4a..c8cc06d35e4c 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 3ec17a0a6443..647b13c62a29 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 bd038e51ea1e..76781e095347 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 5abe8ad7c4b4..226772386253 100644 --- a/test/parallel/test-tls-peer-certificate-multi-keys.js +++ b/test/parallel/test-tls-peer-certificate-multi-keys.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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-request-timeout.js b/test/parallel/test-tls-request-timeout.js index 72d2bf161949..216b69bb2126 100644 --- a/test/parallel/test-tls-request-timeout.js +++ b/test/parallel/test-tls-request-timeout.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 9e982ac79117..4be64c15969f 100644 --- a/test/parallel/test-tls-retain-handle-no-abort.js +++ b/test/parallel/test-tls-retain-handle-no-abort.js @@ -1,11 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); const util = require('util'); diff --git a/test/parallel/test-tls-securepair-leak.js b/test/parallel/test-tls-securepair-leak.js index 7ebdfaa12adb..cbc7c7daddd7 100644 --- a/test/parallel/test-tls-securepair-leak.js +++ b/test/parallel/test-tls-securepair-leak.js @@ -2,11 +2,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const { createSecureContext } = require('tls'); const { createSecurePair } = require('_tls_legacy'); diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index 6ccf496ea1a6..6aebc8072212 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); if (!common.opensslCli) common.skip('missing openssl-cli'); +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-verify.js b/test/parallel/test-tls-server-verify.js index f0f0b168fcf6..dcae05eb9685 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -128,6 +128,7 @@ const testCases = } ]; + function filenamePEM(n) { return path.join(common.fixturesDir, 'keys', `${n}.pem`); } diff --git a/test/parallel/test-tls-set-encoding.js b/test/parallel/test-tls-set-encoding.js index 4f456aee1900..c9ff52b9b2fc 100644 --- a/test/parallel/test-tls-set-encoding.js +++ b/test/parallel/test-tls-set-encoding.js @@ -21,16 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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-socket-close.js b/test/parallel/test-tls-socket-close.js index 0a1911b5e8cb..f9a77bf4648b 100644 --- a/test/parallel/test-tls-socket-close.js +++ b/test/parallel/test-tls-socket-close.js @@ -4,7 +4,6 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); - const tls = require('tls'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-ticket-cluster.js b/test/parallel/test-tls-ticket-cluster.js index 7102fb460ce2..486aef835871 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 5e385a5271f9..bf1ce0d5eb42 100644 --- a/test/parallel/test-tls-ticket.js +++ b/test/parallel/test-tls-ticket.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 76d587f675b8..8513b29f2e94 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 b5855ea39b1f..a3d9a8164707 100644 --- a/test/parallel/test-tls-timeout-server.js +++ b/test/parallel/test-tls-timeout-server.js @@ -26,7 +26,6 @@ if (!common.hasCrypto) common.skip('missing crypto'); const tls = require('tls'); - const net = require('net'); const fs = require('fs'); diff --git a/test/parallel/test-util-sigint-watchdog.js b/test/parallel/test-util-sigint-watchdog.js index ec19c096fec2..6debd18d0500 100644 --- a/test/parallel/test-util-sigint-watchdog.js +++ b/test/parallel/test-util-sigint-watchdog.js @@ -1,13 +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'); } +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 5300d7cd0b7b..eb67820ff20d 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,11 +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'); -} - 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 bb836225fc68..ae205edb3d0a 100644 --- a/test/parallel/test-vm-sigint.js +++ b/test/parallel/test-vm-sigint.js @@ -1,16 +1,14 @@ 'use strict'; const common = require('../common'); - -const assert = require('assert'); -const vm = require('vm'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); } +const assert = require('assert'); +const vm = require('vm'); +const spawn = require('child_process').spawn; + if (process.argv[2] === 'child') { const method = process.argv[3]; const listeners = +process.argv[4]; diff --git a/test/parallel/test-whatwg-url-constructor.js b/test/parallel/test-whatwg-url-constructor.js index beb620a8dc1d..290f9266b54f 100644 --- a/test/parallel/test-whatwg-url-constructor.js +++ b/test/parallel/test-whatwg-url-constructor.js @@ -1,15 +1,15 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const { URL, URLSearchParams } = require('url'); -const { test, assert_equals, assert_true, assert_throws } = - require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); } +const path = require('path'); +const { URL, URLSearchParams } = require('url'); +const { test, assert_equals, assert_true, assert_throws } = + require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-tests')) }; diff --git a/test/parallel/test-whatwg-url-historical.js b/test/parallel/test-whatwg-url-historical.js index 46fde1632d6b..7848b1c1873a 100644 --- a/test/parallel/test-whatwg-url-historical.js +++ b/test/parallel/test-whatwg-url-historical.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); -const URL = require('url').URL; -const { test, assert_equals, assert_throws } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); } +const URL = require('url').URL; +const { test, assert_equals, assert_throws } = require('../common/wpt'); + /* eslint-disable */ /* WPT Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/historical.html diff --git a/test/parallel/test-whatwg-url-inspect.js b/test/parallel/test-whatwg-url-inspect.js index 4d0a25fc866b..5758b39b8af8 100644 --- a/test/parallel/test-whatwg-url-inspect.js +++ b/test/parallel/test-whatwg-url-inspect.js @@ -1,15 +1,15 @@ 'use strict'; const common = require('../common'); -const util = require('util'); -const URL = require('url').URL; -const assert = require('assert'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); } +const util = require('util'); +const URL = require('url').URL; +const assert = require('assert'); + // Tests below are not from WPT. const url = new URL('https://username:password@host.name:8080/path/name/?que=ry#hash'); diff --git a/test/parallel/test-whatwg-url-origin.js b/test/parallel/test-whatwg-url-origin.js index f73144e0e082..732100e142a5 100644 --- a/test/parallel/test-whatwg-url-origin.js +++ b/test/parallel/test-whatwg-url-origin.js @@ -1,14 +1,14 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const URL = require('url').URL; -const { test, assert_equals } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); } +const path = require('path'); +const URL = require('url').URL; +const { test, assert_equals } = require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-tests')) }; diff --git a/test/parallel/test-whatwg-url-parsing.js b/test/parallel/test-whatwg-url-parsing.js index 8f940273aea5..39756449c08c 100644 --- a/test/parallel/test-whatwg-url-parsing.js +++ b/test/parallel/test-whatwg-url-parsing.js @@ -1,15 +1,15 @@ 'use strict'; const common = require('../common'); -const URL = require('url').URL; -const path = require('path'); -const assert = require('assert'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); } +const URL = require('url').URL; +const path = require('path'); +const assert = require('assert'); + // Tests below are not from WPT. const tests = require(path.join(common.fixturesDir, 'url-tests')); const failureTests = tests.filter((test) => test.failure).concat([ diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index b6d0586c3b1e..938c2aa25387 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -1,6 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasIntl) { + // A handful of the tests fail when ICU is not included. + common.skip('missing Intl'); +} + const assert = require('assert'); const path = require('path'); const URL = require('url').URL; @@ -8,11 +13,6 @@ const { test, assert_equals } = require('../common/wpt'); const additionalTestCases = require( path.join(common.fixturesDir, 'url-setter-tests-additional.js')); -if (!common.hasIntl) { - // A handful of the tests fail when ICU is not included. - common.skip('missing Intl'); -} - const request = { response: require(path.join(common.fixturesDir, 'url-setter-tests')) }; diff --git a/test/parallel/test-whatwg-url-toascii.js b/test/parallel/test-whatwg-url-toascii.js index b614f599dfcc..851240ce650a 100644 --- a/test/parallel/test-whatwg-url-toascii.js +++ b/test/parallel/test-whatwg-url-toascii.js @@ -1,14 +1,14 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const { URL } = require('url'); -const { test, assert_equals, assert_throws } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); } +const path = require('path'); +const { URL } = require('url'); +const { test, assert_equals, assert_throws } = require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-toascii')) }; diff --git a/test/parallel/test-windows-abort-exitcode.js b/test/parallel/test-windows-abort-exitcode.js index 97232337b2e7..d61a91315bb6 100644 --- a/test/parallel/test-windows-abort-exitcode.js +++ b/test/parallel/test-windows-abort-exitcode.js @@ -1,16 +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'); - 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 5b5b334ef2d9..f15b31c2f42c 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -21,18 +21,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing 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 cd0442f28075..176a16c9eac8 100644 --- a/test/pummel/test-abort-fatal-error.js +++ b/test/pummel/test-abort-fatal-error.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (common.isWindows) common.skip('no RLIMIT_NOFILE on Windows'); +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 c2a2f42e7e2a..f64f982c0e11 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -21,12 +21,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const crypto = require('crypto'); - if (!common.hasCrypto) common.skip('node compiled without OpenSSL.'); +const assert = require('assert'); +const crypto = require('crypto'); + 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 8e17aabf9a85..4aad5ed20cbe 100644 --- a/test/pummel/test-crypto-timing-safe-equal-benchmarks.js +++ b/test/pummel/test-crypto-timing-safe-equal-benchmarks.js @@ -1,13 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); if (!common.enoughTestMem) common.skip('memory-intensive test'); +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 322bd866eda4..b8e0ca3f1f88 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.js @@ -21,11 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 f5ca97d123ee..41d10bf1d84e 100644 --- a/test/pummel/test-dtrace-jsstack.js +++ b/test/pummel/test-dtrace-jsstack.js @@ -21,12 +21,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const os = require('os'); - if (!common.isSunOS) common.skip('no DTRACE support'); +const assert = require('assert'); +const os = require('os'); + /* * 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 458232caf3a3..fbe0e37873c7 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -21,20 +21,18 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; - 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; const tls = require('tls'); const https = require('https'); - const fs = require('fs'); -if (!common.opensslCli) - common.skip('node compiled without OpenSSL CLI.'); - // 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 7cea39a90a03..7775ccca63e1 100644 --- a/test/pummel/test-https-large-response.js +++ b/test/pummel/test-https-large-response.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -const fs = require('fs'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const fs = require('fs'); 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 2d5761138367..b8071b9ba978 100644 --- a/test/pummel/test-https-no-reader.js +++ b/test/pummel/test-https-no-reader.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 d7263db2589b..d2387495c1c2 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -23,14 +23,14 @@ // This test requires the program 'wrk' const common = require('../common'); +if (common.isWindows) + common.skip('no `wrk` on windows'); + const assert = require('assert'); const spawn = require('child_process').spawn; const http = require('http'); const url = require('url'); -if (common.isWindows) - common.skip('no `wrk` on windows'); - 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 2b68d96a293f..b1d46adbabb3 100644 --- a/test/pummel/test-regress-GH-892.js +++ b/test/pummel/test-regress-GH-892.js @@ -27,14 +27,12 @@ // TLS server causes the child process to exit cleanly before having sent // the entire buffer. const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); +const spawn = require('child_process').spawn; 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 d1e1ebd9d2ba..905d922db3a7 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -21,19 +21,17 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; - if (!common.hasCrypto) common.skip('missing crypto'); -const tls = require('tls'); - -const fs = require('fs'); - if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); +const assert = require('assert'); +const spawn = require('child_process').spawn; +const tls = require('tls'); +const fs = require('fs'); + // 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 80de284dee1f..c086933a3e04 100644 --- a/test/pummel/test-tls-connect-memleak.js +++ b/test/pummel/test-tls-connect-memleak.js @@ -23,13 +23,11 @@ // Flags: --expose-gc const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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 89683c3830b8..e9bae682d729 100644 --- a/test/pummel/test-tls-securepair-client.js +++ b/test/pummel/test-tls-securepair-client.js @@ -20,7 +20,6 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// const common = require('../common'); diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js index 1a45861201a2..3255633ec7c4 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +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-throttle.js b/test/pummel/test-tls-throttle.js index f4f42922d942..2d0ea1c673a7 100644 --- a/test/pummel/test-tls-throttle.js +++ b/test/pummel/test-tls-throttle.js @@ -24,11 +24,10 @@ // seconds. Makes sure that pause and resume work properly. const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/sequential/test-child-process-emfile.js b/test/sequential/test-child-process-emfile.js index 86908ff4a250..e81b3a0ffec9 100644 --- a/test/sequential/test-child-process-emfile.js +++ b/test/sequential/test-child-process-emfile.js @@ -21,13 +21,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('no RLIMIT_NOFILE on Windows'); + const assert = require('assert'); const child_process = require('child_process'); const fs = require('fs'); -if (common.isWindows) - common.skip('no RLIMIT_NOFILE on Windows'); - 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 d50ad1a9fd88..8cc11f6c11f5 100644 --- a/test/sequential/test-child-process-pass-fd.js +++ b/test/sequential/test-child-process-pass-fd.js @@ -1,13 +1,13 @@ 'use strict'; const common = require('../common'); -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'); +const assert = require('assert'); +const fork = require('child_process').fork; +const net = require('net'); + 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 1bb23599abcb..2847af9ef8bd 100644 --- a/test/sequential/test-crypto-timing-safe-equal.js +++ b/test/sequential/test-crypto-timing-safe-equal.js @@ -1,10 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const crypto = require('crypto'); assert.strictEqual( diff --git a/test/tick-processor/test-tick-processor-builtin.js b/test/tick-processor/test-tick-processor-builtin.js index cacacc1b42e1..0fb839f8d132 100644 --- a/test/tick-processor/test-tick-processor-builtin.js +++ b/test/tick-processor/test-tick-processor-builtin.js @@ -1,6 +1,9 @@ 'use strict'; const common = require('../common'); +if (!common.enoughTestCpu) + common.skip('test is CPU-intensive'); + if (common.isWindows || common.isSunOS || common.isAix || @@ -8,9 +11,6 @@ if (common.isWindows || common.isFreeBSD) common.skip('C++ symbols are not mapped for this os.'); -if (!common.enoughTestCpu) - common.skip('test is CPU-intensive'); - const base = require('./tick-processor-base.js'); base.runTest({ diff --git a/test/tick-processor/test-tick-processor-cpp-core.js b/test/tick-processor/test-tick-processor-cpp-core.js index 1bfe222ed9ce..dc1aed41a79e 100644 --- a/test/tick-processor/test-tick-processor-cpp-core.js +++ b/test/tick-processor/test-tick-processor-cpp-core.js @@ -1,6 +1,9 @@ 'use strict'; const common = require('../common'); +if (!common.enoughTestCpu) + common.skip('test is CPU-intensive'); + if (common.isWindows || common.isSunOS || common.isAix || @@ -8,9 +11,6 @@ if (common.isWindows || common.isFreeBSD) common.skip('C++ symbols are not mapped for this os.'); -if (!common.enoughTestCpu) - common.skip('test is CPU-intensive'); - const base = require('./tick-processor-base.js'); base.runTest({