Skip to content

Commit

Permalink
fix(add-no-commented-out): correct false positives (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangax authored and SimenB committed May 22, 2019
1 parent 1ce1402 commit 1740ee7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/rules/__tests__/no-commented-out-tests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ ruleTester.run('no-commented-out-tests', rule, {
'(a || b).f()',
'itHappensToStartWithIt()',
'testSomething()',
'// latest(dates)',
'// TODO: unify with Git implementation from Shipit (?)',
[
'import { pending } from "actions"',
'',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-commented-out-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { getDocsUrl } = require('./util');
const message = 'Some tests seem to be commented';

function hasTests(node) {
return /(x|f)?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/m.test(
return /^\s*(x|f)?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/m.test(
node.value,
);
}
Expand Down

0 comments on commit 1740ee7

Please sign in to comment.