From 7007b3312b682a8b83b229c846324fa50419bbf9 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Mon, 17 Feb 2020 23:34:00 +0800 Subject: [PATCH] Add `u` flag in RegExp for `valid-test-description` and `valid-suite-description` --- lib/rules/valid-suite-description.js | 4 ++-- lib/rules/valid-test-description.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rules/valid-suite-description.js b/lib/rules/valid-suite-description.js index f702ea3..a23d0da 100644 --- a/lib/rules/valid-suite-description.js +++ b/lib/rules/valid-suite-description.js @@ -9,7 +9,7 @@ const astUtils = require('../util/ast'); const defaultSuiteNames = [ 'describe', 'context', 'suite' ]; function inlineOptions(context) { - const pattern = new RegExp(context.options[0]); + const pattern = new RegExp(context.options[0], 'u'); const suiteNames = context.options[1] ? context.options[1] : defaultSuiteNames; const message = context.options[2]; @@ -17,7 +17,7 @@ function inlineOptions(context) { } function objectOptions(options) { - const pattern = new RegExp(options.pattern); + const pattern = new RegExp(options.pattern, 'u'); const suiteNames = options.suiteNames ? options.suiteNames : defaultSuiteNames; const message = options.message; diff --git a/lib/rules/valid-test-description.js b/lib/rules/valid-test-description.js index 025398f..42a97a9 100644 --- a/lib/rules/valid-test-description.js +++ b/lib/rules/valid-test-description.js @@ -10,7 +10,7 @@ const astUtils = require('../util/ast'); const defaultTestNames = [ 'it', 'test', 'specify' ]; function inlineOptions(context) { - const pattern = context.options[0] ? new RegExp(context.options[0]) : /^should/; + const pattern = context.options[0] ? new RegExp(context.options[0], 'u') : /^should/u; const testNames = context.options[1] ? context.options[1] : defaultTestNames; const message = context.options[2]; @@ -18,7 +18,7 @@ function inlineOptions(context) { } function objectOptions(options) { - const pattern = options.pattern ? new RegExp(options.pattern) : /^should/; + const pattern = options.pattern ? new RegExp(options.pattern, 'u') : /^should/u; const testNames = options.testNames ? options.testNames : defaultTestNames; const message = options.message;