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