Skip to content

Commit

Permalink
fix: loosen regex in no-commented-tests (fixes #61)
Browse files Browse the repository at this point in the history
  • Loading branch information
platinumazure committed Oct 7, 2023
1 parent a07bef3 commit ffcd2d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-commented-tests.js
Expand Up @@ -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 = [];
Expand Down
6 changes: 5 additions & 1 deletion tests/lib/rules/no-commented-tests.js
Expand Up @@ -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: [
Expand Down

0 comments on commit ffcd2d2

Please sign in to comment.