node/test/parallel/test-eslint-no-unescaped-regexp-dot.js
Rich Trott 330f25ef82 test: prepare for consistent comma-dangle lint rule
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>
2021-04-01 23:14:29 -07:00

33 lines
724 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/no-unescaped-regexp-dot');
new RuleTester().run('no-unescaped-regexp-dot', rule, {
valid: [
'/foo/',
String.raw`/foo\./`,
'/.+/',
'/.*/',
'/.?/',
'/.{5}/',
String.raw`/\\\./`,
],
invalid: [
{
code: '/./',
errors: [{ message: 'Unescaped dot character in regular expression' }]
},
{
code: String.raw`/\\./`,
errors: [{ message: 'Unescaped dot character in regular expression' }]
},
]
});