Skip to content

Commit

Permalink
test: add eslint-disable crypto-check
Browse files Browse the repository at this point in the history
There are currently usages of common.hasCrypto which are not just for
detecting if crypto support is available and then skip the test in
question. For these case we still want to have a lint error generated
which can then be disabled using an ESLint comment.
  • Loading branch information
danbev committed Aug 23, 2017
1 parent 99699c3 commit b4924a3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

/* eslint-disable required-modules */
/* eslint-disable required-modules, crypto-check */
'use strict';
const path = require('path');
const fs = require('fs');
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-async-wrap-getasyncid.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ function testInitialized(req, ctor_name) {
}


if (common.hasCrypto) {
if (common.hasCrypto) { // eslint-disable-line crypto-check
const tls = require('tls');
// SecurePair
testInitialized(tls.createSecurePair().ssl, 'Connection');
}


if (common.hasCrypto) {
if (common.hasCrypto) { // eslint-disable-line crypto-check
const crypto = require('crypto');

// The handle for PBKDF2 and RandomBytes isn't returned by the function call,
Expand Down Expand Up @@ -215,7 +215,7 @@ if (common.hasCrypto) {
}


if (common.hasCrypto) {
if (common.hasCrypto) { // eslint-disable-line crypto-check
const TCP = process.binding('tcp_wrap').TCP;
const tcp = new TCP();

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-alloc.js
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ assert.throws(() => Buffer.from('', 'buffer'),
}
}

if (common.hasCrypto) {
if (common.hasCrypto) { // eslint-disable-line crypto-check
// Test truncation after decode
const crypto = require('crypto');

Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-buffer-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function assertWrongList(value) {
}));
}

// eslint-disable-next-line crypto-check
const random10 = common.hasCrypto ?
require('crypto').randomBytes(10) :
Buffer.alloc(10, 1);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http2-noflag.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
require('../common');
const assert = require('assert');

assert.throws(() => require('http2'),
assert.throws(() => require('http2'), // eslint-disable-line crypto-check
/^Error: Cannot find module 'http2'$/);

0 comments on commit b4924a3

Please sign in to comment.