From 49bf1aacef41088c16c7768f9bbce5feee232b18 Mon Sep 17 00:00:00 2001 From: Christian Budde Christensen Date: Mon, 4 Jan 2016 20:16:50 +0100 Subject: [PATCH 1/2] feat(cli): Add .config/karma.conf.js to the default lookup path Add `.config/karma.config.js` and `.config/karma.config.coffee` to the default look-up path. Closes #1387 --- lib/cli.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cli.js b/lib/cli.js index b7dd8f446..351b0848d 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -90,6 +90,10 @@ var processArgs = function (argv, options, fs, path) { configFile = './karma.conf.js' } else if (fs.existsSync('./karma.conf.coffee')) { configFile = './karma.conf.coffee' + } else if (fs.existsSync('./.config/karma.conf.js')) { + configFile = './.config/karma.conf.js' + } else if (fs.existsSync('./.config/karma.conf.coffee')) { + configFile = './.config/karma.conf.coffee' } } From 16179967eb217daf7747ce8c7d25cde9fd8fd53d Mon Sep 17 00:00:00 2001 From: Christian Budde Christensen Date: Mon, 4 Jan 2016 20:17:49 +0100 Subject: [PATCH 2/2] docs(config): Document default configuration files Update the documentation to contain the default configuration files: `./karma.conf.js`, `./karma.conf.coffee`, `./.config/karma.conf.js` and `./.config/karma.conf.js` --- docs/config/01-configuration-file.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/config/01-configuration-file.md b/docs/config/01-configuration-file.md index 214a5b0f8..84ba26fb9 100644 --- a/docs/config/01-configuration-file.md +++ b/docs/config/01-configuration-file.md @@ -7,6 +7,16 @@ Note: Most of the framework adapters, reporters, preprocessors and launchers nee The Karma configuration file can be written in JavaScript or CoffeeScript and is loaded as a regular Node.js module. + +Unless provided as argument, the Karma CLI will look for a configuration file at + +* `./karma.conf.js` +* `./karma.conf.coffee` +* `./.config/karma.conf.js` +* `./.config/karma.conf.coffee` + +in that order. + Within the configuration file, the configuration code is put together by setting `module.exports` to point to a function which accepts one argument: the configuration object.