mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
5a3da7b4e4
PR-URL: https://github.com/nodejs/node/pull/55218 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
34 lines
732 B
JavaScript
34 lines
732 B
JavaScript
'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/eslint/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
|
|
},
|
|
]
|
|
},
|
|
]
|
|
});
|