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

ember-cli 2.12 argument parsing #6970

Closed
christiancueto opened this issue Apr 19, 2017 · 5 comments
Closed

ember-cli 2.12 argument parsing #6970

christiancueto opened this issue Apr 19, 2017 · 5 comments

Comments

@christiancueto
Copy link

Original Issue: ember-cli/ember-exam#84

Something has changed in the way that ember-cli parses arguments, I just wanted to add this here for visibility.

DEBUG=ember-cli:* ember exam:iterate 2 --options "--reporter teamcity --random"

Output on 2.11.1

Wed, 19 Apr 2017 19:06:57 GMT ember-cli:cli command: exam:iterate
Wed, 19 Apr 2017 19:06:57 GMT ember-cli:testing cli: command.validateAndRun
Building app for test iterations.
cleaning up...

Output on 2.12.0-beta.1

Wed, 19 Apr 2017 19:11:12 GMT ember-cli:command [lookup-command#3] initialize: name: exam:iterate, name: %s
Wed, 19 Apr 2017 19:11:12 GMT ember-cli:platform-checker: [platform-checker#253] { version: 'v7.9.0', isValid: true, isTested: true, isDeprecated: false }
Wed, 19 Apr 2017 19:11:12 GMT ember-cli:cli command: exam:iterate
Wed, 19 Apr 2017 19:11:12 GMT ember-cli:testing cli: command.beforeRun
Wed, 19 Apr 2017 19:11:12 GMT ember-cli:testing cli: command.validateAndRun
The option '--reporter teamcity --random' is not registered with the exam:iterate command. Run `ember exam:iterate --help` for a list of supported options.

Building app for test iterations.
@calderas
Copy link
Contributor

This issue is related to updating nopt from version 3.x to 4.x on 2.12.0-beta.1+
ff0b96e

https://github.com/ember-cli/ember-cli/blob/master/lib/models/command.js#L570

parsedOptions = nopt(knownOpts, this.optionsAliases, commandArgs, 0);

Example:

var nopt = require("nopt")
var args = [ '1', '--options', '--split 2 --random' ]
var knownOpts = { options: String, path: String}
var opts = nopt( knownOpts, {}, args, 0)

Logging options with nopt version 3.x, options work fine.

 { options: '--split 2 --random',
  argv:
   { remain: [ '1' ],
     cooked: [ '1', '--options', '--split 2 --random' ],
     original: [ '1', '--options', '--split 2 --random' ] } }

Logging options with nopt version 4.x, options are empty.

 { options: '',
  'split 2 --random': true,
  argv:
   { remain: [ '1' ],
     cooked: [ '1', '--options', '--split 2 --random' ],
     original: [ '1', '--options', '--split 2 --random' ] } }

@stefanpenner
Copy link
Contributor

stefanpenner commented Apr 27, 2017

Interesting, sounds like this might be an upstream nopt bug, Got time to see if thats the case?

@calderas
Copy link
Contributor

Looks like it. Does it make sense to revert to the previous version of nopt in the meantime?

@stefanpenner
Copy link
Contributor

Looks like it. Does it make sense to revert to the previous version of nopt in the meantime?

yup

@stefanpenner
Copy link
Contributor

stefanpenner commented Apr 27, 2017

@calderas mind submitting a PR? + quick unit test so we get a test failure if someone tries to upgrade before this is fixed upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants