From 7307839b559b13c242e9d5341201ec17f83f3eed Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 9 Aug 2017 07:28:28 +0200 Subject: [PATCH] test: check crypto before requiring tls module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test-tls-session-cache currently fails if built --without-ssl: internal/util.js:82 throw new errors.Error('ERR_NO_CRYPTO'); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support at Object.assertCrypto (internal/util.js:82:11) at tls.js:26:14 at NativeModule.compile (bootstrap_node.js:586:7) at Function.NativeModule.require (bootstrap_node.js:531:18) at Function.Module._load (module.js:449:25) at Module.require (module.js:517:17) at require (internal/module.js:11:18) at Object. (/node/test/parallel/test-tls-session-cache.js:26:13) at Module._compile (module.js:573:30) at Object.Module._extensions..js (module.js:584:10) The test has a crypto check but it come after the require of the tls module. This commit moves the crypto check to come before the require of tls and allows the test to pass. PR-URL: https://github.com/nodejs/node/pull/14708 Reviewed-By: Rich Trott Reviewed-By: Sakthipriyan Vairamani Reviewed-By: David Cai Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-tls-session-cache.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index 59822acbf8768e..73ccdd8396cecd 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -21,6 +21,8 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); const fixtures = require('../common/fixtures'); const assert = require('assert'); const tls = require('tls'); @@ -29,8 +31,6 @@ const { spawn } = require('child_process'); if (!common.opensslCli) common.skip('node compiled without OpenSSL CLI.'); -if (!common.hasCrypto) - common.skip('missing crypto'); doTest({ tickets: false }, function() { doTest({ tickets: true }, function() {