11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciif ((!common.hasCrypto) || (!common.hasIntl)) { 51cb0ef41Sopenharmony_ci common.skip('ESLint tests require crypto and Intl'); 61cb0ef41Sopenharmony_ci} 71cb0ef41Sopenharmony_cicommon.skipIfEslintMissing(); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst RuleTester = require('../../tools/node_modules/eslint').RuleTester; 101cb0ef41Sopenharmony_ciconst rule = require('../../tools/eslint-rules/documented-errors'); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciconst invalidCode = 'UNDOCUMENTED ERROR CODE'; 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_cinew RuleTester().run('documented-errors', rule, { 151cb0ef41Sopenharmony_ci valid: [ 161cb0ef41Sopenharmony_ci ` 171cb0ef41Sopenharmony_ci E('ERR_ASSERTION', 'foo'); 181cb0ef41Sopenharmony_ci `, 191cb0ef41Sopenharmony_ci ], 201cb0ef41Sopenharmony_ci invalid: [ 211cb0ef41Sopenharmony_ci { 221cb0ef41Sopenharmony_ci code: ` 231cb0ef41Sopenharmony_ci E('${invalidCode}', 'bar'); 241cb0ef41Sopenharmony_ci `, 251cb0ef41Sopenharmony_ci errors: [ 261cb0ef41Sopenharmony_ci { 271cb0ef41Sopenharmony_ci message: `"${invalidCode}" is not documented in doc/api/errors.md`, 281cb0ef41Sopenharmony_ci line: 2 291cb0ef41Sopenharmony_ci }, 301cb0ef41Sopenharmony_ci { 311cb0ef41Sopenharmony_ci message: 321cb0ef41Sopenharmony_ci `doc/api/errors.md does not have an anchor for "${invalidCode}"`, 331cb0ef41Sopenharmony_ci line: 2 341cb0ef41Sopenharmony_ci }, 351cb0ef41Sopenharmony_ci ] 361cb0ef41Sopenharmony_ci }, 371cb0ef41Sopenharmony_ci ] 381cb0ef41Sopenharmony_ci}); 39