Skip to content

Commit c1eb236

Browse files
Teamopjohnjbarton
authored andcommitted
fix(BaseReporter): log message correctly with just one browser (#3045)
1 parent a19b8d4 commit c1eb236

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

lib/reporters/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const BaseReporter = function (formatError, reportSlow, useColors, browserConsol
136136
}
137137

138138
this.onRunComplete = (browsers, results) => {
139-
if (browsers.length > 1 && !results.error && !results.disconnected) {
139+
if (browsers.length >= 1 && !results.error && !results.disconnected) {
140140
if (!results.failed) {
141141
this.write(this.TOTAL_SUCCESS, results.success)
142142
} else {

test/unit/reporters/base.spec.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe('reporter', () => {
44
const BaseReporter = require('../../../lib/reporters/base')
55

6-
describe('Progress', () => {
6+
describe('Base', () => {
77
let reporter
88
let adapter = reporter = null
99

@@ -181,13 +181,21 @@ describe('reporter', () => {
181181
return writeSpy.should.have.been.called
182182
})
183183

184-
return it('should format log messages correctly for multi browsers', () => {
184+
it('should format log messages correctly for multi browsers', () => {
185185
const writeSpy = sinon.spy(reporter, 'writeCommonMsg')
186186

187187
reporter._browsers = ['Chrome', 'Firefox']
188188
reporter.onBrowserLog('Chrome', 'Message', 'LOG')
189189

190190
return expect(writeSpy).to.have.been.calledWith('Chrome LOG: Message\n')
191191
})
192+
193+
it('should log messages correctly when complete with just one browser', () => {
194+
const writeSpy = sinon.spy(reporter, 'write')
195+
const mockResults = {error: false, disconnected: false}
196+
197+
reporter.onRunComplete(['Chrome'], mockResults)
198+
return writeSpy.should.have.been.called
199+
})
192200
})
193201
})

0 commit comments

Comments
 (0)