question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no-unnecessary-waiting: TypeError: Cannot read property 'null' of undefined

See original GitHub issue

using eslint-plugin-cypress@2.9.0

2.8.1 works fine, but 2.9.0 throws an error on

      cy.login(adapterUser).wait(5000)
TypeError: Cannot read property 'null' of undefined
Occurred while linting /Users/ggp/dev/tw-git/saas-ui/cypress/integration/systems/settings.systems.datasource.connect.request.negative.spec.js:24
    at isIdentifierNumberConstArgument (/Users/ggp/dev/tw-git/saas-ui/node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js:76:39)
    at CallExpression (/Users/ggp/dev/tw-git/saas-ui/node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js:27:15)
    at /Users/ggp/dev/tw-git/saas-ui/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/ggp/dev/tw-git/saas-ui/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/ggp/dev/tw-git/saas-ui/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/Users/ggp/dev/tw-git/saas-ui/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/Users/ggp/dev/tw-git/saas-ui/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/Users/ggp/dev/tw-git/saas-ui/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:634:23)
    at /Users/ggp/dev/tw-git/saas-ui/node_modules/eslint/lib/linter/linter.js:936:32
error Command failed with exit code 2.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
jsifaldacommented, Apr 20, 2020

still an issue… 👍

8reactions
chozandrias76commented, Apr 15, 2021

Can someone provide a reproducible example? Like a repo to recreate? Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide.

Yes:

module.exports = {
  foo: 1
}
import * as cy from "cypress";
import { foo } from "index";
describe("Going to the Org Summary page", () => {
  it("does something", ()=>{
    cy.wait(foo);
  })
})
{
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "plugin:cypress/recommended"
    ],
    "parserOptions": {
        "ecmaVersion": 12,
        "sourceType": "module"
    },
    "plugins": [
        "cypress"
    ],
    "rules": {
    }
}
~/DearestIndigoServer$ npx eslint index.spec.js

Oops! Something went wrong! :(

ESLint: 7.24.0

TypeError: Cannot read property 'null' of undefined
Occurred while linting /home/runner/DearestIndigoServer/index.spec.js:5
    at isIdentifierNumberConstArgument (/home/runner/DearestIndigoServer/node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js:72:39)
    at CallExpression (/home/runner/DearestIndigoServer/node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js:22:15)
    at /home/runner/DearestIndigoServer/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/runner/DearestIndigoServer/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/runner/DearestIndigoServer/node_modules/eslint/lib/linter/node-event-generator.js:256:26)
    at NodeEventGenerator.applySelectors (/home/runner/DearestIndigoServer/node_modules/eslint/lib/linter/node-event-generator.js:285:22)
    at NodeEventGenerator.enterNode (/home/runner/DearestIndigoServer/node_modules/eslint/lib/linter/node-event-generator.js:299:14)
    at CodePathAnalyzer.enterNode (/home/runner/DearestIndigoServer/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
    at /home/runner/DearestIndigoServer/node_modules/eslint/lib/linter/linter.js:954:32

Edit: Is lintable.

import * as cy from "cypress";
import {foo} from "index";
const bar = foo;
describe("Going to the Org Summary page", () => {
  it("does something", ()=>{
    cy.wait(bar);
  })
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property of null - iDiallo
All this means is that you are trying to access a property of an object that is undefined. These usually happens when we...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >
Uncaught TypeError: Cannot read property 'value' of null
I am unsure which of them is wrong because you did not provide your HTML, but one of these does not exist: var...
Read more >
How to Avoid the Infamous "Cannot read properties of ... - Bitovi
... are two ways of interpreting null and undefined types and one of them can avoid the 'Cannot read properties of undefined' runtime...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found