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 grepFilteredSpecs flag doesn't pre-filter specs #28455

Open
MatthewClark2 opened this issue Dec 4, 2023 · 5 comments
Open

@cypress/grep grepFilteredSpecs flag doesn't pre-filter specs #28455

MatthewClark2 opened this issue Dec 4, 2023 · 5 comments
Labels
npm: @cypress/grep @cypress/grep package issues

Comments

@MatthewClark2
Copy link

Current behavior

Cypress will queue and individually skip all specs at runtime, which wastes a significant amount of time.

Desired behavior

Passing grepFilterSpecs=true to Cypress should pre-filter specs, meaning that they aren't queued up when calling cypress run.

Test code to reproduce

I went ahead and make a fork of cypress-realworld-app for an immediately reproducible example: https://github.com/MatthewClark2/cypress-realworld-app. It includes @cypress/grep as well and tags two describe blocks with the smoke tag.

Executing cypress with yarn run cypress:run --env grepTags=smoke will find all 21 specs included in the sample project and execute them.

Cypress Version

13.5.1

Node version

20.10.0

Operating System

Fedora 38 Workstation Edition

Debug Logs

No response

Other

No response

@fspinillo
Copy link

I'm experiencing this same behavior.

Node: 18.18.2
Cypress: 13.6.1

yarn cypress:run:staging --env grep="@critical" -- this works
yarn cypress:run:staging --env grep="@critical",grepOmitFiltered=true -- this works, and omits all tests that don't match grep
yarn cypress:run:staging --env grep="@critical",grepFilterSpecs=true -- this behaves as if you are not passing in the omit flag

The console output shows the following which is indicating that it's properly registering the plug-in:

@cypress/grep: tests with "@critical" in their names
@cypress/grep: will omit filtered tests
@cypress/grep: filtering specs using "@critical" in the title

@nischaytv
Copy link

Did anyone find solution or any workaround for this?

@jennifer-shehane jennifer-shehane added the npm: @cypress/grep @cypress/grep package issues label Jan 10, 2024
@AnnemarieD
Copy link

We are having the same issue. In our pipeline the tests will be filtered on runtime, so all spec files are run, even though only a few tests need to run.

Output in pipeline will only show
@cypress/grep: filtering using tag(s) "@kernfunctie"

It seems the config set as
env: { grepFilterSpecs: true, grepOmitFiltered: true, },
is being ignored.

I have tried checking debug logs and this confirms my suspicion that it is ignored.

When adding the filter config to my run command instead of to my config file and run the tests with Cypress open it will work, but if I run headless it will be ignored

@VaibhavAe
Copy link

We are facing the same issue as well. A lot time time is wasted during execution because of this issue. Any workarounds found yet ?

@AnnemarieD
Copy link

For me it worked again after moving the grep env options from the common config to the environment specific config, See #26642

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
Projects
None yet
Development

No branches or pull requests

6 participants