Skip to content

Commit d4f2a52

Browse files
danbevMylesBorins
authored andcommitted
test: check crypto before requiring tls module
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.<anonymous> (/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: #14708 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: David Cai <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 868b441 commit d4f2a52

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/parallel/test-tls-session-cache.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
'use strict';
2323
const common = require('../common');
24+
if (!common.hasCrypto)
25+
common.skip('missing crypto');
2426
const fixtures = require('../common/fixtures');
2527
const assert = require('assert');
2628
const tls = require('tls');
@@ -29,8 +31,6 @@ const { spawn } = require('child_process');
2931
if (!common.opensslCli)
3032
common.skip('node compiled without OpenSSL CLI.');
3133

32-
if (!common.hasCrypto)
33-
common.skip('missing crypto');
3434

3535
doTest({ tickets: false }, function() {
3636
doTest({ tickets: true }, function() {

0 commit comments

Comments
 (0)