mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 03:31:35 +00:00

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: https://github.com/nodejs/node/pull/26182 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
common.skipIfEslintMissing();
|
|
|
|
const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
|
|
const rule = require('../../tools/eslint-rules/lowercase-name-for-primitive');
|
|
|
|
new RuleTester().run('lowercase-name-for-primitive', rule, {
|
|
valid: [
|
|
'new errors.TypeError("ERR_INVALID_ARG_TYPE", "a", ["string", "number"])',
|
|
'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "string")',
|
|
'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "number")',
|
|
'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "boolean")',
|
|
'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "null")',
|
|
'new errors.TypeError("ERR_INVALID_ARG_TYPE", "name", "undefined")',
|
|
],
|
|
invalid: [
|
|
{
|
|
code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'Number')",
|
|
errors: [{ message: 'primitive should use lowercase: Number' }],
|
|
output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'number')",
|
|
},
|
|
{
|
|
code: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'STRING')",
|
|
errors: [{ message: 'primitive should use lowercase: STRING' }],
|
|
output: "new errors.TypeError('ERR_INVALID_ARG_TYPE', 'a', 'string')",
|
|
},
|
|
{
|
|
code: "new e.TypeError('ERR_INVALID_ARG_TYPE', a, ['String','Number'])",
|
|
errors: [
|
|
{ message: 'primitive should use lowercase: String' },
|
|
{ message: 'primitive should use lowercase: Number' },
|
|
],
|
|
output: "new e.TypeError('ERR_INVALID_ARG_TYPE', a, ['string','number'])",
|
|
},
|
|
]
|
|
});
|