1'use strict';
2
3const common = require('../common');
4if ((!common.hasCrypto) || (!common.hasIntl)) {
5  common.skip('ESLint tests require crypto and Intl');
6}
7common.skipIfEslintMissing();
8
9const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
10const rule = require('../../tools/eslint-rules/inspector-check');
11
12const message = 'Please add a skipIfInspectorDisabled() call to allow this ' +
13                'test to be skipped when Node is built ' +
14                '\'--without-inspector\'.';
15
16new RuleTester().run('inspector-check', rule, {
17  valid: [
18    'foo;',
19    'require("common")\n' +
20      'common.skipIfInspectorDisabled();\n' +
21      'require("inspector")',
22  ],
23  invalid: [
24    {
25      code: 'require("common")\n' +
26            'require("inspector")',
27      errors: [{ message }],
28      output: 'require("common")\n' +
29              'common.skipIfInspectorDisabled();\n' +
30              'require("inspector")'
31    },
32  ]
33});
34