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

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

Closed
CaiqueCoelho opened this issue Oct 31, 2023 · 6 comments · May be fixed by CaiqueCoelho/cypress#1 or #28256
Closed

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

CaiqueCoelho opened this issue Oct 31, 2023 · 6 comments · May be fixed by CaiqueCoelho/cypress#1 or #28256
Labels
npm: @cypress/grep @cypress/grep package issues stale no activity on this issue for a long period

Comments

@CaiqueCoelho
Copy link

CaiqueCoelho commented Oct 31, 2023

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

@CaiqueCoelho
Copy link
Author

I also have an idea about how to fix the problem and I'll open a PR on this week

@jennifer-shehane jennifer-shehane added the npm: @cypress/grep @cypress/grep package issues label Oct 31, 2023
@CaiqueCoelho
Copy link
Author

Captura de Tela 2023-10-31 às 11 59 47

@CaiqueCoelho
Copy link
Author

Repository with a reproducible example: https://github.com/CaiqueCoelho/cypress-grep-bug-example

@CaiqueCoelho
Copy link
Author

Hey @jennifer-shehane I've uploaded a repository with a reproducible example: https://github.com/CaiqueCoelho/cypress-grep-bug-example
I also opened a PR with a proposal to fix this problem #28256
If you guys could take a look, please? I'd love to help more with Cypress <3

@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 May 5, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 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
Projects
None yet
3 participants