-
Notifications
You must be signed in to change notification settings - Fork 105
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
UNKNOWN_OPTION could be optional #38
Comments
It requires minor changes https://github.com/flipflopapp/command-line-args works for my usecase. |
ok, thanks - i had a look at what you did.. I'm considering solutions for handling unknown options but won't be discarding them, as in your case. Closing as a near-duplicate of #25, which i'm working on as we speak. |
btw, is there any reason you can't create a definition for |
i've almost finished implementing a new feature to allow unknown options.. could you send an example of how your app was failing with mocha please, so i can test it? |
(oops late response - missed the mail notifications). I can create a --no-timeouts option in my app but I thought I would have to add options everytime I wanted to pass a new option to mocha. The command line looks like below, $ mocha test/test-file.js --some_option_for_app --some_option_for_mocha My nodejs app accepts some parameters from command line arguments. It was failing when it saw arguments that were meant for mocha. Please let me know if I can provide anymore information. |
ok, thanks for the example - i understand what you're doing now, thanks. |
with the new version of command-line-args, if you have this mocha script: /* demonstrates use in a mocha test script */
const assert = require('assert')
const commandLineArgs = require('../')
const options = commandLineArgs({ name: 'value', type: Number }, { partial: true })
describe('Array', function () {
describe('#indexOf()', function () {
it('should return -1 when the value is not present', function () {
assert.equal(options.value, [ 1, 2, 3 ].indexOf(4))
})
})
}) you can run the script with a command like this and it will not throw a
{
"value": -1,
"_unknown": [
"--no-colors",
"example/mocha.js"
]
} |
i've released a beta version which implements this feature.. for details, see #25 and let me know your thoughts. Thanks! |
Looks perfect. Thanks for the quick turnaround. Cheers |
When I use an app that uses the npm module with mocha (and I want to pass some options to mocha and others to the module being tested), I see an UNKNOWN_OPTION error. For example, I want to pass --no-timeout to mocha.
The text was updated successfully, but these errors were encountered: