Skip to content

Commit

Permalink
feat(browser): Emit a browser error when a disconnect occurs.
Browse files Browse the repository at this point in the history
Show the suite as failing when using the karma plugin for intellij; prior
behavior was, even though the remainder of the suite would be skipped, intellij
still showed it as passing.
  • Loading branch information
Douglas Blumeyer committed Apr 12, 2016
1 parent 4748777 commit e36ba6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var Browser = function (id, fullName, /* capturedBrowsers */ collection, emitter
self.state = DISCONNECTED
self.disconnectsCount++
log.warn('Disconnected (%d times)' + (reason || ''), self.disconnectsCount)
emitter.emit('browser_error', self, 'Disconnected' + reason)
collection.remove(self)
}

Expand Down
4 changes: 4 additions & 0 deletions test/unit/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,13 @@ describe('Browser', () => {
socket.emit('result', {success: true, suite: [], log: []})
socket.emit('disconnect', 'socket.io reason')

var spyBrowserError = sinon.spy()
emitter.on('browser_error', spyBrowserError)

timer.wind(10)
expect(browser.lastResult.disconnected).to.equal(true)
expect(spy).to.have.been.calledWith(browser)
expect(spyBrowserError).to.have.been.called
})

it('restarting a disconnected browser', () => {
Expand Down

0 comments on commit e36ba6c

Please sign in to comment.