Skip to content

Commit

Permalink
feat(server): remove deprecated static methods (karma-runner#3595)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Deprecated `require('karma').server.start()` and `require('karma').Server.start()` variants were removed from the public API. Instead use canonical form:

```
const { Server } = require('karma');
const server = new Server();
server.start();
```
  • Loading branch information
devoto13 authored and anthony-redFox committed May 5, 2023
1 parent 904b0de commit 54b57da
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
15 changes: 1 addition & 14 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,12 @@ const stopper = require('./stopper')
const launcher = require('./launcher')
const cfg = require('./config')

// TODO: remove in 1.0
const oldServer = {
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.')
const server = new Server(cliOptions, done)
server.start()
}
}

module.exports = {
constants: constants,
VERSION: constants.VERSION,
Server: Server,
runner: runner,
stopper: stopper,
launcher: launcher,
config: { parseConfig: cfg.parseConfig }, // lets start with only opening up the `parseConfig` api
server: oldServer
config: { parseConfig: cfg.parseConfig } // lets start with only opening up the `parseConfig` api
}
5 changes: 0 additions & 5 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,6 @@ class Server extends KarmaEventEmitter {
stop () {
return this.emitAsync('stop')
}

static start (cliOptions, done) {
console.warn('Deprecated static method to be removed in v3.0')
return new Server(cliOptions, done).start()
}
}

Server.prototype._start.$inject = ['config', 'launcher', 'preprocess', 'fileList', 'capturedBrowsers', 'executor', 'done']
Expand Down

0 comments on commit 54b57da

Please sign in to comment.