Skip to content

Inverted tag for cypress-grep and grepUntagged doesn't work #28189

Open
CaiqueCoelho/cypress
#1
@CaiqueCoelho

Description

@CaiqueCoelho

Current behavior

Today I have some tests without tags, for example:

file1.cy.test.js -> Spec file 1

describe("Describe block file 1", () => {
   it("Test 1", () => {});
   it("Test 2", () => {});
})

And I have other tests with tags on the describe block:
file2.cy.test.js -> Spec file 2

describe("Describe block file 2", {tags: "@burn"}, () => {
   it("Test 3", () => {});
   it("Test 4", () => {});
})

I've tried running Cypress with:
npx cypress run --browser chrome --env grepTags=-@burn

But all tests are running including the ones with @burn on the describe block(test 3 and 4)
I also tried running Cypress with:
npx cypress run --browser chrome --env grepUntagged=true
But I still have all tests running including the ones with @burn on the describe block(test 3 and 4)

Looking into the logs looks like when using grepUntagged=true cypress-grep filters out all tests even the ones without tags on it and describe block, and because cypress-grep is running all tests

Desired behavior

  1. Running with npx cypress run --browser chrome --env grepTags=-@burn we should see only the tests in file 1 being executed because we want to run all tests with the exception of tests with the burn tag, which in this case must be inherited from the describe block in file 2
  2. Running with npx cypress run --browser chrome --env grepUntagged=true we should tun only the tests without tags, in this case also the tests on file 1, becase file 2 has the tag burn on the describe block

Test code to reproduce

I'm creating a small repo with the reproducible example and I'll add the comments at the end of the day

Cypress Version

12.17.4

Node version

v18.18.2

Operating System

macOS 12.4

Debug Logs

No response

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions