I am facing the problem the types in Cypress and Jest clashing (such as "expect").
example.spec.ts
expect(value).toBe(0) // Property 'toBe' does not exist on type 'Assertion'.
I edited tsconfig.json in the following way, but it did not solve.
- Remove "cypress" from "types" property
- Exclude the jest spec files from in tsconfig.json and declare another tsconfig
- Exclude the jest spec files from in tsconfig.json and add tsconfig in cypress directory
Here's my tsconfig
{
"compilerOptions": {
"target": "ES2018",
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"lib": [
"ESNext",
"ESNext.AsyncIterable",
"DOM"
],
"esModuleInterop": true,
"allowJs": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
],
"@/*": [
"./*"
]
},
"types": [
"@nuxt/types",
"@nuxtjs/axios",
"@types/node",
"nuxt-i18n",
"jest"
]
},
"exclude": [
"node_modules",
".nuxt",
"dist"
]
}