ember-cli / ember-cli.github.io

Our documentation site
13 stars 99 forks source link

Ember CLI Testing options should be discoverable #171

Closed robert-j-webb closed 6 years ago

robert-j-webb commented 7 years ago

I was trying to find a way to launch ember test --serve without running the headless tests. I had to ask my coworker about it. He told me the option I was looking for was --no-launch, which was exactly what I needed.

Is there a reason that this isn't in the documentation on the testing page: /user-guide/#testing? There could be a chart that displays all of the options that one can use for ember cli.

kellyselden commented 7 years ago

No reason, just overlooked when --no-launch was added.

robert-j-webb commented 7 years ago

Should I make a PR to add it in? Additionally are the other options that were overlooked?

kellyselden commented 7 years ago

We would love a PR to add it. Now I'm confused because I don't see the option when running ember help serve.

robert-j-webb commented 7 years ago

I figured it would really only be worth committing if we had all of the options. After some investigation this is what I've found in commands/test.js

  availableOptions: [
    { name: 'environment', type: String,  default: 'test',          aliases: ['e'],  description: 'Possible values are "development", "production", and "test".' },
    { name: 'config-file', type: String,                            aliases: ['c', 'cf'] },
    { name: 'server',      type: Boolean, default: false,           aliases: ['s'] },
    { name: 'host',        type: String,                            aliases: ['H'] },
    { name: 'test-port',   type: Number,  default: defaultPort,     aliases: ['tp'], description: 'The test port to use when running tests. Pass 0 to automatically pick an available port' },
    { name: 'filter',      type: String,                            aliases: ['f'],  description: 'A string to filter tests to run' },
    { name: 'module',      type: String,                            aliases: ['m'],  description: 'The name of a test module to run' },
    { name: 'watcher',     type: String,  default: 'events',        aliases: ['w'] },
    { name: 'launch',      type: String,  default: false,                            description: 'A comma separated list of browsers to launch for tests.' },
    { name: 'reporter',    type: String,                            aliases: ['r'],  description: 'Test reporter to use [tap|dot|xunit] (default: tap)' },
    { name: 'silent',      type: Boolean, default: false,                            description: 'Suppress any output except for the test report' },
    { name: 'testem-debug', type: String,                                            description: 'File to write a debug log from testem' },
    { name: 'test-page',   type: String,                                             description: 'Test page to invoke' },
    { name: 'path',        type: 'Path',                                             description: 'Reuse an existing build at given path.' },
    { name: 'query',       type: String,                                             description: 'A query string to append to the test page URL.' },
  ],

I don't see --no-launch here. I think, somehow, the launch command can except a (no) before it which passes in an empty array. So that's why it wouldn't be showing up in the ember help command.

I'll get to work on making a little chart that shows all the options and their aliases for the site.

trentmwillis commented 7 years ago

The --no- prefix is a feature of nopt which is the options parser that Ember-CLI uses.