From ffcd2d2fad501a319bf7755d2e8fcc6a47c034e2 Mon Sep 17 00:00:00 2001 From: platinumazure Date: Sat, 7 Oct 2023 11:43:50 -0500 Subject: [PATCH] fix: loosen regex in no-commented-tests (fixes #61) --- lib/rules/no-commented-tests.js | 2 +- tests/lib/rules/no-commented-tests.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/rules/no-commented-tests.js b/lib/rules/no-commented-tests.js index 501e9d70..b784b81c 100644 --- a/lib/rules/no-commented-tests.js +++ b/lib/rules/no-commented-tests.js @@ -26,7 +26,7 @@ module.exports = { create: function (context) { const sourceCode = context.getSourceCode(), newlineRegExp = /\r\n|\r|\n/g, - warningRegExp = /\b(QUnit\.test|QUnit\.asyncTest|QUnit\.skip|test|asyncTest)\s*\(/g; + warningRegExp = /\b(QUnit\.test|QUnit\.asyncTest|QUnit\.skip|test|asyncTest)\s*\(\s*["'`]/g; function getNewlineIndexes(text) { const indexes = []; diff --git a/tests/lib/rules/no-commented-tests.js b/tests/lib/rules/no-commented-tests.js index f296ad66..a567e8fe 100644 --- a/tests/lib/rules/no-commented-tests.js +++ b/tests/lib/rules/no-commented-tests.js @@ -23,7 +23,11 @@ ruleTester.run("no-commented-tests", rule, { "QUnit.skip('Name', function () { ok(true); });", // shebang comments - "#!/some-test()" + "#!/some-test()", + + // Allow test, parentheses, no quote (https://github.com/platinumazure/eslint-plugin-qunit/issues/61) + "// TODO: refactor with a Component test (instead of an Acceptance test)", + "// Run actual test (without context)." ], invalid: [