diff options
author | Shobhit Chittora <chittorashobhit@gmail.com> | 2017-11-01 01:08:45 +0530 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-17 17:11:12 +0100 |
commit | f242d4b250e50105fc2455813159ee790ac5a198 (patch) | |
tree | 2f1eb1a51b6fcf40939dee83c424bf136ea35843 /test/parallel/test-eslint-crypto-check.js | |
parent | 7ca4ca8cc36f7bf293f0d6717068eabb289262a6 (diff) | |
download | android-node-v8-f242d4b250e50105fc2455813159ee790ac5a198.tar.gz android-node-v8-f242d4b250e50105fc2455813159ee790ac5a198.tar.bz2 android-node-v8-f242d4b250e50105fc2455813159ee790ac5a198.zip |
tools: auto fix custom crypto-check eslint rule
1. Fixer for crypto-check.js
2. Extends tests
PR-URL: https://github.com/nodejs/node/pull/16647
Refs: https://github.com/nodejs/node/issues/16636
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-eslint-crypto-check.js')
-rw-r--r-- | test/parallel/test-eslint-crypto-check.js | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/test/parallel/test-eslint-crypto-check.js b/test/parallel/test-eslint-crypto-check.js index f7549f171d..86c28d2121 100644 --- a/test/parallel/test-eslint-crypto-check.js +++ b/test/parallel/test-eslint-crypto-check.js @@ -15,20 +15,34 @@ new RuleTester().run('crypto-check', rule, { 'foo', 'crypto', ` - if (!common.hasCrypto) { - common.skip(); - } - require('crypto'); + if (!common.hasCrypto) { + common.skip("missing crypto"); + } + require("crypto"); ` ], invalid: [ { - code: 'require("crypto")', - errors: [{ message }] + code: 'require("common")\n' + + 'require("crypto")', + errors: [{ message }], + output: 'require("common")\n' + + 'if (!common.hasCrypto) {' + + ' common.skip("missing crypto");' + + '}\n' + + 'require("crypto")' }, { - code: 'if (common.foo) {} require("crypto")', - errors: [{ message }] + code: 'require("common")\n' + + 'if (common.foo) {}\n' + + 'require("crypto")', + errors: [{ message }], + output: 'require("common")\n' + + 'if (!common.hasCrypto) {' + + ' common.skip("missing crypto");' + + '}\n' + + 'if (common.foo) {}\n' + + 'require("crypto")' } ] }); |