-
Notifications
You must be signed in to change notification settings - Fork 248
Closed
Labels
Description
If you have code like expect() without anything after, like toBe, then it crashes the linter. It shouldn't crash the linter. I imagine Jest would do enough to notify you that something is wrong, or at least the linter should indicate that the following statement is missing.
Sample code:
test('test', () => {
expect('a');
})Which results in the following error when linting:
TypeError: Cannot read property 'name' of undefined
Occurred while linting asdf.test.js:2
at methodName (/usr/local/lib/node_modules/eslint-plugin-jest/lib/rules/util.js:66:40)
at expectToBeCase (/usr/local/lib/node_modules/eslint-plugin-jest/lib/rules/util.js:42:140)
at CallExpression (/usr/local/lib/node_modules/eslint-plugin-jest/lib/rules/prefer-to-be-null.js:25:45)
at listeners.(anonymous function).forEach.listener (/usr/local/lib/node_modules/eslint/lib/util/safe-emitter.js:45:58)
at Array.forEach (<anonymous>)
at Object.emit (/usr/local/lib/node_modules/eslint/lib/util/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/usr/local/lib/node_modules/eslint/lib/util/node-event-generator.js:251:26)
at NodeEventGenerator.applySelectors (/usr/local/lib/node_modules/eslint/lib/util/node-event-generator.js:280:22)
at NodeEventGenerator.enterNode (/usr/local/lib/node_modules/eslint/lib/util/node-event-generator.js:294:14)
at CodePathAnalyzer.enterNode (/usr/local/lib/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)