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

feature paths of cucumber.js would not be overridden if provide particular feature file in CLI #2253

Open
aaronpliu opened this issue Mar 3, 2023 · 4 comments
Labels
💔 breaking change This will require a major release ⚡ enhancement Request for new functionality

Comments

@aaronpliu
Copy link

aaronpliu commented Mar 3, 2023

In cucumber.js, it looks for feature file from /features and step definitions.
Now I configured "paths" in cucumber.js with test/features/**/*feature. If provided a particular feature file in CLI, it will not be overridden "paths". Then I cannot run single feature file.

I need an alternative approach to run single or all features.
Is there any good ideas?

Cucumber version: v8.10.0

Thanks

@davidjgoss davidjgoss added the ⚡ enhancement Request for new functionality label Mar 8, 2023
@davidjgoss
Copy link
Contributor

davidjgoss commented Mar 8, 2023

Thanks for raising @aaronpliu.

This was discussed a bit in #1712 but fizzled out because the use case was solved another way.

I think there are three ways we could tackle this:

  1. Suport negation in the arguments
  2. Add another option like --default-paths
  3. Change the behaviour of the feature paths arg so CLI-provided values will override rather than merge (only for this one - not for any other options/flags)

The more I think about it, the more I think 3 makes the most sense.

@pwmcintyre
Copy link

+1 this would be a nice addition

i frequently want to run a single test (eg. while fixing a bug) ... and so i run the following expecting it to run just 1 feature

npm run tests -- test/features/products.feature

instead it runs the whole lot

@aleksdobrev
Copy link

For running only one or some tests, I use some of these options:

  • npm test --test/features/products.feature:33 Where the number is the line at which the test starts.
  • npm test -- -f rerun:@filename.ext This will create a file listing all failing scenarios(if there are such) in a syntax like the previous point, which you can use to run only the failing scenarios easily.
  • Tags - you can put whatever you like and run npm test -- --tags @tagname.
  • Something unique in the name, like an ID number or a text and run npm test -- --name unique_name.

@davidjgoss davidjgoss added the 💔 breaking change This will require a major release label Jul 9, 2023
@davidjgoss
Copy link
Contributor

A quick update on this: I think the best approach will be to announce our intention to make this change (see #3 from my earlier comment) by emitting a deprecation warning if you provide path(s) on the CLI that are merged into config. We can see if there is any pushback from the community with genuine use cases for having it merge instead of overwrite.

(Also thanks @aleksdobrev, some smart workarounds there.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💔 breaking change This will require a major release ⚡ enhancement Request for new functionality
Projects
None yet
Development

No branches or pull requests

4 participants