Skip to content

Commit a3f7471

Browse files
danbevrvagg
authored andcommitted
build,test: guard eslint with crypto check
Currently, configuring --without-ssl will cause the lint-js target to fail with the following error: $ make lint-js Running JS linter... internal/util.js:101 throw new ERR_NO_CRYPTO(); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support at assertCrypto (internal/util.js:101:11) at crypto.js:31:1 ... (/node/tools/node_modules/eslint/node_modules/file-entry-cache/ cache.js:2:14) at Module._compile (internal/modules/cjs/loader.js:746:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:757:10) make: *** [lint-js] Error 1 There are also a number of tests that are affected in a similar way. This commit adds crypto checks to allow for lint-js and the affected tests to be skipped when configured --without-ssl. PR-URL: #26182 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 28758b8 commit a3f7471

18 files changed

+40
-2
lines changed

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1184,8 +1184,12 @@ lint-js-fix:
11841184
# Note that on the CI `lint-js-ci` is run instead.
11851185
# Lints the JavaScript code with eslint.
11861186
lint-js:
1187-
@echo "Running JS linter..."
1188-
@$(call available-node,$(run-lint-js))
1187+
@if [ "$(shell $(node_use_openssl))" != "true" ]; then \
1188+
echo "Skipping $@ (no crypto)"; \
1189+
else \
1190+
echo "Running JS linter..."; \
1191+
$(call available-node,$(run-lint-js)) \
1192+
fi
11891193

11901194
jslint: lint-js
11911195
@echo "Please use lint-js instead of jslint"

test/parallel/test-eslint-alphabetize-errors.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46
common.skipIfEslintMissing();
57

68
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;

test/parallel/test-eslint-crypto-check.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-documented-errors.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46
common.skipIfEslintMissing();
57

68
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;

test/parallel/test-eslint-duplicate-requires.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-eslint-check.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-inspector-check.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46
common.skipIfEslintMissing();
57

68
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;

test/parallel/test-eslint-lowercase-name-for-primitive.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-no-let-in-for-declaration.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-no-unescaped-regexp-dot.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-number-isnan.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-prefer-assert-iferror.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-prefer-assert-methods.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-prefer-common-expectserror.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-prefer-common-mustnotcall.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-prefer-util-format-errors.js

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
/* eslint-disable no-template-curly-in-string */
44

55
const common = require('../common');
6+
if (!common.hasCrypto)
7+
common.skip('missing crypto');
68

79
common.skipIfEslintMissing();
810

test/parallel/test-eslint-require-buffer.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

test/parallel/test-eslint-required-modules.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
46

57
common.skipIfEslintMissing();
68

0 commit comments

Comments
 (0)