Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix: fail if config.client.args is set to a non-array (e.g an object) #927

Merged
merged 1 commit into from

2 participants

@gfxmonk

config.client.args was never intended to allow arbitrary objects - the karma code always sets this to an array of strings. This commit ensures that if client.args is set, it's an array.

Adding this check prevents the mess mentioned in karma-runner/karma-mocha#25 (comment)

lib/config.js
@@ -134,6 +134,12 @@ var normalizeConfig = function(config, configFilePath) {
config.reporters = config.reporters.split(',');
}
+ if (config.client && config.client.args) {

can you please make it one if and use single quotes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/config.js
@@ -134,6 +134,12 @@ var normalizeConfig = function(config, configFilePath) {
config.reporters = config.reporters.split(',');
}
+ if (config.client && config.client.args) {
+ if (!Array.isArray(config.client.args)) {
+ throw new Error("client.args must be an array of strings");

and make the error "Invalid configuration: client.args..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@vojtajina

Thanks @gfxmonk and sorry for delays.

@vojtajina

Also, can you change the the commit msg to fix(config): fail if client.args is set to a non array

@gfxmonk

Done :)

@vojtajina vojtajina merged commit f0d333b into karma-runner:master
@vojtajina

thank you @gfxmonk !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 4, 2014
  1. @gfxmonk
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/config.js
View
4 lib/config.js
@@ -134,6 +134,10 @@ var normalizeConfig = function(config, configFilePath) {
config.reporters = config.reporters.split(',');
}
+ if (config.client && config.client.args && !Array.isArray(config.client.args)) {
+ throw new Error('Invalid configuration: client.args must be an array of strings');
+ }
+
// normalize preprocessors
var preprocessors = config.preprocessors || {};
var normalizedPreprocessors = config.preprocessors = Object.create(null);
Something went wrong with that request. Please try again.