Skip to content

Commit

Permalink
Merge pull request #20 from ganimomer/master
Browse files Browse the repository at this point in the history
fix(no-focused-tests): only run on function calls
  • Loading branch information
tlvince committed Nov 4, 2015
2 parents 6b48711 + d62bdd2 commit cb28c7d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/prohibit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = function(prohibiteds, context) {
var regex = new RegExp('^(' + prohibiteds.join('|') + ')$');

return {
'Identifier': function(node) {
var result = node.name.match(regex);
'CallExpression': function(node) {
var result = node.callee && node.callee.name.match(regex);

if (result) {
context.report(node, 'Unexpected {{name}}.', {
Expand Down
7 changes: 4 additions & 3 deletions test/rules/no-disabled-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ var eslintTester = new RuleTester();
eslintTester.run('no-disabled-tests', rule, {
valid: [
'describe("", function() {})',
'describe("", function() { it("", function() {} ) })'
'describe("", function() { it("", function() {} ) })',
'x = {a: xdescribe}'
],

invalid: [
Expand All @@ -17,7 +18,7 @@ eslintTester.run('no-disabled-tests', rule, {
errors: [
{
message: 'Unexpected xdescribe.',
type: 'Identifier'
type: 'CallExpression'
}
]
},
Expand All @@ -26,7 +27,7 @@ eslintTester.run('no-disabled-tests', rule, {
errors: [
{
message: 'Unexpected xit.',
type: 'Identifier'
type: 'CallExpression'
}
]
}
Expand Down
11 changes: 6 additions & 5 deletions test/rules/no-focused-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ var eslintTester = new RuleTester();
eslintTester.run('no-focused-tests', rule, {
valid: [
'describe("", function() {})',
'describe("", function() { it("", function() {} ) })'
'describe("", function() { it("", function() {} ) })',
'x = {a: ddescribe}'
],

invalid: [
Expand All @@ -17,7 +18,7 @@ eslintTester.run('no-focused-tests', rule, {
errors: [
{
message: 'Unexpected ddescribe.',
type: 'Identifier'
type: 'CallExpression'
}
]
},
Expand All @@ -26,7 +27,7 @@ eslintTester.run('no-focused-tests', rule, {
errors: [
{
message: 'Unexpected iit.',
type: 'Identifier'
type: 'CallExpression'
}
]
},
Expand All @@ -35,7 +36,7 @@ eslintTester.run('no-focused-tests', rule, {
errors: [
{
message: 'Unexpected fdescribe.',
type: 'Identifier'
type: 'CallExpression'
}
]
},
Expand All @@ -44,7 +45,7 @@ eslintTester.run('no-focused-tests', rule, {
errors: [
{
message: 'Unexpected fit.',
type: 'Identifier'
type: 'CallExpression'
}
]
}
Expand Down

0 comments on commit cb28c7d

Please sign in to comment.