From 648b357a0061b62448428eed379276836f92dbe5 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Sun, 19 Jul 2015 00:05:58 +0300 Subject: [PATCH] fix: restore backward compatibility for karma@0.13 This adds `start` method back to the object exported by `lib/server.js`. Closes 1500 --- lib/index.js | 10 +++++----- lib/server.js | 9 +++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 73b3b7f37..8631260f1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -7,13 +7,13 @@ var launcher = require('./launcher') // TODO: remove in 1.0 var oldServer = { - start: function () { - throw new Error( - 'The api interface has changed. Please use \n' + + start: function (cliOptions, done) { + console.error('WARN `start` method is deprecated since 0.13. It will be removed in 0.14. Please use \n' + ' server = new Server(config, [done])\n' + ' server.start()\n' + - 'instead.' - ) + 'instead.') + var server = new Server(cliOptions, done) + server.start() } } diff --git a/lib/server.js b/lib/server.js index 0300f3165..cce0127ab 100644 --- a/lib/server.js +++ b/lib/server.js @@ -92,6 +92,15 @@ Server.prototype.start = function () { this._injector.invoke(this._start, this) } +/** + * Backward-compatibility with karma-intellij bundled with WebStorm. + * Deprecated since version 0.13, to be removed in 0.14 + */ +Server.start = function (cliOptions, done) { + var server = new Server(cliOptions, done) + server.start() +} + // Get properties from the injector // // token - String