Issue
I have a ReactJS Typescript project with NPM and VSCode.
I am getting the following syntax error in VSCode, even though all my Cypress tests run correctly.
Error: Cannot find name 'cy'
How can I fix?
I tried the following solution and still receiving syntax errors,
npm install eslint-plugin-cypress --save-dev
"eslintConfig": {
"extends": [
"plugin:cypress/recommended"
]
},
Update Answer:
Found Official solution from Cypress Documentation, posted in my answer below https://stackoverflow.com/a/77476529/15435022
Solution
Official Cypress Documentation:
https://docs.cypress.io/guides/tooling/typescript-support
For Typescript configuration, Add this to tsconfig.json inside your cypress root folder:
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}
Answered By - mattsmith5
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.