-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow unknown CLI options #877
Conversation
I consider this a bug in commander that that the first one works. I don't want to allow unknown CLI options as then typos pass through or you may think cucumber-js supports some flag that it doesn't. What are you trying to pass |
Related: tj/commander.js#561 |
To the test framework itself, i.e. to be parsed further by configuration libraries. Typically tools (e.g. Yarn) would have |
Like what? Cucumber shares very little with yarn and doesn't have a feature for being able to run other scripts and pass arguments for them to parse. It is a standalone test framework and other libraries can integrate with it / wrap it. Also I believe I'm going to close this PR as I don't want to allow unknown options and will see if I can get the bug fixed on commander. Please create a separate issue focusing on your use case. |
Yarn was only meant as as example of how other tools allow for additional arguments downstream without disabling options error checking, i.e. in this case it would mean passing |
What tool are you using? I've never heard of running cucumber-js from the CLI and wanting to let some command line arguments be parsed only by another library. I think there is a better way to do this and am happy to explore this with you but I want to focus on the problem and desired behavior and not the solution in determining the best approach. |
Configuration libraries such as nconf/convict/etc allow values to be set/overwritten at runtime through either environment variables or command-line arguments. Having two different ways to manage env vars on Windows and *nix (and Windows doesn't have BTW, when you said "[...] never heard of running cucumber-js from the CLI [...]", what other ways are there? |
The second half of my sentence ("wanting to let some command line arguments be parsed only by another library") is the part I've never heard of |
We introduced the |
That doesn't really help with configs outside world, i.e. where test framework is abstracted away from tests themselves (and therefor Cucumber runtime) and use an appropriate config library instead. Cucumber is great at what it does and doesn't try to be the centre of the test framework universe like Protractor or WebDriverIO that follow Zawinski's law. |
I still don't understand the use case. When are these other libraries being loaded and why are you loading these other libraries? Due they have a node API that could be used to configure them? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Commander by default throws an error when unexpected command-line option is present which is a problem when you try to pass additional arguments to the tests without specifying a 'command' but 'options' only, i.e. when using a profile.
For example the following works fine with
test/foo
and additional--debug
:However the following throws an error
error: unknown option '--debug'
becausetest/foo
directory is in profile definition:The PR is to prevent Commander throwing exceptions when unexpected option is present and pass it verbatim to the tests.