mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 16:34:41 +00:00

Make changes so that tests will pass when the comma-dangle settings applied to the rest of the code base are also applied to tests. PR-URL: https://github.com/nodejs/node/pull/37930 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
38 lines
812 B
JavaScript
38 lines
812 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
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
|
|
},
|
|
]
|
|
},
|
|
]
|
|
});
|