• 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/eslint-check');
11
12const message = 'Please add a skipIfEslintMissing() call to allow this ' +
13                'test to be skipped when Node.js is built ' +
14                'from a source tarball.';
15
16new RuleTester().run('eslint-check', rule, {
17  valid: [
18    'foo;',
19    'require("common")\n' +
20      'common.skipIfEslintMissing();\n' +
21      'require("../../tools/node_modules/eslint")',
22  ],
23  invalid: [
24    {
25      code: 'require("common")\n' +
26            'require("../../tools/node_modules/eslint").RuleTester',
27      errors: [{ message }],
28      output: 'require("common")\n' +
29              'common.skipIfEslintMissing();\n' +
30              'require("../../tools/node_modules/eslint").RuleTester'
31    },
32  ]
33});
34