test: introduce a helper that checks if crypto is available
authorJohan Bergström <bugs@bergstroem.nu>
Wed, 4 Mar 2015 00:36:07 +0000 (11:36 +1100)
committerShigeki Ohtsu <ohtsu@iij.ad.jp>
Thu, 5 Mar 2015 01:31:41 +0000 (10:31 +0900)
since this applies to tls and https (among other things), it'll be used
for those tests as well. if we decouple the build system to somehow support
crypto but not tls, we could refine this.

PR-URL: https://github.com/iojs/io.js/pull/1049
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
test/common.js

index 352f7b6..901425b 100644 (file)
@@ -43,6 +43,9 @@ Object.defineProperty(exports, 'opensslCli', {get: function() {
   return opensslCli;
 }, enumerable: true });
 
+Object.defineProperty(exports, 'hasCrypto', {get: function() {
+  return process.versions.openssl ? true : false;
+}});
 
 if (process.platform === 'win32') {
   exports.PIPE = '\\\\.\\pipe\\libuv-test';