diff --git a/lib/config.js b/lib/config.js index 6b89d7e15..591549c08 100644 --- a/lib/config.js +++ b/lib/config.js @@ -132,6 +132,35 @@ var normalizeConfig = function(config, configFilePath) { return config; }; +// TODO(vojta): remove +var CONST_ERR = '%s is not supported anymore.\n\tPlease use `frameworks = ["%s"];` instead.'; +['JASMINE', 'MOCHA', 'QUNIT'].forEach(function(framework) { + [framework, framework + '_ADAPTER'].forEach(function(name) { + Object.defineProperty(global, name, {configurable: true, get: function() { + log.warn(CONST_ERR, name, framework.toLowerCase()); + }}); + }); +}); + +['REQUIRE', 'REQUIRE_ADAPTER'].forEach(function(name) { + Object.defineProperty(global, name, {configurable: true, get: function() { + log.warn(CONST_ERR, name, 'requirejs'); + }}); +}); + +['ANGULAR_SCENARIO', 'ANGULAR_SCENARIO_ADAPTER'].forEach(function(name) { + Object.defineProperty(global, name, {configurable: true, get: function() { + log.warn(CONST_ERR, name, 'ng-scenario'); + }}); +}); + +['LOG_DISABLE', 'LOG_INFO', 'LOG_DEBUG', 'LOG_WARN', 'LOG_ERROR'].forEach(function(name) { + Object.defineProperty(global, name, {configurable: true, get: function() { + log.warn('%s is not supported anymore.\n Please use `karma.%s` instead.', name, name); + return constant.LOG_INFO; + }}); +}); + var KarmaDsl = function(config) { this.LOG_DISABLE = constant.LOG_DISABLE; this.LOG_ERROR = constant.LOG_ERROR; @@ -139,35 +168,6 @@ var KarmaDsl = function(config) { this.LOG_INFO = constant.LOG_INFO; this.LOG_DEBUG = constant.LOG_DEBUG; - // TODO(vojta): remove - var CONST_ERR = '%s is not supported anymore.\n\tPlease use `frameworks = ["%s"];` instead.'; - ['JASMINE', 'MOCHA', 'QUNIT'].forEach(function(framework) { - [framework, framework + '_ADAPTER'].forEach(function(name) { - Object.defineProperty(global, name, {get: function() { - log.warn(CONST_ERR, name, framework.toLowerCase()); - }}); - }); - }); - - ['REQUIRE', 'REQUIRE_ADAPTER'].forEach(function(name) { - Object.defineProperty(global, name, {get: function() { - log.warn(CONST_ERR, name, 'requirejs'); - }}); - }); - - ['ANGULAR_SCENARIO', 'ANGULAR_SCENARIO_ADAPTER'].forEach(function(name) { - Object.defineProperty(global, name, {get: function() { - log.warn(CONST_ERR, name, 'ng-scenario'); - }}); - }); - - ['LOG_DISABLE', 'LOG_INFO', 'LOG_DEBUG', 'LOG_WARN', 'LOG_ERROR'].forEach(function(name) { - Object.defineProperty(global, name, {get: function() { - log.warn('%s is not supported anymore.\n Please use `karma.%s` instead.', name, name); - return constant.LOG_INFO; - }}); - }); - this.configure = function(newConfig) { Object.keys(newConfig).forEach(function(key) { config[key] = newConfig[key];