Skip to content

Commit

Permalink
fix(valid-title): check if node has arguments first (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Oct 23, 2019
1 parent 7eae625 commit e961e21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rules/__tests__/valid-title.test.ts
Expand Up @@ -9,6 +9,10 @@ const ruleTester = new TSESLint.RuleTester({

ruleTester.run('no-accidental-space', rule, {
valid: [
'it()',
'describe()',
'it("")',
'it.each()()',
'describe("foo", function () {})',
'describe(6, function () {})',
'fdescribe("foo", function () {})',
Expand Down
2 changes: 2 additions & 0 deletions src/rules/valid-title.ts
Expand Up @@ -39,6 +39,8 @@ export default createRule({
CallExpression(node) {
if (!isDescribe(node) && !isTestCase(node)) return;

if (!node.arguments.length) return;

const title = getNodeTitle(node);
if (!title) return;

Expand Down

0 comments on commit e961e21

Please sign in to comment.