diff --git a/lib/cli.js b/lib/cli.js index 29211116e..3fe75fcf4 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -151,7 +151,7 @@ var describeRun = function() { .usage('Karma - Spectacular Test Runner for JavaScript.\n\n' + 'RUN - Run the tests (requires running server).\n\n' + 'Usage:\n' + - ' $0 run []') + ' $0 run [] []') .describe('port', ' Port where the server is listening.') .describe('no-refresh', 'Do not re-glob all the patterns.') .describe('help', 'Print usage.'); diff --git a/lib/config.js b/lib/config.js index 74ddfc679..4a510e764 100644 --- a/lib/config.js +++ b/lib/config.js @@ -294,6 +294,8 @@ var CONFIG_SYNTAX_HELP = ' module.exports = function(config) {\n' + var parseConfig = function(configFilePath, cliOptions) { var configModule; if (configFilePath) { + log.debug('Loading config %s', configFilePath); + try { configModule = require(configFilePath); } catch(e) { diff --git a/lib/runner.js b/lib/runner.js index a40dd999a..cffcf8d47 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -2,6 +2,8 @@ var http = require('http'); var constant = require('./constants'); var helper = require('./helper'); +var cfg = require('./config'); + var parseExitCode = function(buffer, defaultCode) { var tailPos = buffer.length - Buffer.byteLength(constant.EXIT_CODE) - 1; @@ -25,13 +27,13 @@ var parseExitCode = function(buffer, defaultCode) { // TODO(vojta): read config file (port, host, urlRoot) exports.run = function(config, done) { done = helper.isFunction(done) ? done : process.exit; + config = cfg.parseConfig(config.configFile, config); var exitCode = 1; var options = { - hostname: 'localhost', - path: '/__run__', - // TODO(vojta): remove runnerPort in 0.11 - port: config.port || config.runnerPort || constant.DEFAULT_PORT, + hostname: config.hostname, + path: config.urlRoot + 'run', + port: config.port, method: 'POST', headers: { 'Content-Type': 'application/json'