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 runs every test #27297

Open
andreynav opened this issue Jul 13, 2023 · 10 comments
Open

@cypress/grep runs every test #27297

andreynav opened this issue Jul 13, 2023 · 10 comments
Labels
npm: @cypress/grep @cypress/grep package issues

Comments

@andreynav
Copy link

andreynav commented Jul 13, 2023

Current behavior

@cypress/grep runs every test

Desired behavior

@cypress/grep runs specific test

Test code to reproduce

All configuration in commit - andreynav/conduit-cypress@640bb80

// cypress.config.js

...
setupNodeEvents(on, config) {
      require('@cypress/grep/src/plugin')(on,  config)
      return config
    },
...

Note 1: official documentation

setupNodeEvents(on, config) {
      require('@cypress/grep/src/plugin')(config);
      return config;
    },

has an error - require('@cypress/grep/src/plugin')(config); - need pass 2 params (on, config) instead of 1. Only 1 param lead to error.

// package.json

"cy-smoke-chrome": "npx cypress run --headed --browser chrome --env grepTags=@smoke,grepFilterSpecs=true",

// cypress/e2e/tests/ui/signup.js

it('should register a new user', { tags: '@smoke' },() => {
   signup.openSignupPage()
   signup.registerUser(name, email, password)
 })

Actual result: When run the command all tests are fired

Note 2: there is nothing tell in official documentation, but in some issue discussion tell that need added the next rows in /support/e2e.js file

import cypressGrep from '@cypress/grep'
cypressGrep()

I added these rows as well but it doesn't help

Cypress Version

12.16.0

Node version

18.16.1

Operating System

macOS Monterey 12.4

Debug Logs

No response

Other

No response

@viniciusbit
Copy link

I have the same problem. I use "grepFilterSpecs: true" but it finds all tests instead of one

@ankitguheSS
Copy link

I am having same issue, Cypress-grep does not filter tests before run

@nazad23
Copy link

nazad23 commented Aug 14, 2023

Has anyone come up with any solutions ?

@arizmendiomar
Copy link

This was working fine with the previous version (cypress-grep).
Does someone have a fix or a workaround for this issue?

@joafeldmann
Copy link

Same issue here!

@maniejhunreyes
Copy link

any update or fix on this issue?

@dkirchan
Copy link

Adding the following in the config, env field did the trick for me.

    grepIntegrationFolder: "../"

Generally I pointed the grepIntegrationFolder to the level that points to the cypress folder.
| - cypress
| - ...
| - ...

@nischaytv
Copy link

Did anyone find solution or any workaround for this?

@ilija-scale
Copy link

I am also still searching for solution on this

@ptakpatryk
Copy link

In your scenario @andreynav that line is definitely incorrect:
require('@cypress/grep/src/plugin')(on, config)
It should be require('@cypress/grep/src/plugin')(on, config) instead.

I have a problem where it filters spec file but not single tests within the spec file, so it ends up running all test cases in the file that has at least one tag that I filter for :( I was playing around with the config and passing on and config at once breaks everything.

@jennifer-shehane jennifer-shehane added the npm: @cypress/grep @cypress/grep package issues label May 15, 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
Projects
None yet
Development

No branches or pull requests