Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(launcher): Log state transitions in debug #3294

Merged
merged 1 commit into from Apr 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 17 additions & 7 deletions lib/launchers/base.js
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