After using react-testing-library
and
@testing-library/jest-dom/extend-expect
, I decided to install Cypress. However, I now face Typescript errors on all my jest matchers:
Property 'toEqual' doesn't exist on type 'Assertion'. Did you mean 'equal'?
It seems like the type of expect
is being pulled from the wrong assertion library or something. Even expect(...).to.equal(...)
isn't working as expected.
I attempted to install @types/jest
, yarn seemed to have succeeded but it's not showing up in my package.json
's devDependencies
.
Below is a snippet of my tsconfig
:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"noImplicitAny": false,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": false,
"noEmit": true,
"jsx": "react",
"skipDefaultLibCheck": true,
"types": [
"node",
"cypress",
"jest"
]
},
"include": [
"src"
]
}
Additionally, I'm encountering an issue where all my cy
calls in my cypress tests are flagging a cy is not defined
error from ESLint.