From 98724b6ef5a6ba60d487e7b774056832c6ca9d8c Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Mon, 1 Apr 2013 19:55:42 +0200 Subject: [PATCH] fix(config): Check if configFilePath is a string. Fixes #447. --- lib/config.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/config.js b/lib/config.js index c87b9838e..cacecb92c 100644 --- a/lib/config.js +++ b/lib/config.js @@ -188,7 +188,7 @@ var readConfigFile = function(filepath) { var parseConfig = function(configFilePath, cliOptions) { - var configFromFile = configFilePath ? readConfigFile(configFilePath) : {}; + var configFromFile = helper.isString(configFilePath) ? readConfigFile(configFilePath) : {}; // default config var config = { @@ -236,11 +236,13 @@ var parseConfig = function(configFilePath, cliOptions) { } }); - // resolve basePath - config.basePath = path.resolve(path.dirname(configFilePath), config.basePath); + if (helper.isString(configFilePath)) { + // resolve basePath + config.basePath = path.resolve(path.dirname(configFilePath), config.basePath); - // always ignore the config file itself - config.exclude.push(configFilePath); + // always ignore the config file itself + config.exclude.push(configFilePath); + } return normalizeConfig(config); };