From 9f8e030f1b41d3625cf36c282090c6a90c7a203e Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 11 May 2017 08:56:33 +0200 Subject: [PATCH] src: add/move hasCrypto checks for async tests Currently when configured --without-ssl these test will fail. In test-crypto-pbkdf2.js and test-crypto-randomBytes.js the check exists but just need to be moved before the require of crypto. There was no check in test-async-wrap-uncaughtexception.js so one was added. PR-URL: https://github.com/nodejs/node/pull/12968 Reviewed-By: Gibson Fahnestock Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Luca Maraschi Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/async-hooks/test-crypto-pbkdf2.js | 8 ++++---- test/async-hooks/test-crypto-randomBytes.js | 8 ++++---- test/parallel/test-async-wrap-uncaughtexception.js | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/async-hooks/test-crypto-pbkdf2.js b/test/async-hooks/test-crypto-pbkdf2.js index f2a0d208ed4ccb..938a14c16f5e52 100644 --- a/test/async-hooks/test-crypto-pbkdf2.js +++ b/test/async-hooks/test-crypto-pbkdf2.js @@ -1,16 +1,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) { + common.skip('missing crypto'); + return; +} const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); const crypto = require('crypto'); -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const hooks = initHooks(); diff --git a/test/async-hooks/test-crypto-randomBytes.js b/test/async-hooks/test-crypto-randomBytes.js index 0b89fcc09c7794..7748db482bc7bb 100644 --- a/test/async-hooks/test-crypto-randomBytes.js +++ b/test/async-hooks/test-crypto-randomBytes.js @@ -1,16 +1,16 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) { + common.skip('missing crypto'); + return; +} const assert = require('assert'); const tick = require('./tick'); const initHooks = require('./init-hooks'); const { checkInvocations } = require('./hook-checks'); const crypto = require('crypto'); -if (!common.hasCrypto) { - common.skip('missing crypto'); - return; -} const hooks = initHooks(); diff --git a/test/parallel/test-async-wrap-uncaughtexception.js b/test/parallel/test-async-wrap-uncaughtexception.js index 099bdb70dd97fe..c6ff06397e26d1 100644 --- a/test/parallel/test-async-wrap-uncaughtexception.js +++ b/test/parallel/test-async-wrap-uncaughtexception.js @@ -1,6 +1,10 @@ 'use strict'; const common = require('../common'); +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];