Skip to content

Commit

Permalink
fix: Allow for karma.conf to be used correctly
Browse files Browse the repository at this point in the history
Now client config is only passed to karma if it's really defined
in the grunt config.

Closes #119
  • Loading branch information
cevou authored and dignifiedquire committed May 28, 2015
1 parent d7e70c1 commit 15fee6f
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tasks/grunt-karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,27 @@ module.exports = function(grunt) {

// Allow for passing cli arguments to `client.args` using `--grep=x`
var args = parseArgs(process.argv.slice(2));
if (_.isArray(options.client.args)) {
options.client.args = options.client.args.concat(args);
} else {
options.client.args = args;
if (options.client && _.isArray(options.client.args)) {
args = options.client.args.concat(args);
}

// If arguments are provided we pass them to karma
if (args.length > 0) {
if (!options.client) {
options.client = {};
}
options.client.args = args;
}

// Merge karma default options
_.defaults(options.client, {
//Only create client info if data is provided
if (options.client) {
// Merge karma default options
_.defaults(options.client, {
args: [],
useIframe: true,
captureConsole: true
});
});
}

var opts = _.cloneDeep(options);
// Merge options onto data, with data taking precedence.
Expand Down

0 comments on commit 15fee6f

Please sign in to comment.