-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no-unnecessary-waiting: TypeError: Cannot read property 'null' of undefined #43
Comments
I'm unable to recreate this error from the example given. Please comment with a fully runnable example to recreate the error you are seeing and we will reopen the issue. The exact code I ran is below.
{
"plugins": [
"cypress"
],
"extends": [
"plugin:cypress/recommended"
]
}
Cypress.Commands.add('login', function () {})
it('lints', function () {
cy.login('foo').wait(5000)
})
"devDependencies": {
"cypress": "4.0.1",
"eslint": "^6.8.0",
"eslint-plugin-cypress": "^2.9.0"
} |
Please open this again, it fails with constructions like this: import { QUICK_ANIMATION_DURATION } from '../../../../../constants/ui'
// and later...
cy.wait(QUICK_ANIMATION_DURATION) The rule is failing here: const param = definition.node.params[definition.index] because |
still an issue... 👍 |
I am also still seeing this issue in the same way as @aparajita. Only difference is mine is called on the return of a Versions: |
+1 for getting the same issue, very similar to @aparajita where I'm importing a constant to determine how much to import { DEFAULT_WAIT_TIME } from '../constants';
describe('Test Suite', () => {
it('should do x...', () => {
/* eslint-disable-next-line cypress/no-unnecessary-waiting */
cy.wait(DEFAULT_WAIT_TIME);
});
}); Node: 12.18.0 |
Same issue for me except that the variable I'm waiting on is a Network stub alias imported from another file. Node: 12.16.1 Using Typescript |
Are there any updates on this? Running into the same issue as @aparajita. Node: 14.16.0 |
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": {
}
}
Edit: 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);
})
}) |
In case someone is having the same issue of @hkang1, I solved by re-assigning the constant: // this causes an error while running lint
cy.wait(MY_CONST);
// this will be accepted while running lint
const myConst = MY_CONST;
cy.wait(myConst); Hope it helps, Best! |
I just ran into this when I tried to overwrite the
So that suggests a workaround of doing something similar: |
I have given it a try and opened a PR with the update to the rule code so it can properly handle ImportBindings: #109 |
🎉 This issue has been resolved in version 2.13.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
using
eslint-plugin-cypress@2.9.0
2.8.1 works fine, but 2.9.0 throws an error on
The text was updated successfully, but these errors were encountered: