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

negative filters should allow to opt-in/out for non-feature files #1125

Closed
3 tasks done
OleksiiKachan opened this issue Nov 17, 2023 · 2 comments
Closed
3 tasks done

Comments

@OleksiiKachan
Copy link

Current behavior

After this update #1116 unable to separate feature and non-feature files anymore

I am in a middle of migration to cucumber and I have 3 groups for cypress tests

  • legacy - regular cypress tests. ran with --spec 'cypress/e2e/**/*.{js,jsx,ts,tsx}' flag
  • smoke - *.feature specs with tags='@smoke'
  • extended - *.feature specs with tags='not @smoke'

After updating to v19.1.1 extended group also includes all the legacy group tests since it is not .feature. I tried running negative filter and adding --spec 'cypress/e2e/**/*.feature flag but it looks like it is completely ignored

Desired behavior

Be able to run feature specs separately. if needed

Test code to reproduce

command for extended tests

yarn cypress run --browser chrome --env tags='not @smoke' --parallel --record --group extended-tests --ci-build-id ${CIRCLE_WORKFLOW_ID} --tag "staging,pr" --spec 'cypress/e2e/**/*.feature'

command for extended tests

yarn cypress run --browser chrome --parallel --record --group legacy-tests --ci-build-id ${CIRCLE_WORKFLOW_ID} --spec 'cypress/e2e/**/*.{js,jsx,ts,tsx}' --tag "staging,pr"

Versions

  • Cypress version: 13.5.1
  • Preprocessor version: 19.1.1
  • Node version: 20.9.0

Checklist

  • I've read the FAQ.
  • I've read instructions for logging issues.
  • I'm not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).
@badeball
Copy link
Owner

I tried running negative filter and adding --spec 'cypress/e2e/**/*.feature flag but it looks like it is completely ignored

Code running in setupNodeEvents (like this plugin) unfortunately doesn't appear to have access to --spec <files> information. I've tried making in inquiry in their discord, but I highly doubt I'll get an answer.

The best alternative I can imagine right now, is to introduce an option (a mode) to control filtering of non-features when using filterSpecs.

badeball added a commit that referenced this issue Nov 26, 2023
Filtering non-Cucumber specs (which doesn't contain tags) is not
straight forward and there's not a single behavior that's more intuitive
than others. Hence a `filterSpecsMixedMode` option.

This fixes #1125 [1], essentially reverts 0b2702b [2] by retaining
original behavior by default, and also relates to #1116 [3].

[1] #1125
[2] 0b2702b
[3] #1116
@badeball
Copy link
Owner

I've added an option to control this behavior with v19.2.0. By default, non-Cucumber specs are hidden when using tag expressions and filterSpecs: true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants