Closed
Description
eslint-plugin-jest-dom
version: 3.6.3node
version: 14.15npm
version: 6.14.8
Relevant code or config
Use case: Users keeps snippet of test case block template ready in the same file they are currently working on. Linting results are lost due to linter crashing on expect().toBe()
.
test.todo('todo', () => {
expect().toBe();
});
What you did:
./node_modules/.bin/eslint
What happened:
TypeError: Cannot destructure property `object` of 'undefined' or 'null'.
Reproduction repository:
Crash from real project
Rule: unable-to-parse-rule-id
Message: Cannot destructure property
object of 'undefined' or 'null'.
Path: open-source-labs/Recoilize/src/app/components/Metrics/__tests__/Visualizer.unit.test.js
Link
});
//a component should display the render time of a component
xit('render time should be of type number', () => {
//the type of data being rendered should be a number
expect().toBe();
});
xit('should be of type string', () => {
//that dom element should render a string
expect().toBe();
});
Error:
TypeError: Cannot destructure property `object` of 'undefined' or 'null'.
Occurred while linting <text>:21
at CallExpression[callee.property.name=/toBe(Truthy|Falsy)?|toEqual/][callee.object.callee.name='expect'] (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-jest-dom/dist/createBannedAttributeRule.js:34:21)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
at NodeEventGenerator.applySelectors (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
at NodeEventGenerator.enterNode (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
at CodePathAnalyzer.enterNode (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/linter.js:952:32
at Array.forEach (<anonymous>)
Problem description: -
Suggested solution: Should not crash