karma-runner / grunt-karma

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

client properties overwritten when using configFile #119

Closed zoltan-mihalyi closed 9 years ago

zoltan-mihalyi commented 10 years ago

When using the config file it does not work:

client: {
    useIframe: true
}

But the same config works in Gruntfile

cevou commented 9 years ago

I have the same issue. grunt-karma always passes some client default values:, see: https://github.com/karma-runner/grunt-karma/blob/master/tasks/grunt-karma.js#L33-L38

In the karma config you can see (https://github.com/karma-runner/karma/blob/master/lib/config.js#L278-L288) that first the config.set from the config file is called and after that config.set is called again with the cliArgs (which have some default set in grunt-karma). This will always overwrite the client settings from the config file.

I think that the creation of default values should not be done in grunt-karma. If there are no client arguments set in the config file, the default values are used anyway directly by karma, see https://github.com/karma-runner/karma/blob/dd1971fffc3a7f758c89119aa7307f71df26b37f/lib/config.js#L228-L232

If it's OK i would provide a pull request where the coding is removed. For that the arguments also have to be handled differently. They should only be handled if they are actually set.