diff --git a/lib/launchers/base.js b/lib/launchers/base.js index bbb8de70f..b8349ce3a 100644 --- a/lib/launchers/base.js +++ b/lib/launchers/base.js @@ -5,12 +5,12 @@ const Promise = require('bluebird') const log = require('../logger').create('launcher') const helper = require('../helper') -const BEING_CAPTURED = 1 -const CAPTURED = 2 -const BEING_KILLED = 3 -const FINISHED = 4 -const RESTARTING = 5 -const BEING_FORCE_KILLED = 6 +const BEING_CAPTURED = 'BEING_CAPTURED' +const CAPTURED = 'CAPTURED' +const BEING_KILLED = 'BEING_KILLED' +const FINISHED = 'FINISHED' +const RESTARTING = 'RESTARTING' +const BEING_FORCE_KILLED = 'BEING_FORCE_KILLED' /** * Base launcher that any custom launcher extends. @@ -29,7 +29,17 @@ function BaseLauncher (id, emitter) { this.emitAsync = KarmaEventEmitter.prototype.emitAsync.bind(this) this.id = id - this.state = null + this._state = null + Object.defineProperty(this, 'state', { + get: () => { + return this._state + }, + set: (toState) => { + log.debug(`${this._state} -> ${toState}`) + this._state = toState + } + }) + this.error = null let killingPromise