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
fix: -- (stop parse) was not being respected by commands #1459
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to also solve the other issue I hinted at in #1457, complaining about unknown arguments past the --
. LGTM, sad it won't get into v14 though :/
Here's the test I wrote locally to validate the weird diff --git a/test/validation.js b/test/validation.js
index bd0bd1d..e9dc0d6 100644
--- a/test/validation.js
+++ b/test/validation.js
@@ -848,6 +848,19 @@ describe('validation tests', () => {
args.foo.should.equal(true)
args.bar.should.equal(true)
})
+
+ it('does not fail when unrecognized option is passed after --', () => {
+ const args = yargs('ahoy ben -- --arrr')
+ .strict()
+ .command('ahoy <matey>', 'piratical courtesy')
+ .option('arrr', { boolean: true, describe: false })
+ .fail((msg) => {
+ expect.fail(msg)
+ })
+ .parse()
+ args.matey.should.equal('ben')
+ args._.should.deep.equal(['ahoy', '--arrr'])
+ })
})
describe('demandOption', () => { |
@evocateur I will try to back-port into 14, if it applies cleanly. |
@evocateur please go ahead and test with |
@evocateur when you have a moment, could you try |
@bcoe Sorry for the delay. I think we have a problem :( Both v14.2.1 and v15.0.0 fail across all platforms in The most common error is Running the integration tests (
(this is output from the branch using The test failures are all in modules that explicitly specify |
My lerna@3.18.4 package is also broken in the same way (implicit yargs@14.2.1 dependency) |
@evocateur @NoahZinsmeister can you send a failing test? to me this seems like another dependency in lerna is mucking with object definitions:
Is there another dependency which is potentially mucking with object creation? |
possibly @bcoe ! the best i can do atm is give you the steps i'm doing to reproduce the bug locally:
|
@evocateur I believe this addresses at least half of the issues you described in #1457 (it sounded like you were potentially describing two bugs).
mind trying the branch out?
fixes #1457