code-coverage icon indicating copy to clipboard operation
code-coverage copied to clipboard

add TypeScript definition to task.js

Open quisido opened this issue 3 years ago • 1 comments

Fixes error in IDE:

image

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.

quisido avatar Jan 08 '22 22:01 quisido

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 08 '22 22:01 CLAassistant

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.

quisido avatar Jul 31 '23 20:07 quisido

@CharlesStover this is no longer an issue in Cypress 10+ AFAIK. Can you provide an example of this in a newer version of Cypress?

jordanpowell88 avatar Aug 02 '23 20:08 jordanpowell88

Still an error @jordanpowell88 image

Let's approve and merge this

lmiller1990 avatar Aug 02 '23 23:08 lmiller1990

:tada: This PR is included in version 3.12.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

cypress-app-bot avatar Sep 06 '23 17:09 cypress-app-bot

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.

filipomar avatar Nov 25 '23 19:11 filipomar