I'm testing my app with Jest and Cypress using TypeScript. The Jest files end in .test.ts
, while the Cypress test files end in .spec.ts
. I use the Jest ESLint plugin, which comes with the expect-expect
rule. Many Cypress tests don't contain an expect
.
How can I disable this rule for files ending in .spec.ts
? Is it possible to disable rules for specific file extenions in the .eslintrc.json
? (I want to avoid having to write a comment in each of the .spec.ts
files.)
EDIT: I know that I could add "cy.*"
to the "assertFunctionNames"
, but there are other rules that I need to disable for .spec
files, too, such as valid-expect
and valid-expect-in-promise
.
You can use the override
property in .eslintrc
file. Using configuration files to disable for a group of files
So what you want is to disable jest/expect-expect
rule for all files with the extension .spec.ts
, you need to add this in your .eslintrc
file.
{
"rules": {...},
"overrides": [
{
"files": ["*.spec.ts"],
"rules": {
"jest/expect-expect": "off"
}
}
]
}