Skip to content
Permalink
Browse files
fix(rules): don't crash on require() (#115)
fixes #114
  • Loading branch information
jacekkopecky authored and SimenB committed May 27, 2018
1 parent 4586bdc commit 523e2f418c2c483a6dc9ee854b593ed2e8675b6e
Showing with 6 additions and 1 deletion.
  1. +1 −0 rules/__tests__/no-jest-import.test.js
  2. +5 −1 rules/no-jest-import.js
@@ -12,6 +12,7 @@ ruleTester.run('no-jest-import', rule, {
parserOptions: { sourceType: 'module' },
},
'require("somethingElse")',
'require()',
'entirelyDifferent(fn)',
],
invalid: [
@@ -22,7 +22,11 @@ module.exports = {
},
CallExpression(node) {
const calleeName = getNodeName(node.callee);
if (calleeName === 'require' && node.arguments[0].value === 'jest') {
if (
calleeName === 'require' &&
node.arguments[0] &&
node.arguments[0].value === 'jest'
) {
context.report({
loc: {
end: {

0 comments on commit 523e2f4

Please sign in to comment.