• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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').RuleTester;
10const rule = require('../../tools/eslint-rules/require-common-first');
11
12new RuleTester().run('require-common-first', rule, {
13  valid: [
14    {
15      code: 'require("common")\n' +
16            'require("assert")'
17    },
18  ],
19  invalid: [
20    {
21      code: 'require("assert")\n' +
22            'require("common")',
23      errors: [{ message: 'Mandatory module "common" must be loaded ' +
24                          'before any other modules.' }]
25    },
26  ]
27});
28