summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-01-08 13:02:15 -0500
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-01-11 10:56:56 +0100
commit4c9ea8f3fb5fb1d26777905f442282ce85896a4b (patch)
treeeb7c04bbf0d92c74c1254fb52ab85e3703de5f77 /test
parent6cc74b038fa0d2e64e8060415487706117b4a77c (diff)
downloadandroid-node-v8-4c9ea8f3fb5fb1d26777905f442282ce85896a4b.tar.gz
android-node-v8-4c9ea8f3fb5fb1d26777905f442282ce85896a4b.tar.bz2
android-node-v8-4c9ea8f3fb5fb1d26777905f442282ce85896a4b.zip
tools: update crypo check rule
This commit updates the custom crypto-check ESLint rule to detect require() calls that come before any hasCrypto checks. PR-URL: https://github.com/nodejs/node/pull/25399 Refs: https://github.com/nodejs/node/pull/25388 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-eslint-crypto-check.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/parallel/test-eslint-crypto-check.js b/test/parallel/test-eslint-crypto-check.js
index 86c28d2121..1829e86b02 100644
--- a/test/parallel/test-eslint-crypto-check.js
+++ b/test/parallel/test-eslint-crypto-check.js
@@ -24,6 +24,14 @@ new RuleTester().run('crypto-check', rule, {
invalid: [
{
code: 'require("common")\n' +
+ 'require("crypto")\n' +
+ 'if (!common.hasCrypto) {\n' +
+ ' common.skip("missing crypto");\n' +
+ '}',
+ errors: [{ message }]
+ },
+ {
+ code: 'require("common")\n' +
'require("crypto")',
errors: [{ message }],
output: 'require("common")\n' +