diff --git a/test/parallel/test-accessor-properties.js b/test/parallel/test-accessor-properties.js index 478b1c55e93fdb..13535ceda9667f 100644 --- a/test/parallel/test-accessor-properties.js +++ b/test/parallel/test-accessor-properties.js @@ -1,6 +1,6 @@ 'use strict'; -require('../common'); +const common = require('../common'); // This tests that the accessor properties do not raise assertions // when called with incompatible receivers. @@ -12,9 +12,6 @@ const assert = require('assert'); const TTY = process.binding('tty_wrap').TTY; const UDP = process.binding('udp_wrap').UDP; -// There are accessor properties in crypto too -const crypto = process.binding('crypto'); - { // Should throw instead of raise assertions assert.throws(() => { @@ -33,15 +30,6 @@ const crypto = process.binding('crypto'); UDP.prototype.fd; }, TypeError); - assert.throws(() => { - crypto.SecureContext.prototype._external; - }, TypeError); - - assert.throws(() => { - crypto.Connection.prototype._external; - }, TypeError); - - // Should not throw for Object.getOwnPropertyDescriptor assert.strictEqual( typeof Object.getOwnPropertyDescriptor(TTY.prototype, 'bytesRead'), @@ -63,15 +51,28 @@ const crypto = process.binding('crypto'); 'object' ); - assert.strictEqual( - typeof Object.getOwnPropertyDescriptor( - crypto.SecureContext.prototype, '_external'), - 'object' - ); - - assert.strictEqual( - typeof Object.getOwnPropertyDescriptor( - crypto.Connection.prototype, '_external'), - 'object' - ); + if (common.hasCrypto) { // eslint-disable-line crypto-check + // There are accessor properties in crypto too + const crypto = process.binding('crypto'); + + assert.throws(() => { + crypto.SecureContext.prototype._external; + }, TypeError); + + assert.throws(() => { + crypto.Connection.prototype._external; + }, TypeError); + + assert.strictEqual( + typeof Object.getOwnPropertyDescriptor( + crypto.SecureContext.prototype, '_external'), + 'object' + ); + + assert.strictEqual( + typeof Object.getOwnPropertyDescriptor( + crypto.Connection.prototype, '_external'), + 'object' + ); + } } diff --git a/test/parallel/test-http2-util-headers-list.js b/test/parallel/test-http2-util-headers-list.js index 0bbe1972d07981..0ff6b558d9a51b 100644 --- a/test/parallel/test-http2-util-headers-list.js +++ b/test/parallel/test-http2-util-headers-list.js @@ -5,6 +5,8 @@ // to pass to the internal binding layer. const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); const assert = require('assert'); const { mapToHeaders } = require('internal/http2/util'); diff --git a/test/parallel/test-http2-util-update-options-buffer.js b/test/parallel/test-http2-util-update-options-buffer.js index c150f4767fe0d4..5768ce0204dc8c 100644 --- a/test/parallel/test-http2-util-update-options-buffer.js +++ b/test/parallel/test-http2-util-update-options-buffer.js @@ -1,7 +1,9 @@ // Flags: --expose-internals 'use strict'; -require('../common'); +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); // Test coverage for the updateOptionsBuffer method used internally // by the http2 implementation.