blob: 6999c06986efdb8bffc7cc9aa62d2887b6497073 (
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
35
36
37
38
|
'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/documented-errors');
const invalidCode = 'UNDOCUMENTED ERROR CODE';
new RuleTester().run('documented-errors', rule, {
valid: [
`
E('ERR_ASSERTION', 'foo');
`,
],
invalid: [
{
code: `
E('${invalidCode}', 'bar');
`,
errors: [
{
message: `"${invalidCode}" is not documented in doc/api/errors.md`,
line: 2
},
{
message:
`doc/api/errors.md does not have an anchor for "${invalidCode}"`,
line: 2
},
]
},
]
});
|