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 prints warning if nothing is being grepped #24568

Open
gofr opened this issue Nov 7, 2022 · 0 comments
Open

@cypress/grep prints warning if nothing is being grepped #24568

gofr opened this issue Nov 7, 2022 · 0 comments
Labels
E2E Issue related to end-to-end testing npm: @cypress/grep @cypress/grep package issues Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.

Comments

@gofr
Copy link

gofr commented Nov 7, 2022

Current behavior

  1. Install the plugin and enable the grepFilterSpecs feature (as described in the README).
  2. Run Cypress without doing any grepping at all.

Cypress prints the warning:

grep and/or grepTags has eliminated all specs

Desired behavior

Cypress does not print any warning.

Cause of the bug:

  1. The greppedSpecs variable is initialized to an empty array here:
    let greppedSpecs = []
  2. This variable is only updated when either grep or grepTags is defined. That means that it remains an empty array if no grepping is being done.
  3. On this line the code then checks if there were any grepped specs:
    if (greppedSpecs.length) {
  4. And then the bug is caused by the else here:

If we did no grepping at all, we still go into that else and print a warning. That else should probably be changed to:

else if (grep || grepTags)

Test code to reproduce

See analysis above.

Cypress Version

10.10.0

Node version

N/A

Operating System

N/A

Debug Logs

No response

Other

No response

@emilyrohrbough emilyrohrbough added routed-to-tools npm: @cypress/grep @cypress/grep package issues labels Dec 8, 2022
@nagash77 nagash77 added E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. tools and removed routed-to-tools labels Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing npm: @cypress/grep @cypress/grep package issues Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.
Projects
None yet
Development

No branches or pull requests

4 participants