1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6 7common.skipIfEslintMissing(); 8 9const { RuleTester } = require('../../tools/node_modules/eslint'); 10const rule = require('../../tools/eslint-rules/no-duplicate-requires'); 11 12new RuleTester().run('no-duplicate-requires', rule, { 13 valid: [ 14 { 15 code: 'require("a"); require("b"); (function() { require("a"); });', 16 }, 17 { 18 code: 'require(a); require(a);', 19 }, 20 ], 21 invalid: [ 22 { 23 code: 'require("a"); require("a");', 24 errors: [{ message: '\'a\' require is duplicated.' }], 25 }, 26 ], 27}); 28