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 <gibfahn@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Luca Maraschi <luca.maraschi@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
pull/12987/head
Daniel Bevenius 2017-05-11 08:56:33 +02:00
parent d7d16f7b8b
commit 9f8e030f1b
3 changed files with 12 additions and 8 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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];