Skip to content

Commit

Permalink
fix(launcher): Log state transitions in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjbarton committed Apr 12, 2019
1 parent 7eb48c5 commit 08affd9
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions lib/launchers/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 08affd9

Please sign in to comment.