cucumber-js
cucumber-js copied to clipboard
feature paths of cucumber.js would not be overridden if provide particular feature file in CLI
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
Thanks for raising @aaronpliu.
This was discussed a bit in https://github.com/cucumber/cucumber-js/issues/1712 but fizzled out because the use case was solved another way.
I think there are three ways we could tackle this:
- Suport negation in the arguments
- Add another option like
--default-paths - 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.
+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
For running only one or some tests, I use some of these options:
npm test --test/features/products.feature:33Where the number is the line at which the test starts.npm test -- -f rerun:@filename.extThis 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.
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.)