diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-07-01 02:29:09 +0300 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-07-04 12:41:49 +0300 |
commit | 2d2986ae72f2f5c63d95a94f05fa996d9f0609f1 (patch) | |
tree | 7a92ba45eb1ec041a2f9e40b0e63ac5c0be409c0 /test/parallel | |
parent | cc1a47dc6b94b2feb4de9e46be9333d81d537783 (diff) | |
download | node-new-2d2986ae72f2f5c63d95a94f05fa996d9f0609f1.tar.gz |
test: simplify test skipping
* Make common.skip() exit.
Also add common.printSkipMessage() for partial skips.
* Don't make needless things before skip
PR-URL: https://github.com/nodejs/node/pull/14021
Fixes: https://github.com/nodejs/node/issues/14016
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'test/parallel')
269 files changed, 688 insertions, 1272 deletions
diff --git a/test/parallel/test-async-wrap-GH13045.js b/test/parallel/test-async-wrap-GH13045.js index 41c6f0cd19..1382de8060 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 f5f81f1005..9427e2fb78 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 55ab98ee21..e7f99ad29c 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 8edbca3c6e..2a69d967a5 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 be351cced0..4aa36261db 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -28,15 +28,13 @@ */ const common = require('../common'); +if (common.isWindows) + common.skip('Sending dgram sockets to child processes is not supported'); + const dgram = require('dgram'); const fork = require('child_process').fork; const assert = require('assert'); -if (common.isWindows) { - common.skip('Sending dgram sockets to child processes is not supported'); - return; -} - if (process.argv[2] === 'child') { let childServer; diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js index 0c39813cf6..8622dafbe1 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 e726618ffb..99f7a20c49 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -21,19 +21,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - -if (common.isWindows) { +if (common.isWindows) common.skip('not reliable on Windows.'); - return; -} -if (process.getuid() === 0) { +if (process.getuid() === 0) common.skip('Test is not supposed to be run as root.'); - return; -} + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((exitCode) => { diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js index 9e0ed3dfb9..3688c67f6c 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + const NUM_WORKERS = 4; const PACKETS_PER_WORKER = 10; @@ -28,12 +31,6 @@ const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); - -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on Windows.'); - return; -} - if (cluster.isMaster) master(); else diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js index 9ae903b6ea..7c1dae6560 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on Windows.'); + const NUM_WORKERS = 4; const PACKETS_PER_WORKER = 10; @@ -28,12 +31,6 @@ const cluster = require('cluster'); const dgram = require('dgram'); const assert = require('assert'); - -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on Windows.'); - return; -} - if (cluster.isMaster) master(); else diff --git a/test/parallel/test-cluster-dgram-reuse.js b/test/parallel/test-cluster-dgram-reuse.js index 1472dcc523..51a4944e55 100644 --- a/test/parallel/test-cluster-dgram-reuse.js +++ b/test/parallel/test-cluster-dgram-reuse.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on windows.'); + const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on windows.'); - return; -} - if (cluster.isMaster) { cluster.fork().on('exit', common.mustCall((code) => { assert.strictEqual(code, 0); diff --git a/test/parallel/test-cluster-disconnect-race.js b/test/parallel/test-cluster-disconnect-race.js index 7bb66ced36..60d8697b67 100644 --- a/test/parallel/test-cluster-disconnect-race.js +++ b/test/parallel/test-cluster-disconnect-race.js @@ -4,15 +4,13 @@ // Ref: https://github.com/nodejs/node/issues/4205 const common = require('../common'); +if (common.isWindows) + common.skip('This test does not apply to Windows.'); + const assert = require('assert'); const net = require('net'); const cluster = require('cluster'); -if (common.isWindows) { - common.skip('This test does not apply to Windows.'); - return; -} - cluster.schedulingPolicy = cluster.SCHED_NONE; if (cluster.isMaster) { diff --git a/test/parallel/test-cluster-disconnect-unshared-udp.js b/test/parallel/test-cluster-disconnect-unshared-udp.js index 653ab6cc9c..d34ce11b02 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 93b457fd80..96f741e804 100644 --- a/test/parallel/test-cluster-http-pipe.js +++ b/test/parallel/test-cluster-http-pipe.js @@ -22,16 +22,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const http = require('http'); - if (common.isWindows) { common.skip( 'It is not possible to send pipe handles over the IPC pipe on Windows'); - return; } +const assert = require('assert'); +const cluster = require('cluster'); +const http = require('http'); + if (cluster.isMaster) { common.refreshTmpDir(); const worker = cluster.fork(); diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index 419307d52c..8f05b28fed 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -21,19 +21,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const cluster = require('cluster'); -const net = require('net'); - -if (common.isWindows) { +if (common.isWindows) common.skip('not reliable on Windows'); - return; -} -if (process.getuid() === 0) { +if (process.getuid() === 0) common.skip('as this test should not be run as `root`'); - return; -} + +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (cluster.isMaster) { // Master opens and binds the socket and shares it with the worker. diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 2d5370ba3e..c03aa0efce 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; @@ -341,12 +339,12 @@ for (const i in TEST_CASES) { const test = TEST_CASES[i]; if (!ciphers.includes(test.algo)) { - common.skip(`unsupported ${test.algo} test`); + common.printSkipMessage(`unsupported ${test.algo} test`); continue; } if (common.hasFipsCrypto && test.iv.length < 24) { - common.skip('IV len < 12 bytes unsupported in FIPS mode'); + common.printSkipMessage('IV len < 12 bytes unsupported in FIPS mode'); continue; } diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index e92f70035b..5bb254057b 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 831fed0f14..61d8ea8193 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index dfb68a7f92..0104341653 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 31a79d8bf1..96ca44fec8 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); function testCipher1(key, iv) { diff --git a/test/parallel/test-crypto-deprecated.js b/test/parallel/test-crypto-deprecated.js index 903862d6c8..84f25316d4 100644 --- a/test/parallel/test-crypto-deprecated.js +++ b/test/parallel/test-crypto-deprecated.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); const tls = require('tls'); diff --git a/test/parallel/test-crypto-dh-odd-key.js b/test/parallel/test-crypto-dh-odd-key.js index 94f3d38265..449c482d35 100644 --- a/test/parallel/test-crypto-dh-odd-key.js +++ b/test/parallel/test-crypto-dh-odd-key.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); function test() { diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 91a066d1bd..3b51dc5590 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); + const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR; // Test Diffie-Hellman with two parties sharing a secret, diff --git a/test/parallel/test-crypto-domain.js b/test/parallel/test-crypto-domain.js index b41b57e3a2..d579331287 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const domain = require('domain'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); function test(fn) { diff --git a/test/parallel/test-crypto-domains.js b/test/parallel/test-crypto-domains.js index 23ca991500..be87cad6ff 100644 --- a/test/parallel/test-crypto-domains.js +++ b/test/parallel/test-crypto-domains.js @@ -21,17 +21,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const domain = require('domain'); const assert = require('assert'); +const crypto = require('crypto'); + const d = domain.create(); const expect = ['pbkdf2', 'randomBytes', 'pseudoRandomBytes']; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const crypto = require('crypto'); - d.on('error', common.mustCall(function(e) { assert.strictEqual(e.message, expect.shift()); }, 3)); diff --git a/test/parallel/test-crypto-ecb.js b/test/parallel/test-crypto-ecb.js index d69cb9ea0d..4faf4af2c5 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -21,16 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (common.hasFipsCrypto) { + +if (common.hasFipsCrypto) common.skip('BF-ECB is not FIPS 140-2 compatible'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-engine.js b/test/parallel/test-crypto-engine.js index 8452087cc5..b2fe154d3c 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 a83170c49a..f1d81f078b 100644 --- a/test/parallel/test-crypto-fips.js +++ b/test/parallel/test-crypto-fips.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const spawnSync = require('child_process').spawnSync; const path = require('path'); -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const FIPS_ENABLED = 1; const FIPS_DISABLED = 0; const FIPS_ERROR_STRING = 'Error: Cannot set FIPS mode'; diff --git a/test/parallel/test-crypto-from-binary.js b/test/parallel/test-crypto-from-binary.js index 785fff4388..ed1be9b315 100644 --- a/test/parallel/test-crypto-from-binary.js +++ b/test/parallel/test-crypto-from-binary.js @@ -25,12 +25,10 @@ const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); const EXTERN_APEX = 0xFBEE9; diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/parallel/test-crypto-hash-stream-pipe.js index ee152dc028..0a240a2abb 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 28f0f2f303..f76e4f98c8 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Test hashing diff --git a/test/parallel/test-crypto-hmac.js b/test/parallel/test-crypto-hmac.js index 94c5cefa05..a10e8a731b 100644 --- a/test/parallel/test-crypto-hmac.js +++ b/test/parallel/test-crypto-hmac.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); // Test for binding layer robustness diff --git a/test/parallel/test-crypto-lazy-transform-writable.js b/test/parallel/test-crypto-lazy-transform-writable.js index 9008ebc5f9..f12243b9f4 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 3e17a3fc3e..9fb80f3eed 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index 095f1ba407..6ad504d12c 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js index 9ed719c1f6..f8f4286525 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -1,10 +1,7 @@ 'use strict'; const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index c60e3b2681..eec6f00b54 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 daa818705b..813df58732 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} -const constants = require('crypto').constants; const crypto = require('crypto'); +const constants = crypto.constants; const fixtDir = common.fixturesDir; // Test certificates diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 2a64b6d072..5d19917c48 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); const exec = require('child_process').exec; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Test certificates @@ -245,10 +243,8 @@ const modSize = 1024; // RSA-PSS Sign test by verifying with 'openssl dgst -verify' { - if (!common.opensslCli) { + if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; - } const pubfile = path.join(common.fixturesDir, 'keys/rsa_public_2048.pem'); const privfile = path.join(common.fixturesDir, 'keys/rsa_private_2048.pem'); diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index e40b36847b..1c3b8bbcbb 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const stream = require('stream'); const util = require('util'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const crypto = require('crypto'); // Small stream to buffer converter diff --git a/test/parallel/test-crypto-verify-failure.js b/test/parallel/test-crypto-verify-failure.js index 1b3622fe01..4bd70f388d 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 a7638d3cd8..d45de9979b 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 5d44814d2f..8979547c0d 100644 --- a/test/parallel/test-cwd-enoent-preload.js +++ b/test/parallel/test-cwd-enoent-preload.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; const abspathFile = require('path').join(common.fixturesDir, 'a.js'); common.refreshTmpDir(); diff --git a/test/parallel/test-cwd-enoent-repl.js b/test/parallel/test-cwd-enoent-repl.js index c82083668a..bb41b1fccd 100644 --- a/test/parallel/test-cwd-enoent-repl.js +++ b/test/parallel/test-cwd-enoent-repl.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; common.refreshTmpDir(); fs.mkdirSync(dirname); diff --git a/test/parallel/test-cwd-enoent.js b/test/parallel/test-cwd-enoent.js index dac23e4084..27df46acf8 100644 --- a/test/parallel/test-cwd-enoent.js +++ b/test/parallel/test-cwd-enoent.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. +if (common.isSunOS || common.isWindows || common.isAix) + common.skip('cannot rmdir current working directory'); + const assert = require('assert'); const fs = require('fs'); const spawn = require('child_process').spawn; -// Fails with EINVAL on SmartOS, EBUSY on Windows, EBUSY on AIX. -if (common.isSunOS || common.isWindows || common.isAix) { - common.skip('cannot rmdir current working directory'); - return; -} - const dirname = `${common.tmpDir}/cwd-does-not-exist-${process.pid}`; common.refreshTmpDir(); fs.mkdirSync(dirname); diff --git a/test/parallel/test-debug-usage.js b/test/parallel/test-debug-usage.js index e01ac8e15b..a264029f43 100644 --- a/test/parallel/test-debug-usage.js +++ b/test/parallel/test-debug-usage.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const spawn = require('child_process').spawn; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const child = spawn(process.execPath, ['debug']); child.stderr.setEncoding('utf8'); diff --git a/test/parallel/test-dgram-bind-default-address.js b/test/parallel/test-dgram-bind-default-address.js index d0b5b60234..762ead7c86 100755 --- a/test/parallel/test-dgram-bind-default-address.js +++ b/test/parallel/test-dgram-bind-default-address.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const dgram = require('dgram'); - // skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface -if (common.inFreeBSDJail) { +if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); - return; -} + +const assert = require('assert'); +const dgram = require('dgram'); dgram.createSocket('udp4').bind(0, common.mustCall(function() { assert.strictEqual(typeof this.address().port, 'number'); @@ -39,7 +37,7 @@ dgram.createSocket('udp4').bind(0, common.mustCall(function() { })); if (!common.hasIPv6) { - common.skip('udp6 part of test, because no IPv6 support'); + common.printSkipMessage('udp6 part of test, because no IPv6 support'); return; } diff --git a/test/parallel/test-dgram-cluster-close-during-bind.js b/test/parallel/test-dgram-cluster-close-during-bind.js index ec62693abf..4e8cdbf9d3 100644 --- a/test/parallel/test-dgram-cluster-close-during-bind.js +++ b/test/parallel/test-dgram-cluster-close-during-bind.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('dgram clustering is currently not supported on windows.'); + const assert = require('assert'); const cluster = require('cluster'); const dgram = require('dgram'); -if (common.isWindows) { - common.skip('dgram clustering is currently not supported on windows.'); - return; -} - if (cluster.isMaster) { cluster.fork(); } else { diff --git a/test/parallel/test-dgram-send-empty-array.js b/test/parallel/test-dgram-send-empty-array.js index 1bfcacd9a4..e6a391de94 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 16c14909f6..554a3c9185 100644 --- a/test/parallel/test-dgram-send-empty-buffer.js +++ b/test/parallel/test-dgram-send-empty-buffer.js @@ -21,13 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} +const assert = require('assert'); const dgram = require('dgram'); const client = dgram.createSocket('udp4'); diff --git a/test/parallel/test-dgram-send-empty-packet.js b/test/parallel/test-dgram-send-empty-packet.js index 131e808aec..b425e9eb15 100644 --- a/test/parallel/test-dgram-send-empty-packet.js +++ b/test/parallel/test-dgram-send-empty-packet.js @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (common.isOSX) { +if (common.isOSX) common.skip('because of 17894467 Apple bug'); - return; -} +const assert = require('assert'); const dgram = require('dgram'); const client = dgram.createSocket('udp4'); diff --git a/test/parallel/test-dgram-udp6-send-default-host.js b/test/parallel/test-dgram-udp6-send-default-host.js index e893f248ec..d801ca7e8d 100644 --- a/test/parallel/test-dgram-udp6-send-default-host.js +++ b/test/parallel/test-dgram-udp6-send-default-host.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + const assert = require('assert'); const dgram = require('dgram'); -if (!common.hasIPv6) { - common.skip('no IPv6 support'); - return; -} - const client = dgram.createSocket('udp6'); const toSend = [Buffer.alloc(256, 'x'), diff --git a/test/parallel/test-dh-padding.js b/test/parallel/test-dh-padding.js index 6853533ee4..311b9d156f 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 d0bdbf4720..3890a7b464 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 b22be9d077..b88c05a87c 100644 --- a/test/parallel/test-dsa-fips-invalid-key.js +++ b/test/parallel/test-dsa-fips-invalid-key.js @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasFipsCrypto) { +if (!common.hasFipsCrypto) common.skip('node compiled without FIPS OpenSSL.'); - return; -} +const assert = require('assert'); const crypto = require('crypto'); const fs = require('fs'); diff --git a/test/parallel/test-fs-long-path.js b/test/parallel/test-fs-long-path.js index b8aa6a2ac8..ae60b16f1a 100644 --- a/test/parallel/test-fs-long-path.js +++ b/test/parallel/test-fs-long-path.js @@ -21,15 +21,13 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('this test is Windows-specific.'); + const fs = require('fs'); const path = require('path'); const assert = require('assert'); -if (!common.isWindows) { - common.skip('this test is Windows-specific.'); - return; -} - // make a path that will be at least 260 chars long. const fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1); const fileName = path.join(common.tmpDir, 'x'.repeat(fileNameLen)); diff --git a/test/parallel/test-fs-read-file-sync-hostname.js b/test/parallel/test-fs-read-file-sync-hostname.js index f7a03e5524..599f48b6cc 100644 --- a/test/parallel/test-fs-read-file-sync-hostname.js +++ b/test/parallel/test-fs-read-file-sync-hostname.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.isLinux) + common.skip('Test is linux specific.'); + const assert = require('assert'); const fs = require('fs'); -if (!common.isLinux) { - common.skip('Test is linux specific.'); - return; -} - // Test to make sure reading a file under the /proc directory works. See: // https://groups.google.com/forum/#!topic/nodejs-dev/rxZ_RoH1Gn0 const hostname = fs.readFileSync('/proc/sys/kernel/hostname'); diff --git a/test/parallel/test-fs-readdir-ucs2.js b/test/parallel/test-fs-readdir-ucs2.js index 4d5f53abd8..e8e69d6ee2 100644 --- a/test/parallel/test-fs-readdir-ucs2.js +++ b/test/parallel/test-fs-readdir-ucs2.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.isLinux) + common.skip('Test is linux specific.'); + const path = require('path'); const fs = require('fs'); const assert = require('assert'); -if (!common.isLinux) { - common.skip('Test is linux specific.'); - return; -} - common.refreshTmpDir(); const filename = '\uD83D\uDC04'; const root = Buffer.from(`${common.tmpDir}${path.sep}`); diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js index 208b478c12..d9ad834afc 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const exec = require('child_process').exec; -const path = require('path'); - // `fs.readFile('/')` does not fail on FreeBSD, because you can open and read // the directory there. -if (common.isFreeBSD) { +if (common.isFreeBSD) common.skip('platform not supported.'); - return; -} + +const assert = require('assert'); +const exec = require('child_process').exec; +const path = require('path'); function test(env, cb) { const filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js'); diff --git a/test/parallel/test-fs-readfile-pipe-large.js b/test/parallel/test-fs-readfile-pipe-large.js index f0d1dd9c40..46603b14fa 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const path = require('path'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); +const path = require('path'); const fs = require('fs'); if (process.argv[2] === 'child') { diff --git a/test/parallel/test-fs-readfile-pipe.js b/test/parallel/test-fs-readfile-pipe.js index 10fc6a925a..e15c2c1047 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -21,15 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); const fs = require('fs'); const dataExpected = fs.readFileSync(__filename, 'utf8'); diff --git a/test/parallel/test-fs-readfilesync-pipe-large.js b/test/parallel/test-fs-readfilesync-pipe-large.js index 01e4104777..daa53bf3de 100644 --- a/test/parallel/test-fs-readfilesync-pipe-large.js +++ b/test/parallel/test-fs-readfilesync-pipe-large.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const path = require('path'); // simulate `cat readfile.js | node readfile.js` -if (common.isWindows || common.isAix) { +if (common.isWindows || common.isAix) common.skip(`No /dev/stdin on ${process.platform}.`); - return; -} +const assert = require('assert'); +const path = require('path'); const fs = require('fs'); if (process.argv[2] === 'child') { diff --git a/test/parallel/test-fs-realpath-on-substed-drive.js b/test/parallel/test-fs-realpath-on-substed-drive.js index f8d9e86de5..a3d38d9f27 100644 --- a/test/parallel/test-fs-realpath-on-substed-drive.js +++ b/test/parallel/test-fs-realpath-on-substed-drive.js @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('Test for Windows only'); + const assert = require('assert'); const fs = require('fs'); const spawnSync = require('child_process').spawnSync; -if (!common.isWindows) { - common.skip('Test for Windows only'); - return; -} let result; // create a subst drive @@ -21,10 +20,8 @@ for (i = 0; i < driveLetters.length; ++i) { if (result.status === 0) break; } -if (i === driveLetters.length) { +if (i === driveLetters.length) common.skip('Cannot create subst drive'); - return; -} // schedule cleanup (and check if all callbacks where called) process.on('exit', function() { diff --git a/test/parallel/test-fs-realpath-pipe.js b/test/parallel/test-fs-realpath-pipe.js index 89bdc08229..0f30b07f0a 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 1c9f7a7d90..a9ec65168d 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 2ceb4d1093..9e19958b62 100644 --- a/test/parallel/test-fs-symlink.js +++ b/test/parallel/test-fs-symlink.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (!common.canCreateSymLink()) + common.skip('insufficient privileges'); + const assert = require('assert'); const path = require('path'); const fs = require('fs'); @@ -28,11 +31,6 @@ const fs = require('fs'); let linkTime; let fileTime; -if (!common.canCreateSymLink()) { - common.skip('insufficient privileges'); - return; -} - common.refreshTmpDir(); // test creating and reading symbolic link diff --git a/test/parallel/test-fs-watch-encoding.js b/test/parallel/test-fs-watch-encoding.js index 04f5ffaad9..b9488f7a7f 100644 --- a/test/parallel/test-fs-watch-encoding.js +++ b/test/parallel/test-fs-watch-encoding.js @@ -11,17 +11,16 @@ // On SmartOS, the watch events fire but the filename is null. const common = require('../common'); -const fs = require('fs'); -const path = require('path'); // fs-watch on folders have limited capability in AIX. // The testcase makes use of folder watching, and causes // hang. This behavior is documented. Skip this for AIX. -if (common.isAix) { +if (common.isAix) common.skip('folder watch capability is limited in AIX.'); - return; -} + +const fs = require('fs'); +const path = require('path'); common.refreshTmpDir(); diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index 5fb13623df..8e27abb251 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 822aab804f..46a7406e74 100644 --- a/test/parallel/test-http-chunk-problem.js +++ b/test/parallel/test-http-chunk-problem.js @@ -1,11 +1,10 @@ 'use strict'; // http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919 const common = require('../common'); -const assert = require('assert'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); if (process.argv[2] === 'request') { const http = require('http'); diff --git a/test/parallel/test-http-default-port.js b/test/parallel/test-http-default-port.js index d53c69c1b0..beae62d399 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 4a724b0b41..76634c5a83 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 dc52a5bc2f..4221343209 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 65cca822f9..039270fe43 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 35f2c15f8d..0ed048688e 100644 --- a/test/parallel/test-http-localaddress.js +++ b/test/parallel/test-http-localaddress.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasMultiLocalhost()) + common.skip('platform-specific test.'); + const http = require('http'); const assert = require('assert'); -if (!common.hasMultiLocalhost()) { - common.skip('platform-specific test.'); - return; -} - const server = http.createServer(function(req, res) { console.log(`Connect from: ${req.connection.remoteAddress}`); assert.strictEqual('127.0.0.2', req.connection.remoteAddress); diff --git a/test/parallel/test-http-url.parse-https.request.js b/test/parallel/test-http-url.parse-https.request.js index 5c625cf447..b644e7530f 100644 --- a/test/parallel/test-http-url.parse-https.request.js +++ b/test/parallel/test-http-url.parse-https.request.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const url = require('url'); const fs = require('fs'); diff --git a/test/parallel/test-https-agent-constructor.js b/test/parallel/test-https-agent-constructor.js index fe77381c85..29bb9eaa98 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 a1f0c4ace4..267030232d 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 0331cd4e28..4f92547e99 100644 --- a/test/parallel/test-https-agent-disable-session-reuse.js +++ b/test/parallel/test-https-agent-disable-session-reuse.js @@ -1,18 +1,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} - -const TOTAL_REQS = 2; +const assert = require('assert'); const https = require('https'); - const fs = require('fs'); +const TOTAL_REQS = 2; + const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index 9b4f29602b..0986f8472d 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 c11d9f8ca8..4839dd7c46 100644 --- a/test/parallel/test-https-agent-secure-protocol.js +++ b/test/parallel/test-https-agent-secure-protocol.js @@ -1,12 +1,9 @@ 'use strict'; -const assert = require('assert'); const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const https = require('https'); const fs = require('fs'); diff --git a/test/parallel/test-https-agent-servername.js b/test/parallel/test-https-agent-servername.js index 8562d021c9..625fa45c7c 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 acead806ed..567ed809e6 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 a9977d8ce9..f850144eaa 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 fb7bee16ec..a06ce439fa 100644 --- a/test/parallel/test-https-agent-sni.js +++ b/test/parallel/test-https-agent-sni.js @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-https-agent-sockets-leak.js b/test/parallel/test-https-agent-sockets-leak.js index bc86b9c241..2fc477c0b3 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 add9913358..e2e71cd31a 100644 --- a/test/parallel/test-https-agent.js +++ b/test/parallel/test-https-agent.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-https-argument-of-creating.js b/test/parallel/test-https-argument-of-creating.js index 87d934316f..5a4150eb1c 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 cad824c5fe..8f4d761c02 100644 --- a/test/parallel/test-https-byteswritten.js +++ b/test/parallel/test-https-byteswritten.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff --git a/test/parallel/test-https-client-checkServerIdentity.js b/test/parallel/test-https-client-checkServerIdentity.js index a70af2c429..9842fc1f35 100644 --- a/test/parallel/test-https-client-checkServerIdentity.js +++ b/test/parallel/test-https-client-checkServerIdentity.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-https-client-get-url.js b/test/parallel/test-https-client-get-url.js index 05a3824637..f0e919ca64 100644 --- a/test/parallel/test-https-client-get-url.js +++ b/test/parallel/test-https-client-get-url.js @@ -21,19 +21,17 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); - const fs = require('fs'); const url = require('url'); + const URL = url.URL; const options = { diff --git a/test/parallel/test-https-client-reject.js b/test/parallel/test-https-client-reject.js index 95c3ca1a3b..82a7851e4e 100644 --- a/test/parallel/test-https-client-reject.js +++ b/test/parallel/test-https-client-reject.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-https-client-resume.js b/test/parallel/test-https-client-resume.js index 95e1da56d0..d61d91964b 100644 --- a/test/parallel/test-https-client-resume.js +++ b/test/parallel/test-https-client-resume.js @@ -24,14 +24,11 @@ // Cache session and close connection. Use session on second connection. // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-https-close.js b/test/parallel/test-https-close.js index 4c4dea577c..1590f3cb5b 100644 --- a/test/parallel/test-https-close.js +++ b/test/parallel/test-https-close.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const fs = require('fs'); const https = require('https'); const options = { diff --git a/test/parallel/test-https-connect-address-family.js b/test/parallel/test-https-connect-address-family.js index e7f41ce861..76a12ef5d5 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 168be7c2d9..195ad38ed4 100644 --- a/test/parallel/test-https-connecting-to-http.js +++ b/test/parallel/test-https-connecting-to-http.js @@ -23,14 +23,11 @@ // This tests the situation where you try to connect a https client // to an http server. You should get an error and exit. const common = require('../common'); -const http = require('http'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const http = require('http'); +const https = require('https'); const server = http.createServer(common.mustNotCall()); server.listen(0, common.mustCall(function() { diff --git a/test/parallel/test-https-drain.js b/test/parallel/test-https-drain.js index ed0a11ae83..f9316a261b 100644 --- a/test/parallel/test-https-drain.js +++ b/test/parallel/test-https-drain.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-https-eof-for-eom.js b/test/parallel/test-https-eof-for-eom.js index 3300dabb54..3c724fe634 100644 --- a/test/parallel/test-https-eof-for-eom.js +++ b/test/parallel/test-https-eof-for-eom.js @@ -29,15 +29,12 @@ // correctly. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const https = require('https'); const tls = require('tls'); - const fs = require('fs'); const options = { diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js index 9900cf7a64..d8beefc22b 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -21,22 +21,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} const assert = require('assert'); const join = require('path').join; - const fs = require('fs'); const spawn = require('child_process').spawn; - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff --git a/test/parallel/test-https-host-headers.js b/test/parallel/test-https-host-headers.js index adb8952871..1181d300bf 100644 --- a/test/parallel/test-https-host-headers.js +++ b/test/parallel/test-https-host-headers.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); + const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) diff --git a/test/parallel/test-https-localaddress-bind-error.js b/test/parallel/test-https-localaddress-bind-error.js index 0b046cfa85..a22db1e9e6 100644 --- a/test/parallel/test-https-localaddress-bind-error.js +++ b/test/parallel/test-https-localaddress-bind-error.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const options = { diff --git a/test/parallel/test-https-localaddress.js b/test/parallel/test-https-localaddress.js index bcd1d6fdbd..1c5669be30 100644 --- a/test/parallel/test-https-localaddress.js +++ b/test/parallel/test-https-localaddress.js @@ -21,19 +21,15 @@ 'use strict'; const common = require('../common'); -const fs = require('fs'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); -if (!common.hasMultiLocalhost()) { +if (!common.hasMultiLocalhost()) common.skip('platform-specific test.'); - return; -} + +const fs = require('fs'); +const assert = require('assert'); +const https = require('https'); const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), diff --git a/test/parallel/test-https-pfx.js b/test/parallel/test-https-pfx.js index 9d7a1d888c..d7561f7424 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -21,13 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const fs = require('fs'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const pfx = fs.readFileSync(`${common.fixturesDir}/test_cert.pfx`); diff --git a/test/parallel/test-https-req-split.js b/test/parallel/test-https-req-split.js index 0abd74be61..d0306cb714 100644 --- a/test/parallel/test-https-req-split.js +++ b/test/parallel/test-https-req-split.js @@ -21,13 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); const tls = require('tls'); diff --git a/test/parallel/test-https-resume-after-renew.js b/test/parallel/test-https-resume-after-renew.js index c9e208ab97..eb31923037 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 d1e9ed6788..01d0fa6078 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 3ad2806f6a..b79d1b943f 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 d6f6aaae7a..2a6fc8f84f 100644 --- a/test/parallel/test-https-socket-options.js +++ b/test/parallel/test-https-socket-options.js @@ -22,14 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const https = require('https'); const fs = require('fs'); - const http = require('http'); const options = { diff --git a/test/parallel/test-https-strict.js b/test/parallel/test-https-strict.js index f28164a322..060151332d 100644 --- a/test/parallel/test-https-strict.js +++ b/test/parallel/test-https-strict.js @@ -21,17 +21,14 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + // disable strict server certificate validation by the client process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const assert = require('assert'); - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const https = require('https'); - const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-https-timeout-server-2.js b/test/parallel/test-https-timeout-server-2.js index 08144f108b..269c06569f 100644 --- a/test/parallel/test-https-timeout-server-2.js +++ b/test/parallel/test-https-timeout-server-2.js @@ -22,14 +22,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js index 7d33e55211..17218ba805 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 e75a8566e4..ad1fcb3ed2 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 d15efc9abc..dcefcca104 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 f503b84591..df6773f839 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 5619d93402..eb9b07e3a4 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 9488568267..7abcae4617 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 7c8c2e948e..3c8021049c 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 1c77427b15..d7794c30b7 100644 --- a/test/parallel/test-icu-transcode.js +++ b/test/parallel/test-icu-transcode.js @@ -2,10 +2,8 @@ const common = require('../common'); -if (!common.hasIntl) { +if (!common.hasIntl) common.skip('missing Intl'); - return; -} const buffer = require('buffer'); const assert = require('assert'); diff --git a/test/parallel/test-inspector-open.js b/test/parallel/test-inspector-open.js index bc7d15a554..346393d6fa 100644 --- a/test/parallel/test-inspector-open.js +++ b/test/parallel/test-inspector-open.js @@ -1,5 +1,6 @@ 'use strict'; const common = require('../common'); +common.skipIfInspectorDisabled(); // Test inspector open()/close()/url() API. It uses ephemeral ports so can be // run safely in parallel. @@ -9,8 +10,6 @@ const fork = require('child_process').fork; const net = require('net'); const url = require('url'); -common.skipIfInspectorDisabled(); - if (process.env.BE_CHILD) return beChild(); diff --git a/test/parallel/test-intl-v8BreakIterator.js b/test/parallel/test-intl-v8BreakIterator.js index 70f0f782bb..6e9c9dbe3a 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 1e061d8f51..ff9569774d 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 688083f2a8..4f74a5b22d 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -21,6 +21,9 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); @@ -28,11 +31,6 @@ const cluster = require('cluster'); console.error('Cluster listen fd test', process.argv[2] || 'runner'); -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - // Process relationship is: // // parent: the test main script diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index f3f33055ac..aad8d663c9 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); case 'parent': return parent(); diff --git a/test/parallel/test-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js index 8a40cce56b..cc9cb6471e 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -21,16 +21,14 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); case 'parent': return parent(); diff --git a/test/parallel/test-listen-fd-server.js b/test/parallel/test-listen-fd-server.js index 3d238a8019..b21b5ee55d 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -21,15 +21,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('This test is disabled on windows.'); + const assert = require('assert'); const http = require('http'); const net = require('net'); -if (common.isWindows) { - common.skip('This test is disabled on windows.'); - return; -} - switch (process.argv[2]) { case 'child': return child(); } diff --git a/test/parallel/test-module-circular-symlinks.js b/test/parallel/test-module-circular-symlinks.js index a04022c656..b5e04a9c62 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 83aca75ed1..5fe3169ee8 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 5b734e7c6d..c928ab27c6 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 9e3859f843..68e63f0ba4 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Does not support wrapping sockets with fd on Windows'); + const assert = require('assert'); const net = require('net'); const path = require('path'); const Pipe = process.binding('pipe_wrap').Pipe; -if (common.isWindows) { - common.skip('Does not support wrapping sockets with fd on Windows'); - return; -} - common.refreshTmpDir(); function testClients(getSocketOpt, getConnectOpt, getConnectCb) { diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index 6ac6c29e10..29b07645c4 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -21,14 +21,12 @@ 'use strict'; const common = require('../common'); +if (!common.hasIPv6) + common.skip('no IPv6 support'); + const assert = require('assert'); const net = require('net'); -if (!common.hasIPv6) { - common.skip('no IPv6 support'); - return; -} - const hosts = common.localIPv6Hosts; let hostIdx = 0; let host = hosts[hostIdx]; @@ -81,8 +79,8 @@ function tryConnect() { if (host) tryConnect(); else { - common.skip('no IPv6 localhost support'); server.close(); + common.skip('no IPv6 localhost support'); } return; } diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index 19749bde95..c4f11db76b 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - // skip test in FreeBSD jails -if (common.inFreeBSDJail) { +if (common.inFreeBSDJail) common.skip('In a FreeBSD jail'); - return; -} + +const assert = require('assert'); +const net = require('net'); let conns = 0; const clientLocalPorts = []; diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index 75e2c92d5a..1faa698b15 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 144a7dfe3d..f8f777e268 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 6440b5f623..db95a4b181 100644 --- a/test/parallel/test-pipe-writev.js +++ b/test/parallel/test-pipe-writev.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Unix-specific test'); + const assert = require('assert'); const net = require('net'); -if (common.isWindows) { - common.skip('Unix-specific test'); - return; -} - common.refreshTmpDir(); const server = net.createServer((connection) => { diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index 9d24fbb365..a5f8a0c276 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -1,16 +1,14 @@ 'use strict'; const common = require('../common'); +// Refs: https://github.com/nodejs/node/pull/2253 +if (common.isSunOS) + common.skip('unreliable on SunOS'); + const assert = require('assert'); const path = require('path'); const childProcess = require('child_process'); -// Refs: https://github.com/nodejs/node/pull/2253 -if (common.isSunOS) { - common.skip('unreliable on SunOS'); - return; -} - const nodeBinary = process.argv[0]; const preloadOption = (preloads) => { diff --git a/test/parallel/test-process-execpath.js b/test/parallel/test-process-execpath.js index 5ac8a3f223..d70d1dfd38 100644 --- a/test/parallel/test-process-execpath.js +++ b/test/parallel/test-process-execpath.js @@ -1,5 +1,8 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('symlinks are weird on windows'); + const assert = require('assert'); const child_process = require('child_process'); const path = require('path'); @@ -7,11 +10,6 @@ const fs = require('fs'); assert.strictEqual(process.execPath, fs.realpathSync(process.execPath)); -if (common.isWindows) { - common.skip('symlinks are weird on windows'); - return; -} - if (process.argv[2] === 'child') { // The console.log() output is part of the test here. console.log(process.execPath); diff --git a/test/parallel/test-process-getgroups.js b/test/parallel/test-process-getgroups.js index 952e0d95ef..3479cf7028 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 85db45ff88..759820c2dc 100644 --- a/test/parallel/test-process-remove-all-signal-listeners.js +++ b/test/parallel/test-process-remove-all-signal-listeners.js @@ -1,15 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) + common.skip('Win32 does not support signals.'); + const assert = require('assert'); const spawn = require('child_process').spawn; -if (common.isWindows) { - common.skip('Win32 doesn\'t have signals, just a kind of ' + - 'emulation, insufficient for this test to apply.'); - return; -} - if (process.argv[2] !== '--do-test') { // We are the master, fork a child so we can verify it exits with correct // status. diff --git a/test/parallel/test-regress-GH-1531.js b/test/parallel/test-regress-GH-1531.js index 3cf342b869..7d1f4a0dbe 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 cc0285f747..b652c95c9a 100644 --- a/test/parallel/test-regress-GH-3542.js +++ b/test/parallel/test-regress-GH-3542.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); +// This test is only relevant on Windows. +if (!common.isWindows) + common.skip('Windows specific test.'); + const assert = require('assert'); const fs = require('fs'); const path = require('path'); -// This test is only relevant on Windows. -if (!common.isWindows) { - common.skip('Windows specific test.'); - return; -} - function test(p) { const result = fs.realpathSync(p); assert.strictEqual(result.toLowerCase(), path.resolve(p).toLowerCase()); diff --git a/test/parallel/test-regress-GH-9819.js b/test/parallel/test-regress-GH-9819.js index fb9bb489a0..7eed1c512f 100644 --- a/test/parallel/test-regress-GH-9819.js +++ b/test/parallel/test-regress-GH-9819.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + const assert = require('assert'); const execFile = require('child_process').execFile; -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} - const setup = 'const enc = { toString: () => { throw new Error("xyz"); } };'; const scripts = [ diff --git a/test/parallel/test-repl-history-perm.js b/test/parallel/test-repl-history-perm.js index 1a98999c3b..259c96fe8a 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 030c86be8e..7f15b7dfeb 100644 --- a/test/parallel/test-repl-sigint-nested-eval.js +++ b/test/parallel/test-repl-sigint-nested-eval.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const spawn = require('child_process').spawn; + process.env.REPL_TEST_PPID = process.pid; const child = spawn(process.execPath, [ '-i' ], { stdio: [null, null, 2] diff --git a/test/parallel/test-repl-sigint.js b/test/parallel/test-repl-sigint.js index 61bc75cc6f..818111c39b 100644 --- a/test/parallel/test-repl-sigint.js +++ b/test/parallel/test-repl-sigint.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const spawn = require('child_process').spawn; + process.env.REPL_TEST_PPID = process.pid; const child = spawn(process.execPath, [ '-i' ], { stdio: [null, null, 2] diff --git a/test/parallel/test-require-long-path.js b/test/parallel/test-require-long-path.js index 1a8ce1b7df..aaaf07d48a 100644 --- a/test/parallel/test-require-long-path.js +++ b/test/parallel/test-require-long-path.js @@ -1,13 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('this test is Windows-specific.'); + const fs = require('fs'); const path = require('path'); -if (!common.isWindows) { - common.skip('this test is Windows-specific.'); - return; -} - // make a path that is more than 260 chars long. const dirNameLen = Math.max(260 - common.tmpDir.length, 1); const dirName = path.join(common.tmpDir, 'x'.repeat(dirNameLen)); diff --git a/test/parallel/test-require-symlink.js b/test/parallel/test-require-symlink.js index 964f856829..d5dc03e49d 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 672b6f037d..f4e25a6e8c 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 db34a036e4..a5c900695a 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 94a34b640d..30d0ec2c26 100644 --- a/test/parallel/test-spawn-cmd-named-pipe.js +++ b/test/parallel/test-spawn-cmd-named-pipe.js @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - // This test is intended for Windows only -if (!common.isWindows) { +if (!common.isWindows) common.skip('this test is Windows-specific.'); - return; -} + +const assert = require('assert'); if (!process.argv[2]) { // parent diff --git a/test/parallel/test-tls-0-dns-altname.js b/test/parallel/test-tls-0-dns-altname.js index 7ac40eeda1..0b1c7f6496 100644 --- a/test/parallel/test-tls-0-dns-altname.js +++ b/test/parallel/test-tls-0-dns-altname.js @@ -21,16 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); +if (!common.hasCrypto) + common.skip('missing crypto'); // Check getPeerCertificate can properly handle '\0' for fix CVE-2009-2408. -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-alert-handling.js b/test/parallel/test-tls-alert-handling.js index d089ad223b..0b3447243d 100644 --- a/test/parallel/test-tls-alert-handling.js +++ b/test/parallel/test-tls-alert-handling.js @@ -1,15 +1,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index ef79856108..8aa56eaf75 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -21,16 +21,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const assert = require('assert'); const { spawn } = require('child_process'); diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js index 3d3453d32f..56f925b8a9 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 be499b8450..6b4d2bd9f5 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 a6775c0603..1d494b4ed3 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 0a128275c3..ab967bb2c6 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 e608df5a5a..1623e70a2a 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 912fb64128..4a39ee9391 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 15928a04f6..14f96104e1 100644 --- a/test/parallel/test-tls-client-abort.js +++ b/test/parallel/test-tls-client-abort.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-client-abort2.js b/test/parallel/test-tls-client-abort2.js index a652edfa8f..59b592d255 100644 --- a/test/parallel/test-tls-client-abort2.js +++ b/test/parallel/test-tls-client-abort2.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const conn = tls.connect(0, common.mustNotCall()); diff --git a/test/parallel/test-tls-client-default-ciphers.js b/test/parallel/test-tls-client-default-ciphers.js index 9eefe21e95..0630fe947e 100644 --- a/test/parallel/test-tls-client-default-ciphers.js +++ b/test/parallel/test-tls-client-default-ciphers.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); function Done() {} diff --git a/test/parallel/test-tls-client-destroy-soon.js b/test/parallel/test-tls-client-destroy-soon.js index 8d1f3e9023..a94e8fbdb9 100644 --- a/test/parallel/test-tls-client-destroy-soon.js +++ b/test/parallel/test-tls-client-destroy-soon.js @@ -25,14 +25,11 @@ // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js index f3da64ed37..53e0144ac7 100644 --- a/test/parallel/test-tls-client-getephemeralkeyinfo.js +++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(); -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); diff --git a/test/parallel/test-tls-client-mindhsize.js b/test/parallel/test-tls-client-mindhsize.js index 10fe196b53..230c6e0845 100644 --- a/test/parallel/test-tls-client-mindhsize.js +++ b/test/parallel/test-tls-client-mindhsize.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - process.exit(); -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); diff --git a/test/parallel/test-tls-client-reject.js b/test/parallel/test-tls-client-reject.js index 43cf337e67..a11e0fe280 100644 --- a/test/parallel/test-tls-client-reject.js +++ b/test/parallel/test-tls-client-reject.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-client-resume.js b/test/parallel/test-tls-client-resume.js index aa23f3331b..fccdf6d930 100644 --- a/test/parallel/test-tls-client-resume.js +++ b/test/parallel/test-tls-client-resume.js @@ -25,14 +25,11 @@ // ASSERT resumption. const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index d713be3b0c..2171851665 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 978f765950..9973adde12 100644 --- a/test/parallel/test-tls-close-error.js +++ b/test/parallel/test-tls-close-error.js @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-close-notify.js b/test/parallel/test-tls-close-notify.js index 625909c9c5..500aec26c8 100644 --- a/test/parallel/test-tls-close-notify.js +++ b/test/parallel/test-tls-close-notify.js @@ -22,12 +22,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-cnnic-whitelist.js b/test/parallel/test-tls-cnnic-whitelist.js index 0845317486..84b71c7e64 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 f22831f395..afacd5a390 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 0855391619..d922d7d4d5 100644 --- a/test/parallel/test-tls-connect-given-socket.js +++ b/test/parallel/test-tls-connect-given-socket.js @@ -21,17 +21,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const net = require('net'); const fs = require('fs'); const path = require('path'); + const options = { key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')), cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) diff --git a/test/parallel/test-tls-connect-no-host.js b/test/parallel/test-tls-connect-no-host.js index 2e4bcfbc6d..f63c821a7f 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 836471a0c5..8a3abe3312 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 7e0d1b462b..d6211d05c8 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 637e54f535..4a8b53b4de 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 1908dba657..5e73196bc1 100644 --- a/test/parallel/test-tls-connect.js +++ b/test/parallel/test-tls-connect.js @@ -22,12 +22,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-delayed-attach-error.js b/test/parallel/test-tls-delayed-attach-error.js index 35da6d0e42..9d37f15efe 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 fa8baa81f8..9ab6115665 100644 --- a/test/parallel/test-tls-delayed-attach.js +++ b/test/parallel/test-tls-delayed-attach.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-destroy-whilst-write.js b/test/parallel/test-tls-destroy-whilst-write.js index b4f9766d99..d157c7bf3f 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 2f86e82be7..fe17206fdc 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -22,22 +22,17 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const spawn = require('child_process').spawn; const fs = require('fs'); + const key = fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`); const cert = fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`); let nsuccess = 0; diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js index 732ebe4d1b..65ee8fd691 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -21,20 +21,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const exec = require('child_process').exec; const fs = require('fs'); diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index 32e77456bd..856c1a96fb 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 798c10ca4c..8a6536890e 100644 --- a/test/parallel/test-tls-econnreset.js +++ b/test/parallel/test-tls-econnreset.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const cacert = diff --git a/test/parallel/test-tls-empty-sni-context.js b/test/parallel/test-tls-empty-sni-context.js index 4974e6323e..9a8e3449f0 100644 --- a/test/parallel/test-tls-empty-sni-context.js +++ b/test/parallel/test-tls-empty-sni-context.js @@ -1,18 +1,13 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); -if (!process.features.tls_sni) { +if (!process.features.tls_sni) common.skip('node compiled without OpenSSL or with old OpenSSL version.'); - return; -} const assert = require('assert'); - -if (!common.hasCrypto) { - return common.skip('missing crypto'); -} - const tls = require('tls'); const options = { diff --git a/test/parallel/test-tls-env-bad-extra-ca.js b/test/parallel/test-tls-env-bad-extra-ca.js index 57e4c1cfaf..ece93f3353 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 e2de272184..be7c826b85 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 08a4ad16e8..2d7b1f62b9 100644 --- a/test/parallel/test-tls-external-accessor.js +++ b/test/parallel/test-tls-external-accessor.js @@ -1,15 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -// Ensure accessing ._external doesn't hit an assert in the accessor method. +const assert = require('assert'); const tls = require('tls'); + +// Ensure accessing ._external doesn't hit an assert in the accessor method. { const pctx = tls.createSecureContext().context; const cctx = Object.create(pctx); diff --git a/test/parallel/test-tls-fast-writing.js b/test/parallel/test-tls-fast-writing.js index 05722d8959..b846f732d2 100644 --- a/test/parallel/test-tls-fast-writing.js +++ b/test/parallel/test-tls-fast-writing.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const dir = common.fixturesDir; diff --git a/test/parallel/test-tls-friendly-error-message.js b/test/parallel/test-tls-friendly-error-message.js index c476fb20fe..644b298fb9 100644 --- a/test/parallel/test-tls-friendly-error-message.js +++ b/test/parallel/test-tls-friendly-error-message.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const key = fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`); diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js index d2c5b9eab4..acf07ef0a0 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 393b8fb3fe..dd96aa6f74 100644 --- a/test/parallel/test-tls-getprotocol.js +++ b/test/parallel/test-tls-getprotocol.js @@ -1,12 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-handshake-error.js b/test/parallel/test-tls-handshake-error.js index 3bd74baa97..e4a4addd37 100644 --- a/test/parallel/test-tls-handshake-error.js +++ b/test/parallel/test-tls-handshake-error.js @@ -1,14 +1,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const server = tls.createServer({ diff --git a/test/parallel/test-tls-handshake-nohang.js b/test/parallel/test-tls-handshake-nohang.js index 791ba8df84..e724fcd342 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 a6e272aa2a..ed4c4f7b99 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 a6d51d5dfe..a9d35a01ba 100644 --- a/test/parallel/test-tls-honorcipherorder.js +++ b/test/parallel/test-tls-honorcipherorder.js @@ -1,14 +1,12 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); + let nconns = 0; // We explicitly set TLS version to 1.2 so as to be safe when the diff --git a/test/parallel/test-tls-inception.js b/test/parallel/test-tls-inception.js index 38f922107b..267fa391a7 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 131915911f..d704a35e68 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 4437507516..b1027dd943 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 6553d6862d..f535a46cce 100644 --- a/test/parallel/test-tls-js-stream.js +++ b/test/parallel/test-tls-js-stream.js @@ -1,13 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const stream = require('stream'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-junk-closes-server.js b/test/parallel/test-tls-junk-closes-server.js index a1ffb32c24..b0e29ec9f8 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 9b5ab6fdcc..3270dec745 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 ac261122ea..ed5a15c258 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 b50c63e776..4a6120c71b 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 9af65c43a0..efcc5c2c92 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 cebb85c4b2..4656d3e5cc 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 86ee1a4f14..1cbcb8e272 100644 --- a/test/parallel/test-tls-max-send-fragment.js +++ b/test/parallel/test-tls-max-send-fragment.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const buf = Buffer.allocUnsafe(10000); diff --git a/test/parallel/test-tls-multi-key.js b/test/parallel/test-tls-multi-key.js index 6158f7d405..6e1a3c8777 100644 --- a/test/parallel/test-tls-multi-key.js +++ b/test/parallel/test-tls-multi-key.js @@ -21,12 +21,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); diff --git a/test/parallel/test-tls-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js index 06139307c4..11c86efa08 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -20,13 +20,11 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const assert = require('assert'); const common = require('../common'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); // Omitting the cert or pfx option to tls.createServer() should not throw. diff --git a/test/parallel/test-tls-no-rsa-key.js b/test/parallel/test-tls-no-rsa-key.js index 60ac0ab148..4551928acd 100644 --- a/test/parallel/test-tls-no-rsa-key.js +++ b/test/parallel/test-tls-no-rsa-key.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-no-sslv23.js b/test/parallel/test-tls-no-sslv23.js index 564efab26d..737f42b530 100644 --- a/test/parallel/test-tls-no-sslv23.js +++ b/test/parallel/test-tls-no-sslv23.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); assert.throws(function() { diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index 2c2c51eb9b..0a118dbe7e 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -1,21 +1,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +if (common.opensslCli === false) + common.skip('node compiled without OpenSSL CLI.'); + +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const spawn = require('child_process').spawn; -if (common.opensslCli === false) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - const cert = fs.readFileSync(`${common.fixturesDir}/test_cert.pem`); const key = fs.readFileSync(`${common.fixturesDir}/test_key.pem`); const server = tls.createServer({ cert: cert, key: key }, common.mustNotCall()); @@ -48,7 +43,7 @@ server.on('tlsClientError', (err) => errors.push(err)); process.on('exit', function() { if (/unknown option -ssl3/.test(stderr)) { - common.skip('`openssl s_client -ssl3` not supported.'); + common.printSkipMessage('`openssl s_client -ssl3` not supported.'); } else { assert.strictEqual(errors.length, 1); assert(/:wrong version number/.test(errors[0].message)); diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js index ffaf61b633..6a528732a3 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 a839384925..b4437c6a9b 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 38537fd640..5b66edd0c2 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 638886e92e..5ff05b8504 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const https = require('https'); +const assert = require('assert'); +const https = require('https'); const fs = require('fs'); const net = require('net'); const http = require('http'); diff --git a/test/parallel/test-tls-parse-cert-string.js b/test/parallel/test-tls-parse-cert-string.js index c6cdbf2e36..2e940805c0 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 20b5961fb4..c8cc06d35e 100644 --- a/test/parallel/test-tls-passphrase.js +++ b/test/parallel/test-tls-passphrase.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-pause.js b/test/parallel/test-tls-pause.js index a08b435f67..647b13c62a 100644 --- a/test/parallel/test-tls-pause.js +++ b/test/parallel/test-tls-pause.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const path = require('path'); diff --git a/test/parallel/test-tls-peer-certificate-encoding.js b/test/parallel/test-tls-peer-certificate-encoding.js index 95f14c7b8e..76781e0953 100644 --- a/test/parallel/test-tls-peer-certificate-encoding.js +++ b/test/parallel/test-tls-peer-certificate-encoding.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const util = require('util'); const join = require('path').join; diff --git a/test/parallel/test-tls-peer-certificate-multi-keys.js b/test/parallel/test-tls-peer-certificate-multi-keys.js index a58c747bd4..2267723862 100644 --- a/test/parallel/test-tls-peer-certificate-multi-keys.js +++ b/test/parallel/test-tls-peer-certificate-multi-keys.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const util = require('util'); const join = require('path').join; diff --git a/test/parallel/test-tls-pfx-gh-5100-regr.js b/test/parallel/test-tls-pfx-gh-5100-regr.js index 142a7de10b..c47ad5f89d 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 6f4392007b..9bb07fe7ca 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 c529d972d2..216b69bb21 100644 --- a/test/parallel/test-tls-request-timeout.js +++ b/test/parallel/test-tls-request-timeout.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-retain-handle-no-abort.js b/test/parallel/test-tls-retain-handle-no-abort.js index a3a2aebcd6..4be64c1596 100644 --- a/test/parallel/test-tls-retain-handle-no-abort.js +++ b/test/parallel/test-tls-retain-handle-no-abort.js @@ -1,12 +1,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); const util = require('util'); diff --git a/test/parallel/test-tls-securepair-fiftharg.js b/test/parallel/test-tls-securepair-fiftharg.js index 2b69ce88f4..236f719157 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 b513bcd4c7..cbc7c7dadd 100644 --- a/test/parallel/test-tls-securepair-leak.js +++ b/test/parallel/test-tls-securepair-leak.js @@ -2,13 +2,10 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} +const assert = require('assert'); const { createSecureContext } = require('tls'); const { createSecurePair } = require('_tls_legacy'); diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index 00e8cd591f..6aebc80722 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -21,20 +21,14 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -if (!common.opensslCli) { +if (!common.opensslCli) common.skip('missing openssl-cli'); - return; -} +const assert = require('assert'); const tls = require('tls'); - const join = require('path').join; const net = require('net'); const fs = require('fs'); diff --git a/test/parallel/test-tls-server-connection-server.js b/test/parallel/test-tls-server-connection-server.js index 1c54eb635a..7eef14d23b 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 0290bcc629..8efb4ec538 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 86a735f64c..dcae05eb96 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -22,15 +22,11 @@ 'use strict'; const common = require('../common'); -if (!common.opensslCli) { - common.skip('node compiled without OpenSSL CLI.'); - return; -} - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} + +if (!common.opensslCli) + common.skip('node compiled without OpenSSL CLI.'); // This is a rather complex test which sets up various TLS servers with node // and connects to them using the 'openssl s_client' command line utility diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index e87c62d3ed..805c21b3ad 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 4b7923891b..2c7177389b 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 7023132d73..c9ff52b9b2 100644 --- a/test/parallel/test-tls-set-encoding.js +++ b/test/parallel/test-tls-set-encoding.js @@ -21,17 +21,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); - const options = { key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`), cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`) diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js index ad7410b163..f744b6db54 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 300010cfa1..83fd50c066 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 25282ada9e..f9a77bf464 100644 --- a/test/parallel/test-tls-socket-close.js +++ b/test/parallel/test-tls-socket-close.js @@ -1,11 +1,9 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const assert = require('assert'); +const assert = require('assert'); const tls = require('tls'); const fs = require('fs'); const net = require('net'); diff --git a/test/parallel/test-tls-socket-destroy.js b/test/parallel/test-tls-socket-destroy.js index 0a72ac6232..b101a872c2 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 106a14a7df..16175b8898 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 601c0e4393..92d595e80c 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 d588fee34d..28d1db8859 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 8654dd9ceb..486aef8358 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const cluster = require('cluster'); const fs = require('fs'); const join = require('path').join; diff --git a/test/parallel/test-tls-ticket.js b/test/parallel/test-tls-ticket.js index b2541e06ab..bf1ce0d5eb 100644 --- a/test/parallel/test-tls-ticket.js +++ b/test/parallel/test-tls-ticket.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const net = require('net'); const crypto = require('crypto'); diff --git a/test/parallel/test-tls-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js index bf6dcc385b..8513b29f2e 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.js @@ -21,14 +21,11 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); const fs = require('fs'); const options = { diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js index b43bb169f3..a3d9a81647 100644 --- a/test/parallel/test-tls-timeout-server.js +++ b/test/parallel/test-tls-timeout-server.js @@ -22,12 +22,10 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const tls = require('tls'); +const tls = require('tls'); const net = require('net'); const fs = require('fs'); diff --git a/test/parallel/test-tls-two-cas-one-string.js b/test/parallel/test-tls-two-cas-one-string.js index 3f948b86a5..897635d7b1 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 5052d4377a..9df145ac37 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 f31e058e6a..ef6efaedc3 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 479d7524aa..672da9876f 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 ed0fe9b1a3..5c6db86b75 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 417b21804a..82953f1333 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 c18b17a640..21a472ee3b 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 64fbcc7fc7..b4cff36818 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 0d61f27931..7035764cba 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 10d0efaf0b..84c03d292c 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 2be8ac7f5f..49259a7ab0 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 f7363fdbb9..d484760c80 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 207f44b011..6debd18d05 100644 --- a/test/parallel/test-util-sigint-watchdog.js +++ b/test/parallel/test-util-sigint-watchdog.js @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const binding = process.binding('util'); - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const binding = process.binding('util'); + [(next) => { // Test with no signal observed. binding.startSigintWatchdog(); diff --git a/test/parallel/test-vm-sigint-existing-handler.js b/test/parallel/test-vm-sigint-existing-handler.js index cbd91bef06..eb67820ff2 100644 --- a/test/parallel/test-vm-sigint-existing-handler.js +++ b/test/parallel/test-vm-sigint-existing-handler.js @@ -1,8 +1,12 @@ 'use strict'; const common = require('../common'); +if (common.isWindows) { + // No way to send CTRL_C_EVENT to processes from JS right now. + common.skip('platform not supported'); +} + const assert = require('assert'); const vm = require('vm'); - const spawn = require('child_process').spawn; const methods = [ @@ -10,12 +14,6 @@ const methods = [ 'runInContext' ]; -if (common.isWindows) { - // No way to send CTRL_C_EVENT to processes from JS right now. - common.skip('platform not supported'); - return; -} - if (process.argv[2] === 'child') { const method = process.argv[3]; assert.ok(method); diff --git a/test/parallel/test-vm-sigint.js b/test/parallel/test-vm-sigint.js index b1ad616405..ae205edb3d 100644 --- a/test/parallel/test-vm-sigint.js +++ b/test/parallel/test-vm-sigint.js @@ -1,17 +1,14 @@ 'use strict'; const common = require('../common'); - -const assert = require('assert'); -const vm = require('vm'); - -const spawn = require('child_process').spawn; - if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); - return; } +const assert = require('assert'); +const vm = require('vm'); +const spawn = require('child_process').spawn; + if (process.argv[2] === 'child') { const method = process.argv[3]; const listeners = +process.argv[4]; diff --git a/test/parallel/test-warn-sigprof.js b/test/parallel/test-warn-sigprof.js index eedbe33d84..3404490c2a 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 b67f63baf1..290f9266b5 100644 --- a/test/parallel/test-whatwg-url-constructor.js +++ b/test/parallel/test-whatwg-url-constructor.js @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const { URL, URLSearchParams } = require('url'); -const { test, assert_equals, assert_true, assert_throws } = - require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const path = require('path'); +const { URL, URLSearchParams } = require('url'); +const { test, assert_equals, assert_true, assert_throws } = + require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-tests')) }; diff --git a/test/parallel/test-whatwg-url-domainto.js b/test/parallel/test-whatwg-url-domainto.js index b399f24136..bfd5e94d2e 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 0f7c0e70cd..7848b1c187 100644 --- a/test/parallel/test-whatwg-url-historical.js +++ b/test/parallel/test-whatwg-url-historical.js @@ -1,14 +1,13 @@ 'use strict'; const common = require('../common'); -const URL = require('url').URL; -const { test, assert_equals, assert_throws } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const URL = require('url').URL; +const { test, assert_equals, assert_throws } = require('../common/wpt'); + /* eslint-disable */ /* WPT Refs: https://github.com/w3c/web-platform-tests/blob/8791bed/url/historical.html diff --git a/test/parallel/test-whatwg-url-inspect.js b/test/parallel/test-whatwg-url-inspect.js index 8db1a20e5b..5758b39b8a 100644 --- a/test/parallel/test-whatwg-url-inspect.js +++ b/test/parallel/test-whatwg-url-inspect.js @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const util = require('util'); -const URL = require('url').URL; -const assert = require('assert'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const util = require('util'); +const URL = require('url').URL; +const assert = require('assert'); + // Tests below are not from WPT. const url = new URL('https://username:password@host.name:8080/path/name/?que=ry#hash'); diff --git a/test/parallel/test-whatwg-url-origin.js b/test/parallel/test-whatwg-url-origin.js index b5b54f887f..732100e142 100644 --- a/test/parallel/test-whatwg-url-origin.js +++ b/test/parallel/test-whatwg-url-origin.js @@ -1,15 +1,14 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const URL = require('url').URL; -const { test, assert_equals } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const path = require('path'); +const URL = require('url').URL; +const { test, assert_equals } = require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-tests')) }; diff --git a/test/parallel/test-whatwg-url-parsing.js b/test/parallel/test-whatwg-url-parsing.js index 6c95a5e913..39756449c0 100644 --- a/test/parallel/test-whatwg-url-parsing.js +++ b/test/parallel/test-whatwg-url-parsing.js @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const URL = require('url').URL; -const path = require('path'); -const assert = require('assert'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const URL = require('url').URL; +const path = require('path'); +const assert = require('assert'); + // Tests below are not from WPT. const tests = require(path.join(common.fixturesDir, 'url-tests')); const failureTests = tests.filter((test) => test.failure).concat([ diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index 60a482decc..938c2aa253 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -1,6 +1,11 @@ 'use strict'; const common = require('../common'); +if (!common.hasIntl) { + // A handful of the tests fail when ICU is not included. + common.skip('missing Intl'); +} + const assert = require('assert'); const path = require('path'); const URL = require('url').URL; @@ -8,12 +13,6 @@ const { test, assert_equals } = require('../common/wpt'); const additionalTestCases = require( path.join(common.fixturesDir, 'url-setter-tests-additional.js')); -if (!common.hasIntl) { - // A handful of the tests fail when ICU is not included. - common.skip('missing Intl'); - return; -} - const request = { response: require(path.join(common.fixturesDir, 'url-setter-tests')) }; diff --git a/test/parallel/test-whatwg-url-toascii.js b/test/parallel/test-whatwg-url-toascii.js index bd986c96a4..851240ce65 100644 --- a/test/parallel/test-whatwg-url-toascii.js +++ b/test/parallel/test-whatwg-url-toascii.js @@ -1,15 +1,14 @@ 'use strict'; const common = require('../common'); -const path = require('path'); -const { URL } = require('url'); -const { test, assert_equals, assert_throws } = require('../common/wpt'); - if (!common.hasIntl) { // A handful of the tests fail when ICU is not included. common.skip('missing Intl'); - return; } +const path = require('path'); +const { URL } = require('url'); +const { test, assert_equals, assert_throws } = require('../common/wpt'); + const request = { response: require(path.join(common.fixturesDir, 'url-toascii')) }; diff --git a/test/parallel/test-windows-abort-exitcode.js b/test/parallel/test-windows-abort-exitcode.js index c5c5fa6f3a..d61a91315b 100644 --- a/test/parallel/test-windows-abort-exitcode.js +++ b/test/parallel/test-windows-abort-exitcode.js @@ -1,17 +1,16 @@ 'use strict'; const common = require('../common'); +if (!common.isWindows) + common.skip('test is windows specific'); + const assert = require('assert'); +const spawn = require('child_process').spawn; // This test makes sure that an aborted node process // exits with code 3 on Windows. // Spawn a child, force an abort, and then check the // exit code in the parent. -const spawn = require('child_process').spawn; -if (!common.isWindows) { - common.skip('test is windows specific'); - return; -} if (process.argv[2] === 'child') { process.abort(); } else { diff --git a/test/parallel/test-zlib-random-byte-pipes.js b/test/parallel/test-zlib-random-byte-pipes.js index 4ccfd2dc22..f15b31c2f4 100644 --- a/test/parallel/test-zlib-random-byte-pipes.js +++ b/test/parallel/test-zlib-random-byte-pipes.js @@ -21,19 +21,16 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); - -if (!common.hasCrypto) { +if (!common.hasCrypto) common.skip('missing crypto'); - return; -} -const crypto = require('crypto'); +const assert = require('assert'); +const crypto = require('crypto'); const stream = require('stream'); -const Stream = stream.Stream; const util = require('util'); const zlib = require('zlib'); +const Stream = stream.Stream; // emit random bytes, and keep a shasum function RandomReadStream(opt) { |