Skip to content

Commit

Permalink
fix(prefer-expect-assertions): fix greedy regex
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfranklin authored and SimenB committed Oct 16, 2018
1 parent 9b5939e commit 9a6ce6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rules/__tests__/prefer-expect-assertions.test.js
Expand Up @@ -87,5 +87,7 @@ ruleTester.run('prefer-expect-assertions', rule, {
'\n\t\t\texpect(someValue).toBe(true)\n' +
'\t\t\t})',
'test("it1")',
'itHappensToStartWithIt("foo", function() {})',
'testSomething("bar", function() {})',
],
});
2 changes: 1 addition & 1 deletion rules/prefer-expect-assertions.js
Expand Up @@ -54,7 +54,7 @@ module.exports = {
},
create(context) {
return {
'CallExpression[callee.name=/^it|test$/][arguments.1.body.body]'(node) {
'CallExpression[callee.name=/^(it|test)$/][arguments.1.body.body]'(node) {
const testFuncBody = node.arguments[1].body.body;

if (!isFirstLineExprStmt(testFuncBody)) {
Expand Down

0 comments on commit 9a6ce6c

Please sign in to comment.