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(browser): allow updating total specs count #3264

Merged
merged 3 commits into from Feb 13, 2019
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions lib/browser.js
Expand Up @@ -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)
}
Expand Down
13 changes: 10 additions & 3 deletions test/unit/browser.spec.js
Expand Up @@ -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)
Expand Down