Description
Root cause:
When the @cypress/grep
plugin appears to use the location of the cypress config file as the path for the integrationFolder
. If the config file is not at the root of the project, then it does not find the specs correctly based on this path and the spec pattern.
Original issue
Current behavior
When using grep
flag, tests with a certain name are correctly ran. However using grepFilterSpecs
and grepOmitFiltered
has no effect.
Repro:
- register plugin in both cypress/cypress.config.js and cypress/support/e2e.js according to the guide
- set env in cypress.config.js:
env: {
grepFilterSpecs: true,
grepOmitFiltered: true,
grep: 'The Login Page'
}
Note:
There is only one test containing 'The Login Page' in it's name:
- run from the terminal:
set DEBUG=@cypress/grep && npx cypress run --config-file cypress/cypress.config.js
Result:
'The Login Page' test is being correctly ran, other tests are being incorrectly "skipped" - they pass with 0 tests:
Desired behavior
Expected:
Only the test with the provided name is being ran. The rest is completely omited when grepFilterSpecs
and grepOmitFiltered
are enabled and no time is being wasted on going through "skipped" tests.
Test code to reproduce
Please see above.
Cypress Version
12.11.0
Node version
v16.14.0
Operating System
Microsoft Windows 10 Pro, 10.0.19044
Debug Logs
@cypress/grep @cypress/grep plugin version 3.1.5 +0ms
@cypress/grep: tests with "The Login Page" in their names
@cypress/grep: will omit filtered tests
@cypress/grep Cypress config env object: { FAIL_FAST_ENABLED: false, grepFilterSpecs: true, grepOmitFiltered: true, grep: 'The Login Page', apiUrl: MASKED, baseUrl: MASKED, emberBaseUrl: MASKED, numTestsKeptInMemory: 1, __cypress_cucumber_preprocessor_dont_use_this_suite: { isEventHandlersAttached: true } } +0ms
@cypress/grep specPattern [
'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
'cypress/e2e/cucumber/**/*.feature'
] +1ms
@cypress/grep excludeSpecPattern cypress/e2e/cucumber/**/*.{js,ts} +0ms
@cypress/grep integrationFolder C:\web\MASKED\monorepo\cypress +0ms
@cypress/grep found 0 spec files +5ms
@cypress/grep [] +0ms
@cypress/grep: filtering specs using "The Login Page" in the title
@cypress/grep parsed grep { title: [ { title: 'The Login Page', invert: false } ], tags: [] } +1ms
@cypress/grep found grep "The Login Page" in 0 specs +0ms
@cypress/grep [] +0ms
grep and/or grepTags has eliminated all specs