Skip to content

Commit 6556ab4

Browse files
authored
fix(launcher): Log state transitions in debug (#3294)
See #3290
1 parent 7eb48c5 commit 6556ab4

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

lib/launchers/base.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ const Promise = require('bluebird')
55
const log = require('../logger').create('launcher')
66
const helper = require('../helper')
77

8-
const BEING_CAPTURED = 1
9-
const CAPTURED = 2
10-
const BEING_KILLED = 3
11-
const FINISHED = 4
12-
const RESTARTING = 5
13-
const BEING_FORCE_KILLED = 6
8+
const BEING_CAPTURED = 'BEING_CAPTURED'
9+
const CAPTURED = 'CAPTURED'
10+
const BEING_KILLED = 'BEING_KILLED'
11+
const FINISHED = 'FINISHED'
12+
const RESTARTING = 'RESTARTING'
13+
const BEING_FORCE_KILLED = 'BEING_FORCE_KILLED'
1414

1515
/**
1616
* Base launcher that any custom launcher extends.
@@ -29,7 +29,17 @@ function BaseLauncher (id, emitter) {
2929
this.emitAsync = KarmaEventEmitter.prototype.emitAsync.bind(this)
3030

3131
this.id = id
32-
this.state = null
32+
this._state = null
33+
Object.defineProperty(this, 'state', {
34+
get: () => {
35+
return this._state
36+
},
37+
set: (toState) => {
38+
log.debug(`${this._state} -> ${toState}`)
39+
this._state = toState
40+
}
41+
})
42+
3343
this.error = null
3444

3545
let killingPromise

0 commit comments

Comments
 (0)