diff --git a/lib/browser.js b/lib/browser.js index f4389c172..699fe42ee 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -60,6 +60,10 @@ class Browser { if (helper.isDefined(info.log)) { this.emitter.emit('browser_log', this, info.log, info.type) + } else if (helper.isDefined(info.total)) { + if (this.state === EXECUTING) { + this.lastResult.total = info.total + } } else if (!helper.isDefined(info.dump)) { this.emitter.emit('browser_info', this, info) } diff --git a/test/unit/browser.spec.js b/test/unit/browser.spec.js index 33eca8013..3bd242ee5 100644 --- a/test/unit/browser.spec.js +++ b/test/unit/browser.spec.js @@ -123,12 +123,19 @@ describe('Browser', () => { expect(spy).to.have.been.calledWith(browser, infoData) }) - it('should ignore if browser not executing', () => { + it('should update total specs count during execution', () => { + browser.state = Browser.STATE_EXECUTING + browser.onInfo({total: 20}) + + expect(browser.lastResult.total).to.equal(20) + }) + + it('should ignore update total if not executing', () => { const spy = sinon.spy() - emitter.on('browser_dump', spy) + emitter.on('browser_log', spy) + emitter.on('browser_info', spy) browser.state = Browser.STATE_CONNECTED - browser.onInfo({dump: 'something'}) browser.onInfo({total: 20}) expect(browser.lastResult.total).to.equal(0)