When typing a custom command into commands.js
, WebStorm's linter says that both Cypress
and cy
are undefined and does not provide any IntelliSense.
Both are perfectly defined in any integration
files.
commands.js
Cypress.Commands.add('command', () => {
cy.get('div');
});
// ESLint: 'Cypress' is not defined.(no-undef)
// ESLint: 'cy' is not defined.(no-undef)
index.js
import './commands.js'
This error does not appear in VSCode. Instead both Cypress
and cy
are defined as any
.
Regardless of this error, however, the tests work fine.
What can I do to have the linter recognize Cypress in its own files?