Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@cypress/grep grepTags Typescript issue #28458

Open
catkav opened this issue Dec 5, 2023 · 6 comments
Open

@cypress/grep grepTags Typescript issue #28458

catkav opened this issue Dec 5, 2023 · 6 comments
Labels
npm: @cypress/grep @cypress/grep package issues stale no activity on this issue for a long period type: typings Issue related to Cypress types (for TypeScript)

Comments

@catkav
Copy link

catkav commented Dec 5, 2023

Current behavior

When using grepTags in it block I'm seeing the following error:

Argument of type '{ tags: string; }' is not assignable to parameter of type 'ProvidesCallback'. Object literal may only specify known properties, and 'tags' does not exist in type 'ProvidesCallback'.

I've added "@cypress/grep" to "types" in my tsconfig.json file and I've added /// <reference types="@cypress/grep" /> to the top of my index.d.ts file like was suggested here cypress-io/cypress-grep#166 (comment)

Desired behavior

Currently I've added a comment to ignore the error
//@ts-expect-error TS(2345): Argument of type '{ tags: string; }' is not assignable to parameter of type 'ProvidesCallback'
However I want to tag a lot of tests and I don't want to have to comment them all, so looking for a way to resolve the error

Any help appreciated

Test code to reproduce

it('should test something', { tags: '@smoke' }, () => {
// test
});

@cypress/grep version: 4.0.1

Cypress Version

12.17.2

Node version

v18.16.1

Operating System

macOS 13.6.1

Debug Logs

No response

Other

No response

@rudreshtrivedi
Copy link

rudreshtrivedi commented Dec 5, 2023

Did you update config.ts file ??

// cypress.config.ts
{
  e2e: {
    setupNodeEvents(on, config) {
      cypressGrepPlugin(on, config);
            on('task', {
                grep(config) {
                    return cypressGrepPlugin(on, config);
                },
            });
            return config;    },
  },
},

Please follow https://github.com/cypress-io/cypress/tree/develop/npm/grep#install

@catkav
Copy link
Author

catkav commented Dec 5, 2023

Did you update config.ts file ??

// cypress.config.js
{
  e2e: {
    setupNodeEvents(on, config) {
      require('@cypress/grep/src/plugin')(config);
      return config;
    },
  }
}

Please follow https://github.com/cypress-io/cypress/tree/develop/npm/grep#install

Just tried there and still seeing the Typescript error

@rudreshtrivedi
Copy link

Try again, I have updated exact config for typescript, I would recommend to restart TS server

@catkav
Copy link
Author

catkav commented Dec 5, 2023

Tried again and restarted TS server (also tried restarting VSCode), but still seeing the error

@jennifer-shehane jennifer-shehane added type: typings Issue related to Cypress types (for TypeScript) npm: @cypress/grep @cypress/grep package issues labels Dec 6, 2023
@nemanjaglumac
Copy link

@catkav I've had the same issue until I realized cypress grep was one major version behind. Please upgrade it to the latest version (it should be major version 4) and try again.

After the upgrade, just adding @cypress/grep to the tsconfig solved the issue.

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm: @cypress/grep @cypress/grep package issues stale no activity on this issue for a long period type: typings Issue related to Cypress types (for TypeScript)
Projects
None yet
Development

No branches or pull requests

5 participants