question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@cypress/grep TS linter displays errors when using tags in "describe" but not "it"

See original GitHub issue

Current behavior

As per the docs we have added the types to the tsconfig.json file like so:

"types": ["cypress", "@cypress/grep", "node"],

However, when using the tags in describe blocks, the Typescript linter displays errors e.g:

describe('Test file', { tags: ['@tag1', '@tag2'] }, () => { Argument of type ‘{ tags: string[]; }’ is not assignable to parameter of type ‘SuiteConfigOverrides’. Object literal may only specify known properties, and ‘tags’ does not exist in type ‘SuiteConfigOverrides’.

No errors are displayed when using them with “it” e.g: it('Test file', { tags: ['@tag1', '@tag2'] }, () => {

We can use //@ts-ignore to remove these but it is not ideal and the previous ‘cypress-grep’ package did not have these issues.

Desired behavior

No errors should be shown regardless of whether you use describe or it

Test code to reproduce

tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "lib": ["es5", "dom"],
        "types": ["cypress", "@cypress/grep", "node"],
        "resolveJsonModule": true
    },
    "include": ["**/*.ts"]
}

spec file:

describe('Test file', { tags: ['@tag1', '@tag2'] }, () => {})

Cypress Version

11.2.0

Node version

v16.14.2

Operating System

macOS 12.2.1, Windows 10

Debug Logs

No response

Other

No response

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:7
  • Comments:7

github_iconTop GitHub Comments

2reactions
vergjorcommented, Dec 9, 2022

Add the following before the describe or context in ts tests, it will suppress the error:

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
describe('block with config tag', { tags: '@smoke' }, () => {})
2reactions
bmanubolucommented, Nov 30, 2022

Do we have a work around for this issue. I am facing the same issue in cypress 11.2 version with “@cypress/grep”: “^3.1.0”,

Read more comments on GitHub >

github_iconTop Results From Across the Web

@cypress/grep - npm
Start using @cypress/grep in your project by running `npm i @cypress/grep`. There are no other projects in the npm registry using ...
Read more >
Cypress Run Tests That Have Certain Tags - Justin James
With the Cypress grep plugin, you can add a tags config to each tests or describe like below that then you can use...
Read more >
Could not find a declaration file for module 'module-name ...
When a module is not yours - try to install types from @types : ... Those files are called type declaration files with...
Read more >
Run Cypress Tests Using WebKit Browser - Gleb Bahmutov
Instead I prefer to execute all tests on one browser, and run just some tests on other browsers using cypress-grep test tags.
Read more >
Cypress App
This increased visibility into your test history allows you to debug your tests faster and more effectively, all within your local workflow. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found