karma-runner / grunt-karma

Grunt plugin for Karma.
MIT License
468 stars 116 forks source link

Karma CLI arguments support #124

Open jcsmorais opened 10 years ago

jcsmorais commented 10 years ago

Hi,

I'm currently running karma 0.12.16 and grunt-karma 0.9.0.

On Karma's configuration each setting has a --arg flag that allows one to use it while running karma through command line interfaces. I've been using grunt-karma for a while and noticed that these arguments don't seem to work while using it.

After further investigation, I noticed the following:

Based on this it seems we are supporting --arg=value instead of the format Karma supports by default which is --arg value - any reason why? Either way, specifying something like --browsers=Chrome,Firefox doesn't seem to work - the browsers specified on Gruntfile.js keep being used instead.

Plus, here we're defining data based on opts and this.data giving precedence to the latter, bellow we're basically defining data.browsers based on this.data.browsers, maybe I'm missing something, but isn't this the same? The value of this.data.browsers is already stored in data.browsers due to the first statement, no?

I would really like to see more support on CLI arguments, specially with compliance with what Karma has by default - I'm also willing to spend some time working on this, so any feedback is appreciated.

Jeff-Symphony commented 9 years ago

This is a significantly limiting feature of this module.

So, I looked into it a bit as well. It seems that the --arg=value gets passed to the karma server as a config.client arg, which only gets passed to the browser that's running. To summarize, these parameters don't change the karma configs.

What's needed is a way to pass karma config options in addition to this current usage of client.args. I'd probably incorporate a module for arg parsing (like node-optimist).

Jeff-Symphony commented 9 years ago

It looks like this is a common (OPEN) issue: #91, #96

ahmehri commented 8 years ago

@jcsmorais @Jeff-Symphony what's the status of this PR?