Skip to content

Commit

Permalink
fix(no-restricted-jest-methods): don't crash on jest() (#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Oct 18, 2022
1 parent 7872896 commit 4450daa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/rules/__tests__/no-restricted-jest-methods.test.ts
Expand Up @@ -13,6 +13,7 @@ const ruleTester = new TSESLint.RuleTester({
ruleTester.run('no-restricted-jest-methods', rule, {
valid: [
'jest',
'jest()',
'jest.mock()',
'expect(a).rejects;',
'expect(a);',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-restricted-jest-methods.ts
Expand Up @@ -33,7 +33,7 @@ export default createRule<
CallExpression(node) {
const jestFnCall = parseJestFnCall(node, context);

if (jestFnCall?.type !== 'jest') {
if (jestFnCall?.type !== 'jest' || jestFnCall.members.length === 0) {
return;
}

Expand Down

0 comments on commit 4450daa

Please sign in to comment.