code-coverage
code-coverage copied to clipboard
add TypeScript definition to task.js
Fixes error in IDE:
Fixes error in CI:
/.../cypress/plugins/index.ts
13:3 error Unsafe call of an `any` typed value @typescript-eslint/no-unsafe-call
Workaround
I've been copy-pasting this between repos, which is a poor developer experience, but it's also now not working in monorepos, because it's existence in the root directory is not picked up by the workspace-specific linter.
declare module '@cypress/code-coverage/task' {
import 'cypress';
export default function registerCodeCoverageTasks(
on: Cypress.PluginEvents,
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
config: Cypress.PluginConfigOptions,
): void;
}
The aim of this PR is to apply the workaround solution to this repository such that the workaround is no longer required.
Sorry to ping directly @lmiller1990 and @cacieprins but since you reviewed the last PR and this PR also has not been reviewed in >1 year, please give it a look. This TypeScript incompatibility blocks all validation of Cypress code coverage (which is important when combining multiple plugins) and linters that prevent the use of any
.
@CharlesStover this is no longer an issue in Cypress 10+ AFAIK. Can you provide an example of this in a newer version of Cypress?
Still an error @jordanpowell88
Let's approve and merge this
:tada: This PR is included in version 3.12.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I added another PR tangential to this issue, as I don't think the type is 100% correct. Also, I stumbled upon this issue, which I think can be closed due to it already being resolved.