blob: 50c92acd1512154a9abb8e2588b759a08a0239de (
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';
require('../common');
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
}
]
}
]
});
|